Hi,
I have written the following test case in which I'm trying to access
the database using differant threads each thread calls this function
test2(), access to which is protected by a pthread_mutex_lock() at the
beginning of the test and pthread_mutex_unlock() at the end of the test.
The same code when it is compiled using libmysqlclient works
and doesn't work while using libmysqlclient_r
Can anyone help me out on this .
I'm including mysql.h as the header file
The platform I'm using is Linux 2.4.4-4 Suse Linux . I'm also using
InnoDB tables for the same.
regards,
void test2(int l = 0 ){
pthread_mutex_lock(&lockmutex);
FASDBConnection conn1;
conn1.Connect("lithium.ini.cmu.edu","shivam_test","shivam","shivam_pass");
if(conn1.isConnected())
cout << "Success Connection" << endl;
else
cout << "Failed Connection" << endl;
for(int i = 0; i < 1000; i++){
string query = "SELECT * from STUDENTS ";
FASDBStatement *r = conn1.createStatement();
FASDBResult rr;
rr = r->ExecuteQuery(query);
int num = rr.getNumRows();
if(num == 0){
cout << "Query failed number: " << (i+1);
if(l != 0){
// FAILURE_QUERY[l-1]++;
cout << " Failure Thread Num: " << l;
}
cout << endl;
delete r;
continue;
}
// SUCCESS_QUERY[l-1]++;
cout << "QUERY NO." << i << endl;
while(rr.nextRow()){
FASDBRow row = rr.getCurrentRow();
cout << setw(10) << row.getString(0);
cout << setw(10) << row.getString(1);
cout << setw(10) << row.getInteger(2) << endl;
}
cout << "Index : " << (i+1) << "ThreadID: " << l << endl;
delete r;
}
conn1.Close();
pthread_mutex_unlock(&lockmutex);
}
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php