Skip to Content.
Sympa Menu

freetds - RE: [freetds] Problem with data type conversions and FreeTDScont inued...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Problem with data type conversions and FreeTDScont inued...
  • Date: Fri, 1 Aug 2003 14:17:14 +0200

>
> OK,
>
> I've found the problem!
>
> We have a code issue, we are wrongly treating the data on the
> variant data type
>
> In tds_get_data() in token.c we have the following code
>
> tdsdump_log(TDS_DBG_INFO1, "%L processing row. column is
> %d varint size = %d\n", i, curcol->column_varint_size);
> switch (curcol->column_varint_size) {
> case 4: /* Its a BLOB... */
> len = tds_get_byte(tds);
> blob_info = (TDSBLOBINFO *) &
> (current_row[curcol->column_offset]);
> if (len == 16) { /* Jeff's hack */
> tds_get_n(tds, blob_info->textptr, 16);
> tds_get_n(tds, blob_info->timestamp, 8);
> colsize = tds_get_int(tds);
> } else {
> colsize = 0;
> }
> break;
>
> A VARIANT type has a "varint_size" of 4, but in this code we
> assume that anything with a
> varint size of 4 is a BLOB (text or image) column, and the
> code only really caters for that. We'll need a change like:
>
> tdsdump_log(TDS_DBG_INFO1, "%L processing row. column is
> %d varint size = %d\n", i, curcol->column_varint_size);
> switch (curcol->column_varint_size) {
> case 4: /* BLOB or VARIANT */
> if (is_blob_type(curcol->column_type) {
> len = tds_get_byte(tds);
> blob_info = (TDSBLOBINFO *) &
> (current_row[curcol->column_offset]);
> if (len == 16) { /* Jeff's hack */
> tds_get_n(tds, blob_info->textptr, 16);
> tds_get_n(tds, blob_info->timestamp, 8);
> colsize = tds_get_int(tds);
> } else {
> colsize = 0;
> }
> } else { /* VARIANT Type , but we could be more rigorous in
> checking this... */
> colsize = tds_get_int(tds);
> }
> break;
>
>
> HTH,
>
> Bill
>

I bet we are whatching the same code :)

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page