MySQL Forums
Forum List  »  Connector/C++

MySQL++ DELETE INSERT ISSUE
Posted by: H W
Date: June 15, 2011 07:46AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL++ DELETE INSERT ISSUE
2925
H W
June 15, 2011 07:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.