Sign in to follow this  
GavRobbs

MySQL++ problem

Recommended Posts

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;
};

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this