I am working with some code that I did not develop and unfortunately I
cannot get a hold of the developer. Whenever I run the following snippet of
code, I get an error that the stack around "res" is corrupt.
A pointer to a db connection is made global at the beginning of the file:
mysqlpp::Connection *g_pdbcon1 = NULL;
and initialized in the main function:
g_pdbcon1 = new mysqlpp::Connection(mysqlpp::use_exceptions);
g_pdbcon1->connect(MYSQL_DATABASE, MYSQL_HOST, MYSQL_USER, MYSQL_PASS);
When the following code executes (in another function), I get the "stack
corruption" error.
mysqlpp::Query query = g_pdbcon1->query();
query << "DESCRIBE " << szTable;
mysqlpp::ResUse res = query.use();
In the debugger, it seems that a connection to MySQL is established and that
the query executed successfully.
What could the problem be? Are they not using Query correctly? ;-) Any
coding workarounds I could try?
I am using MS Visual Studio C++ 2008 Professional on Windows XP.
I have been pulling my hair out over this problem.
Thanks,
--
RRR