Skip to Content.
Sympa Menu

freetds - [freetds] [ freetds-Patches-727555 ] Patch for ODBC binary data.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "SourceForge.net" <noreply AT sourceforge.net>
  • To: noreply AT sourceforge.net
  • Subject: [freetds] [ freetds-Patches-727555 ] Patch for ODBC binary data.
  • Date: Fri, 25 Apr 2003 08:46:13 -0700

Patches item #727555, was opened at 2003-04-25 15:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=727555&group_id=33106

Category: odbc
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerhard Esterhuizen (gmpff)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for ODBC binary data.

Initial Comment:

Sorry for the double post, but the mailing list
stripped the attachment from my first attempt. Please
let met know if there are any other issues.


Hi,

Attached is a patch that allows the FreeTDS ODBC driver
to handle binary data (SQL types SQL_BINARY and
SQL_VARBINARY and C type SQL_C_BINARY). This allows
binary data (IMAGE fields and void*/length) to be read
and written using the ODBC interface.

The patches were created against nightly snapshot of
17/03/2003 (i.e. freetds-0.62.dev.20030317). I didn't
do it against the CVS snapshot as my automake/autoconf
complained about missing files (e.g. config.h.in) -
probably due to old autotools). The latest nightly
snapshot (25/04/2003) built fine, but refused to
authenticate (unixODBC gave "Login incorrect.").

The patch does the following:

1. Add handling of SQL_C_BINARY to
src/odbc/convert_sql2string.c:convert_sql2string().

2. Add
src/odbc/convert_sql2string.c:convert_binary2string().

3. Add handling of SQL_C_BINARY to
src/odbc/convert_tds2sql.c:convert_tds2sql().

4. Add handling of SQL_BINARY and SQL_VARBINARY in
src/odbc/prepare_query:_get_sql_textsize().


My motivation for creating these patches are:

1. The existing convert_sql2string didn't handle a
source type of
SQL_C_BINARY specially, but forwarded to tds_convert() (in
src/tds/convert.c) which didn't work (due to the
omission of the "0x" prefix in the encoded string -
changing this would probably have broken other
interfaces depending on tds_convert).

2. Returning a binary field as a hex-encoded C string
(i.e. SQL type SQL_BINARY and C type SQL_C_CHAR)
doesn't work properly due to a bug in SQLGetData() (in
src/odbc/odbc.c): convert_tds2sql() returns the size of
the converted buffer, but it is used as an offset into
the source buffer. As each binary source byte gets
converted to two bytes, this doesn't work.

I hope these patches don't break anything else and
works as advertised.


Regards,

gerhard.



----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=727555&group_id=33106




Archive powered by MHonArc 2.6.24.

Top of Page