This is a discussion on Multiple execution of a single prepared statement within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> We have an application that writes to a table using ODBC. In order to be a bit more efficient ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| We have an application that writes to a table using ODBC. In order to be a bit more efficient than preparing and executing each time a write is required, we wait for a batch of writes to amass, prepare a statement, bind the parameters, then for each row copy the data into the bound variables and call SQLExecute. The call sequence is... SQLAllocHandle (statement) SQLPrepare SQLBindParameter .... while (data) copy data SQLExecute end while SQLFreeHandle (statement) This works for the most part. It fails however if there is an insert trigger on the destination table. The first call to SQLExecute succeeds, but the second of the batch never returns and gobbles up all the CPU. FYI I've explictly set in the connection handle: Autocommit on Async off Transaction Isolation (is a app config param but makes no difference in this case) Its a long while since I've done any ODBC coding. I get the impression I must have forgotten something but I can't figure out what. Any help would be greatly appreciated. -- Tom Fosdick APD Communications http://www.apdcomms.com |