MySQL++ problem

Started by
2 comments, last by hplus0603 14 years, 4 months ago
I'm having issues with the code below. I finally managed to get my application to connect to the SQL database using mySQL++, but it refuses to process my query properly. When I run it, I get the error "Run Time Check Failure #2: The stack around the variable squery was corrupted." Can someone please tell me whats gone wrong? Any help would be appreciated. Its driving me nuts. Thanks.

int main(int argc,char **argv)
{
	mysqlpp::Connection conn(false);
	if(conn.connect("warrior","localhost","root","mypw") == false)
	{
		cout << "Nope.";
		cin.get();
	}
	else
	{
		cout << "Yes.";
		cin.get();
	};
	mysqlpp::Query squery = conn.query("SELECT * FROM player");
	return 0;
};
Advertisement
put:
try {...    } catch (const mysqlpp::BadQuery& er) {        cerr << "BadQuery: " << er.what() << endl;    } catch (const mysqlpp::BadConversion& er) {        cerr << "BadConversion: " << er.what() << endl;    } catch (const mysqlpp::Exception& er) {        cerr << "Exception: " << er.what() << endl;    } catch (...) {        cerr << "foo" << endl;    }
around the code.

Other than that, do a full rebuild of the library and the project.
Are you including the right headers an libraries?
My guess is that the mysql++ library was built for another version of the compiler than what you're using.
But without more information, it's impossible to know for sure. Try single-stepping at the assembly level in the debugger, and see what gets corrupted. Re-start the program, and set a data breakpoint on that address, and see what writes to it.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement