[freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND _TYPE

Lowden, James K LowdenJK at bernstein.com
Fri Jun 27 16:59:52 EDT 2003

> From: Arjona, Ramon [mailto:Ramon.Arjona at wizards.com]
> Sent: June 27, 2003 2:11 PM
> I'm using FreeTDS version 0.61 on Red Hat Linux with version 2.2.2 of
> unixODBC.  I'm connecting to an MS SQL 2000 box using TDSVER=8.0.
> stat = SQLSetStmtAttr(mycmd, SQL_ATTR_ROW_BIND_TYPE, 
> This falls through into SQLSetStmtOption in odbc.c.  This 
> function then
> falls through to the error handler, logging the message that
> "odbc:SQLSetStmtOption: Statment option 5 not implemented" 
> which in turn causes the application to dump core.


> 1) What should be the appropriate idiom to work around this problem in
> FreeTDS?  Should I just comment out the set attribute statement or is
> there some other approach I ought to take.

You're going to have to make some serious changes, either to FreeTDS or to
your application.  SQL_BIND_BY_COLUMN, if I understand it correctly, is what
ct-lib calls "array binding": you fetch your results a column at a time,
rather than the normal row-at-a-time.  It is not yet supported in any form
in the ODBC driver.  

Array binding was added to ct-lib in March (since the 0.61 release) cf.
src/ctlib/ct.c::_ct_bind_data().  Also note Steve Murphree's patch on Source
Forge: he's begun an implementation of SQLSetStmtAttr(), which Microsoft
says supersedes SQLSetStmtOption().  

> 2) If I were to attack the problem at odbc.c itself and attempt to
> implement this function & option, can anyone reccomend a set of useful
> reference documentation?

Thank you for considering that idea.  

The horse's mouth for ODBC is Microsoft.  Look on their website for
"Microsoft Data Access Components SDK".  It includes the ODBC specification
in their proprietary format.  It may be online as well.  Microsoft's own
ODBC driver for SQL Server includes some "extensions" to the ODBC standard;
those are described in the SQL Server documentation.  

If you're going to send a patch, please use cvs if possibly can to keep your
sources synchronized.  

The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.

More information about the FreeTDS mailing list