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

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Jan 10 08:14:19 EST 2008


> 
> Il giorno mer, 09/01/2008 alle 11.11 +0100, Sebastien FLAESCH ha
> scritto:
> > 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
> 
> I'll fix this problem is that it consider numm-termination 
> cause source
> is longvarchar while it should consider destination (witch is
> SQL_C_BINARY)
> 

Fixed (both 0.82 and CVS HEAD)

freddy77


More information about the FreeTDS mailing list