Skip to Content.
Sympa Menu

freetds - [freetds] big commit: language command variable support added

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark J. Lilback" <mark AT lilback.com>
  • To: freetds mailing list <freetds AT lists.ibiblio.org>
  • Subject: [freetds] big commit: language command variable support added
  • Date: Thu, 6 Mar 2003 19:09:01 -0500

I've committed changes to support variable bindings with TDS 5.0. I'll get to TDS 7/8 next.

This required the addition of a parameter to tds_submit_query (otherwise, I'd be duplicating the function entirely), so this change touched a number of files.

I also added a test for it, but it fails when talking to MS SQL Server since I haven't configured this to work with TDS 7. (But then, I got a failure on a make check because some of the dblib tests don't work with Sybase.)

This change lets you send queries such as "insert into foo (col1, col2) values (@param1, @param2)" and then call ct_param to bind values to the variables by name or by order. I haven't implemented ct_setparam yet, but that should be pretty trivial to do. (Actually, it was all pretty easy to do thanks to Bill's work for rpc.)

One thing that might be necessary to do is cleanup the CS_COMMAND structure more often. According to the Sybase docs, a call to ct_command, ct_cursor, ct_dynamic, or ct_sendpassthru (which we don't even stub out) causes any previously initiated command information to be discarded. We do not appear to be doing this anywhere. I added some code to the top of those functions to clear our the parameter information stored by ct_param, but we likely need a function that cleans up all the currently stored data so a new command can be initiated with the same structure.


--
__________________________________________________________________________
"They that can give up essential liberty
Mark J. Lilback to obtain a little temporary safety
<mark AT lilback.com> deserve neither liberty or safety."
http://www.lilback.com/ -- Benjamin Franklin




Archive powered by MHonArc 2.6.24.

Top of Page