Skip to Content.
Sympa Menu

freetds - [freetds] 0.63RC5 - dblib - varbinary & dbconvert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Cole, Chris (London)" <christopher_cole AT ml.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] 0.63RC5 - dblib - varbinary & dbconvert
  • Date: Fri, 7 Jan 2005 11:47:27 -0000

Using 0.63RC5 I am bulkloading programmatically into a SQLServer
database. I have a column defined as varbinary. My program variable is a
variable length block of binary data. In bcp_bind I have defined the
"type" to be SYBVARBINARY. During loading this is detected by
dbconvert() as a column not requiring conversion (line 1742: ...srctype
== desttype). However, in the subsequent code that follows this
condition there is no switch to handle SYBVARBINARY (i.e. copy src to
dest and pad dest). What happens is that the default case is hit and -1
returned as the converted_data_size to _bcp_get_col_data. This isn't a
failure condition in _bcp_get_col_data, so execution continues in
_bcp_build_bcp_record until an attempt is made to append the converted
data to the output buffer (bcp.c : 2624) at which point my process dies.

I can fix this very easily by adding a SYBVARBINARY case to the switch
starting in dbconvert at line 1742. Is this appropriate? Is there
anything wrong with doing this?

BTW: if I set the program variable to be SYBBINARY, tds_convert
correctly handles the conversion (i.e. just copies the src to dest), but
the conversion ultimately fails gracefully with unrecognized desttype
(SYBVARBINARY). dbconvert doesn't seem to cater for SYBVARBINARY at all.
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain or
redistribute it. Click here for important additional terms relating to this
e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------





Archive powered by MHonArc 2.6.24.

Top of Page