[freetds] Are LOBs supported? Two additional bytes are fetched for text column.

Sebastien FLAESCH sf at 4js.com
Wed Jan 9 05:11:05 EST 2008


Hello,

Here is a new version of the odbctest17.c sample...

Now the program uses SQL_LEN_DATA_AT_EXEC() macro for SQLBindParameter().

But still uses SQL_DATA_AT_EXEC for SQLBindCol() (I suppose this is supported).

I think there is a problem when fetching text data:

By inserting 10000 bytes, then fetching, I get 2 additional bytes for the text column.

I checked the values inserted in the database with:

   select datalength(t), datalength(b) from tt

returns:

0       10000         10000
1       10000         10000

So to me the insert is ok.

Try the following:

./odbctest17.bin dsn user pswd 2

where 2 is the number of rows to be inserted.

Output gives:

 >> insert... 0
 >> SQLParamData: ptr = 0xbff4b990  rcode = 99
 >> param 0xbff4b990: total bytes written = 10000
 >> SQLParamData: ptr = 0xbff4b990  rcode = 99
 >> param 0xbff4b990: total bytes written = 10000
 >> SQLParamData: ptr = 0xbff4b990  rcode = 0
 >> insert... 1
 >> SQLParamData: ptr = 0xbff4b990  rcode = 99
 >> param 0xbff4b990: total bytes written = 10000
 >> SQLParamData: ptr = 0xbff4b990  rcode = 99
 >> param 0xbff4b990: total bytes written = 10000
 >> SQLParamData: ptr = 0xbff4b990  rcode = 0
 >> fetch... 0  rcode = 0
 >> readBlob field 1
 >>     step 1: 4096 bytes read...
 >>     step 2: 4096 bytes read...
 >>     step 3: 1810 bytes read...
 >>   total bytes read = 10002               <--- should be 10000
 >> readBlob field 2
 >>     step 1: 4096 bytes read...
 >>     step 2: 4096 bytes read...
 >>     step 3: 1808 bytes read...
 >>   total bytes read = 10000
 >> fetch... 1  rcode = 0
 >> readBlob field 1
 >>     step 1: 4096 bytes read...
 >>     step 2: 4096 bytes read...
 >>     step 3: 1810 bytes read...
 >>   total bytes read = 10002               <--- should be 10000
 >> readBlob field 2
 >>     step 1: 4096 bytes read...
 >>     step 2: 4096 bytes read...
 >>     step 3: 1808 bytes read...
 >>   total bytes read = 10000
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbctest17.c
Type: text/x-csrc
Size: 8808 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080109/1495d180/attachment.bin 


More information about the FreeTDS mailing list