[V4RB] VText Problem

Charles Yeomans yeomans at desuetude.com
Wed Nov 2 17:22:20 CST 2005


On Nov 2, 2005, at 4:57 PM, Ken Jordan wrote:

> Similar to last (BLOB) problem.
> ----------------------------------------------------
>  dim f as FolderItem = GetFolderItem( "dbTest.vdb" )
>  if f.Exists then f.Delete()
>  dim testDB as VDatabase = new VDatabase
>  testDB.Create(f, 1, 32 * 1024, EVOs.kOSDefault )
>  dim photo_table as VTable = testDB.CreateTable("ptable")
>  call photo_table.CreateTextField( "pic", 1024 )
>  photo_table.SetBlank()
>  f = GetFolderItem("goofy.jpg")
>  dim p as Picture = f.OpenAsPicture()
>  dim s1 As String = PNGu.GetData(p)
>  photo_table.Field( "pic" ).SetString(s1)
>  call photo_table.AddRecord()
>  dim bRes as Boolean = photo_table.FirstRecord()
>  dim s2 As String = photo_table.Field( "pic" ).GetString()
>  if s1 <> s2 then
>    msgbox "not the same"
>  End If
>  testDB.Close
>  testDB = nil
> ----------------------------------------------------------
> MessageBox displays "not the same" every time.
> I suspect that its an encoding problem, but I've tried every kind of 
> encoding manipulation that I can think of but haven't been able to get 
> a match. Any ideas??

You should be using StrComp to compare the strings; it will tell you 
whether they contain the same bytes, I think.  My recollection (which 
may be from v1) is that GetString doesn't work for VBlob and maybe 
VText.  Since pic is a VText field, you should retrieve the data using 
VText.Value, or VBlob.ReadData.

--------------
Charles Yeomans



More information about the Valentina mailing list