Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

MySQL++ DELETE INSERT ISSUE (no replies)

$
0
0
Hello Everyone,

I have mysql++ 3.1.0 and MySQL 5.1.56-community (Server/Client) installed

I have a multi-thread application, which each thread has its own connection to the DB, my problem is the followings

When the function in the application tried to do the queries on the same table with the sequence, like Lock/Delete/Insert/Unlock, then my application randomly got segfault, I found out the queries sequence caused parameters in function caller to become invalid (stack overflow alike), I passed the a relevant parameter as reference to the callee function, and print out contents of the parameters before and after the queries sequence, the content integrity is fine before the sequence and the content of the parameters become rubbish after the query sequence. I am wondering if any of you have the same problem or know how I can fix, much appreciated.

I put the pseudo-code below. (I locked/unlock twice between query, it does not make any different if I call lock/unlock once)

void function1(struct SOMEDATASTRUCT &a) {

print a; // OK

LOCK TABLES TABLE1 WRITE;

DELETE FROM TABLE1 WHERE ...;

UNLOCK TABLES;

LOCK TABLES TABLE1 WRITE;

INSERT INTO TABLE1 ...

UNLOCK TABLES

print a; //Rubbish :-(

}


Best Regards!

Hai

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>