#include #include #include #include #include #include #include #define NUM_THREADS 20 #include "mysql_connection.h" #include #include #include #include using namespace std; void *testBug(void *threadid) { long tid; tid = (long)threadid; cout << endl; printf("testBug(), thread #%ld, begin\n", tid); try { sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::PreparedStatement *pstmt; sql::ResultSet *res; /* Create a connection */ driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:4040", "root", ""); stmt = con->createStatement(); for (long t=0; t < 1000000; t++) { stmt->executeQuery("select 1"); } } catch (sql::SQLException &e) { cout << "# ERR: SQLException in " << __FILE__; cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl; cout << "# ERR: " << e.what(); cout << " (MySQL error code: " << e.getErrorCode(); cout << ", SQLState: " << e.getSQLState() << " )" << endl; } printf("testBug(), thread #%ld, end\n", tid); pthread_exit(NULL); } int main() { pthread_t threads[NUM_THREADS]; int rc; long t; for(t=0; t