Hello, im having issues with MySQL++ and desperately need help.
I'm using Visual Studio 2010, MySQL++ v3.1.0 and MySQL v5.1.59( x86 & x64 );
All Library's have been compiled correctly. This error only occurs in Debug version due to the compiler setting "Both (/RTC1, equiv. to /RTCsu) (/RTC1)" being on.
I've been raging for 2 days over this problem, and traced it down to the fact that ALL mysqlpp variables that are created on stack, as shown in my code, give this error when they get destroyed on leaving the scope.
The code works perfectly and does what its suppose to in both Debug and Release. So the only problems im having, are these errors showing up in Debug. If they are (which I suppose they are) bugs with the VS10Compiler/MySQL/MySQL++ - I would be happy to do some hack/disabling of warnings that effect only this section of my code (haven't figured out how to either). As already said, the code works like a charm.
Note to my code: I also receive this warning if I comment out everything in between the connection and the disconnection.
Thank you for any help that you can offer.
Output:
1 2
|
First-chance exception at 0x000007fefdb4cacd in Launcher.exe: Microsoft C++ exception: mysqlpp::BadQuery at memory location 0x0a04f2a0..
Run-Time Check Failure #2 - Stack around the variable 'conn' was corrupted.
|
My code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void CMyClass::Run()
{
// Everything in here is run on its own thread
try
{
mysqlpp::Connection conn( false );
if( !conn.connect( SQL_DATABASE, SQL_SERVER, SQL_USERNAME, SQL_PASSWORD, SQL_PORT ) )
{
Error( "[SQL] Failed to connect to Listening Server, this game will not show up on the Online List!" );
return;
}
// Get the NAT IP and add to Host info
mysqlpp::Query query = conn.query();
query << "SELECT USER();";
mysqlpp::UseQueryResult res = query.use();
mysqlpp::Row row = res.fetch_row();
string sRawIP( row[0].c_str() );
int nFirst = sRawIP.find_first_of( "@" );
sRawIP.erase( 0, nFirst+1 );
for( int i = 0, j = 0; true; i++ )
{
if( !strcmp( string( sRawIP[i] ), "-" ) )
j++;
if( j == 4 )
{
sRawIP.erase( i, sRawIP.size() );
sRawIP.replace( "-", "." );
string sFormatedIP( sRawIP.c_str() );
Info( "[SQL] Formated IP: %s", sFormatedIP.c_str() );
break;
}
}
conn.disconnect();
}
catch( mysqlpp::BadQuery &e )
{
Error( "[SQL] Exception: %s", e.what() );
}
}
|