[freetds] Calling FreeTDS via MS Driver Manager - Array Bound Inserts only Insert the First Record

Bill Kehoe bkehoe at expressor-software.com
Thu Apr 30 15:29:40 EDT 2009


Hello:

I know the configuration sounds a bit odd but I'm trying to establish proper operational FreeTDS access to MSSQL and Sybase by invoking the driver via the MS Driver Manager on Windows XP/SP2.

Queries appear to run fine.  But when I attempt to run array-bound inserts, only the first record of the array gets inserted into the table.

Note that I know the application works since it inserts all the records in the table when I link it directly to FreeTDS (and not to the MS driver manager using odbc.lib).

I know where it's failing.  The MS Driver Manager is not propagating the application's call to SQLSetStmtAttr - specifically to set the SQL_ATTR_PARAMSET_SIZE value  to set the size of the bind array -- down to FreeTDS.   I've placed debugger breakpoints in the SQLSetStmtOptions and SQLSetStmtAttr functions and I can see that it's getting called when my application is calling into the Driver Manager's SQLAllocHandle, SQLFreeHandle and SQLFetch entry points but never when the application calls SQLSetStmtAttr.  Furthermore, none of those calls into FreeTDS' SQLSetStmtAttr function pass in the attribute value SQL_ATTR_PARAMSET_SIZE.  Because the request to set the  SQL_ATTR_PARAMSET_SIZE is not being honored,  the array count descriptor in FreeTDS.SQLExecute remains stuck on 1 and so SQLExecute only iterates once over the bind array.

I suspect this behavior has something to do with the MS Driver Manager taking over the array binding functionality assuming the driver (FreeTDS) doesn't support it but I'm not sure why this would be the case - FreeTDS appears to return all the correct ODBC capabilities information.

Has anyone ever been successful doing array-bound inserts using FreeTDS via the MS Driver Manager?

Any ideas would be appreciated.

Thanks.
-Bill




More information about the FreeTDS mailing list