Skip to Content.
Sympa Menu

freetds - [freetds] Problem with data type conversions and FreeTDS continued...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James Vanns <jimv AT canterbury.ac.uk>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Problem with data type conversions and FreeTDS continued...
  • Date: Thu, 31 Jul 2003 13:19:04 -0000

Background:

Linux to M$ SQL Server 2000 (using FreeTDS 0.61 and TDS==8.0)
Problem printing images/binaries and Unique Identifiers.
Code below.

OK, I have discovered more. The function tds_get_null() seems to think
that the field containing the UID is null - when it isn't. SO in fact
the tds_convert function is never called on that value.

Why does tds_get_null think that the current row,column field is NULL
when it contains that {45535-HHKSJOD-3456} thing!?

Here's the code again:
const string& tds::connection::print_field_as_string (const int &column)
const {
static string str;
unsigned char *row = results->current_row;
const int type = results->columns[column]->column_type;
const int offset = results->columns[column]->column_offset;
const int size = results->columns[column]->column_cur_size;
const int conversion_type = tds_get_conversion_type (type, size);

str.clear ();

if (tds_get_null (row, column))
str = "NULL";
else {
CONV_RESULT convert;
unsigned char *value = row + offset;

if (is_blob_type (type))
value = (unsigned char*) ((TDSBLOBINFO *)
value)->textvalue;

if (tds_convert (context, conversion_type, (TDS_CHAR *)
value, size, SYBVARCHAR, &convert) < 0)
throw tds::error ("Failed to convert row type at
column %d.", column + 1);

str = convert.c;
free (convert.c);
}

return str;
}


Any ideas? Thanks!

Jim

--
James Vanns BSc (Hons) MCP
Linux Systems Administrator
Senior Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370





Archive powered by MHonArc 2.6.24.

Top of Page