List:MySQL++« Previous MessageNext Message »
From:Jean-François Pérusse Date:April 9 2005 12:05am
Subject:Access Violation on store() under windows
View as plain text  
Hi, I'm trying to get MySQL++ working but it keeps crashing.

The steps I followed are:

1) Install MySQL Server 4.1 (windows installation ~30 mbs) under "c:\mysql\"
2) Installed MySQL++ 1.7.32 under "c:\mysql++-1.7.32\"
3) Created a user with "all privileges" on mysql samples databases
4) Compiled without any problem all samples
5) Runned without problems the reset_db sample

But,

I get a crash with every sample when trying to get the result after a query.
On the sample side, it crashes on "mysqlpp::Result res = query.store();"

Here is the call stack after crash :

> msvcr71d.dll!strlen() Line 78 Asm
msvcp71d.dll!std::char_traits<char>::length(const char * _First=0x00000000) 
Line 442 + 0x9 C++
msvcp71d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>

>::assign(const char * _Ptr=0x00000000) Line 622 + 0x9 C++
msvcp71d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>

>::operator=(const char * _Ptr=0x00000000) Line 473 C++
simple1.exe!mysqlpp::ResUse::ResUse(st_mysql_res * result=0x00451380, 
mysqlpp::Connection * m=0x00000000, bool te=false) Line 32 + 0x1c C++
simple1.exe!mysqlpp::Result::Result(st_mysql_res * result=0x00451380, bool 
te=false) Line 156 + 0x38 C++
simple1.exe!mysqlpp::Connection::store(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> >
& 
str={...}, bool throw_excptns=true) Line 237 + 0xe C++
simple1.exe!mysqlpp::Connection::store(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> >
& 
str={...}) Line 140 + 0x16 C++
simple1.exe!mysqlpp::Query::store(mysqlpp::SQLQueryParms & p={...}) Line 57 
+ 0x49 C++
simple1.exe!mysqlpp::Query::store() Line 90 + 0x33 C++
simple1.exe!print_stock_table(mysqlpp::Query & query={...}) Line 25 + 0xc 
C++
simple1.exe!main(int argc=4, char * * argv=0x003566b8) Line 24 + 0xc C++
simple1.exe!mainCRTStartup() Line 398 + 0x11 C
kernel32.dll!7c816d4f() 
ntdll.dll!7c925b4f() 
kernel32.dll!7c8399f3() 

Looks like the problem begins with "operator=" with parameter NULL as char*, 
it then tries to do a strlen on that NULL pointer and crashes.

The line calling this is under MySQL++ "result.cpp" file :"_table = 
fields(0).table;"
I think this is the "operator=" called.

I'll keep looking into this but maybe some mysql++ developer can help me ;)

Thanks a lot,

"SanctusAnimus"
Who hates debugging "stl" stuff :)

Thread
Access Violation on store() under windowsJean-François Pérusse9 Apr