[VXCMD] Help with Text fields

Peter McConachie pmccon at bigpond.net.au
Sat Jun 18 17:27:27 CDT 2005


Can anyone please help,

I'm having trouble adding a TEXT field to a table under Version1 & MCard
2.6.2. Table has 2 string columns (cName,cText) and one TEXT column (cData).

To add a new record I imagine one first adds a row with
    put "SELECT cName,cText from Table where recID=0" into sSQL
    put "valueForcName"&tab&"valueForcText" into addStr
    put Valentina("DataBase_SQLSelect",dbRef,sSQL,"1","1","1") into cRef
    put Valentina("Cursor_AddRecord",cRef,addStr,tab) into tRes
    get Valentina("Cursor_Remove", cRef)
    get Valentina("DataBase_Flush",dbRef)

Then knowing the recID of the added row I imagine one then updates the TEXT
column using the following
    local data
    put somedata into data
    put "SELECT * from Table where recID=1" into sSQL
    put Valentina("DataBase_SQLSelect",dbRef,sSQL,"1","1","1") into cRef
    put Valentina("Cursor_GetFieldRef",cRef,"cData") into fRef
    get Valentina("BINARY_WriteData",fRef,"data")
    get Valentina("Cursor_UpdateRecord",cRef)
    get Valentina("Cursor_Remove", cRef)
    get Valentina("DataBase_Flush",dbRef)

And to read back the added data
    local data
    put "SELECT * from Table where recID=1" into sSQL
    put Valentina("DataBase_SQLSelect",dbRef,sSQL,"1","1","1") into cRef
    put Valentina("Cursor_GetFieldRef",cRef,"cData") into fRef
    put Valentina("BLOB_GetDataSize",fRef) into bSize
    get Valentina("BINARY_ReadData",fRef,"data",bSize,0)
    get Valentina("Cursor_Remove", cRef)
    get Valentina("DataBase_Flush",dbRef)


I can't get this to work as TEXT.
 
1. Seems not to write anything to cData. On read BLOB_GetDataSize return
zero

2. If I change the TEXT field to VarBinary[65300] then it works OK.
I need to remove the BLOB_GetDataSize command (gives a 310 error) contrary
to documentation. 

3. Should I be using BLOB_WriteData instead of Binary_WriteData ? However if
this is the case how does one get the data out of the MemoryBuffer ?

4. Is there some easier way to add/retrieve large text files ?


Many thanks,
Peter McConachie  



More information about the Valentina mailing list