RE: [Dev-C++] (OT:) SQLExecDirect fails on good statements
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ed C. <em...@to...> - 2003-10-26 00:33:00
|
That would be my suspicion, but I don't know where the problem might lie... How can I tell which of the libraries included in the Dev-C++/mingw distribution are not thread-safe? -Ed -----Original Message----- From: Per Westermark [mailto:pw...@ia...] Sent: Saturday, October 25, 2003 8:12 PM To: Ed Cottrell Cc: dev...@li... Subject: Re: [Dev-C++] (OT:) SQLExecDirect fails on good statements I would suspect either your threaded code, or that you are not linking with a thread-safe library. /Per W On Sat, 25 Oct 2003, Ed Cottrell wrote: > Hi all, > > This is probably going to be too abstract to get an answer, but here > goes: in an application I'm working on, lots (usually thousands) of > database queries are issued of the form > > "SELECT division_id FROM my_db.my_table WHERE division='var1' and > division_id = var2" > > I'm building these queries using sprintf(), then running them with > SQLExecDirect; about 99.98% of the time, this works perfectly. The > remaining .02% of queries will fail, randomly. For example, the query > "SELECT division_id FROM my_db.my_table WHERE division='FOO' and > division_id = 1" will work almost every time, but fail .02% of the > time. > > These queries are being created and executed by (a user-defined number > of) threads, but not asynchronously, and the database server is not > having any problems. As I've said, the failures are not on (or > immediately) following specific queries, but seem to be randomly > distributed throughout the thousands of queries being executing. I put > in a little error check, so that if SQLExecDirect does not return > SQL_SUCCESS, I get a display of the failed query, and I can verify > that the data is not being corrupted, I don't have any buffer > overflows, etc. The database server is MySQL-max-nt. > > I'm sorry, but I can't post full source code, for various reasons. I'm > just wondering if anybody knows why perfectly valid SQL statements > would fail, once in every 5,000 tries, when the server itself is not > being overwhelmed. > > -Ed > |