Unix Technical Forum

Multiple execution of a single prepared statement

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:10 PM
Tom Fosdick
 
Posts: n/a
Default Multiple execution of a single prepared statement

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:00 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com