Skip to Content.
Sympa Menu

freetds - [freetds] [ freetds-Patches-727515 ] 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-727515 ] Patch for ODBC binary data.
  • Date: Fri, 25 Apr 2003 10:09:32 -0700

Patches item #727515, was opened at 2003-04-25 17:18
Message generated for change (Comment added) made by freddy77
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=727515&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.



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

>Comment By: Frediano Ziglio (freddy77)
Date: 2003-04-25 19:09

Message:
Logged In: YES
user_id=75766

I think this is the same patch as #727555...

freddy77


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

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




Archive powered by MHonArc 2.6.24.

Top of Page