dbTalk Databases Forums  

Still having pointer problems with mysqlpp examples.

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Still having pointer problems with mysqlpp examples. in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gary Anderson
 
Posts: n/a

Default Still having pointer problems with mysqlpp examples. - 08-21-2006 , 04:31 PM






--------------020009020401070705020505
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I am running VS 2005 on Windows XP. So far, I have tried Sample1,
resetdb, and dbinfo. All 3 build correctly, but all 3 are having errors
when cleaning up from query calls. The general problem seems to be
pointers to 0. I haven't been able to track them down further yet.

dbinfo gives this error: Unhandled exception at 0x104f1795
(msvcp80d.dll) in dbinfo.exe: 0xC0000005: Access violation reading
location 0x74616420. The code breaks in the string module trying to
insert a string. The dbinfo.cpp module was trying to execute the
statement: query << "show databases";

resetdb gives the error: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory location
0x0012ebb8.. It is trying to allocate a new string in the call:
con.create_db(kpcSampleDatabase)

Is there a setting I need to change somewhere? Please help!


--------------020009020401070705020505
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------020009020401070705020505--

Reply With Quote
  #2  
Old   
Carlos Flores
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-21-2006 , 05:24 PM






------=_Part_82416_18109753.1156198873721
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I suggest you to try out with this binaries i had built for msvc 2005 and
mingw

The link is http://www.cahda.org/files/MySQL++_2.1.1.zip

I hope it works for you, it includes both debug and release binaries with
different names

2006/8/21, Gary Anderson <ganderson (AT) bslw (DOT) com>:
Quote:
I am running VS 2005 on Windows XP. So far, I have tried Sample1,
resetdb, and dbinfo. All 3 build correctly, but all 3 are having errors
when cleaning up from query calls. The general problem seems to be
pointers to 0. I haven't been able to track them down further yet.

dbinfo gives this error: Unhandled exception at 0x104f1795
(msvcp80d.dll) in dbinfo.exe: 0xC0000005: Access violation reading
location 0x74616420. The code breaks in the string module trying to
insert a string. The dbinfo.cpp module was trying to execute the
statement: query << "show databases";

resetdb gives the error: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory location
0x0012ebb8.. It is trying to allocate a new string in the call:
con.create_db(kpcSampleDatabase)

Is there a setting I need to change somewhere? Please help!



--
Carlos Flores

------=_Part_82416_18109753.1156198873721--


Reply With Quote
  #3  
Old   
Gary Anderson
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-21-2006 , 06:26 PM



--------------090006050701050402070002
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Carlos,
I tried your libraries, but I am now getting link errors as follows:
error LNK2019: unresolved external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
mysqlpp:perator<<(class std::basic_ostream<char,struct
std::char_traits<char> > &,struct mysqlpp:ate const &)"
(__imp_??6mysqlpp@@YAAAV?$basic_ostream@DU?$char_t raits@D@std@@@std@@AAV12@ABUDate@0@@Z)
referenced in function "void __cdecl print_stock_row(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &,__int64,double,double,struct
mysqlpp:ate const &)"
(?print_stock_row@@YAXABV?$basic_string@DU?$char_t raits@D@std@@V?$allocator@D@2@@std@@_JNNABUDate@my sqlpp@@@Z)

error LNK2019: unresolved external symbol "__declspec(dllimport) class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
mysqlpp:perator<<(class std::basic_ostream<char,struct
std::char_traits<char> > &,class mysqlpp::ColData_Tmpl<class
mysqlpp::const_string> const &)"
(__imp_??6mysqlpp@@YAAAV?$basic_ostream@DU?$char_t raits@D@std@@@std@@AAV12@ABV?$ColData_Tmpl@Vconst_ string@mysqlpp@@@0@@Z)
referenced in function "public: __int64 __thiscall
mysqlpp::ColData_Tmpl<class
mysqlpp::const_string>::conv<__int64>(__int64)cons t "
(??$conv@_J@?$ColData_Tmpl@Vconst_string@mysqlpp@@ @mysqlpp@@QBE_J_J@Z)

Suggestions?
Thanks, Gary

Carlos Flores wrote:

Quote:
I suggest you to try out with this binaries i had built for msvc 2005 and
mingw

The link is http://www.cahda.org/files/MySQL++_2.1.1.zip

I hope it works for you, it includes both debug and release binaries with
different names

2006/8/21, Gary Anderson <ganderson (AT) bslw (DOT) com>:


I am running VS 2005 on Windows XP. So far, I have tried Sample1,
resetdb, and dbinfo. All 3 build correctly, but all 3 are having errors
when cleaning up from query calls. The general problem seems to be
pointers to 0. I haven't been able to track them down further yet.

dbinfo gives this error: Unhandled exception at 0x104f1795
(msvcp80d.dll) in dbinfo.exe: 0xC0000005: Access violation reading
location 0x74616420. The code breaks in the string module trying to
insert a string. The dbinfo.cpp module was trying to execute the
statement: query << "show databases";

resetdb gives the error: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory location
0x0012ebb8.. It is trying to allocate a new string in the call:
con.create_db(kpcSampleDatabase)

Is there a setting I need to change somewhere? Please help!






--------------090006050701050402070002
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------090006050701050402070002--


Reply With Quote
  #4  
Old   
Carlos Flores
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-22-2006 , 03:34 PM



------=_Part_107510_9773329.1156278704802
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Yea, it seems to be a problem with my library building i will correct it as
soon as i get to my house,

However as Warren pointed, your original problem may be linkage to wrong crt
like debug or release
--
Carlos Flores

------=_Part_107510_9773329.1156278704802--

Reply With Quote
  #5  
Old   
Gary Anderson
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-22-2006 , 04:21 PM



--------------020103070307020506050105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I used the project files for resetdb and dbinfo contained in the example
folder as the base for VS2005 to work from. Of course, VS2005 had to
update everything to meet its new standard. I built the projects
individually, and didn't use the overall examples.dsw file. I went
through the configuration as specified in the readme.vs file and all of
the library and include file pointers are set to the correct places.
I'm also having a problem with null string pointers in dbinfo.

Warren Young wrote:

Quote:
Gary Anderson wrote:


resetdb gives the error: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory
location 0x0012ebb8.. It is trying to allocate a new string in the
call: con.create_db(kpcSampleDatabase)


Are you still trying to build the examples using a different project
than the example.dsw that comes with MySQL++? If so, try with the
project we ship. If it works, then there is some difference in the
build settings. Visual C++ is very particular that certain settings
match exactly between the library and the executable linking to the
library.



--------------020103070307020506050105
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------020103070307020506050105--


Reply With Quote
  #6  
Old   
Gary Anderson
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-22-2006 , 05:00 PM



--------------090802020400000402000707
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I re-built all the libraries using example.dsw. All seemed to build
fine. I tried to run dbinfo and got this error:
Unhandled exception at 0x104f1795 (msvcp80d.dll) in dbinfo.exe:
0xC0000005: Access violation reading location 0x74616420. The code
broke in the string library.

Resetdb still errors also: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory location
0x0012ebc0.. This one broke in the new function of new.cpp.
Gary

Warren Young wrote:

Quote:
Gary Anderson wrote:


resetdb gives the error: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory
location 0x0012ebb8.. It is trying to allocate a new string in the
call: con.create_db(kpcSampleDatabase)


Are you still trying to build the examples using a different project
than the example.dsw that comes with MySQL++? If so, try with the
project we ship. If it works, then there is some difference in the
build settings. Visual C++ is very particular that certain settings
match exactly between the library and the executable linking to the
library.



--------------090802020400000402000707
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------090802020400000402000707--


Reply With Quote
  #7  
Old   
Warren Young
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-23-2006 , 10:09 PM



Gary Anderson wrote:
Quote:
Of course, VS2005 had to
update everything to meet its new standard.
Since that conversion process works flawlessly, as far as we can tell,
there's been no pressure to try and ship VS2003 or 2005 project files.
The only reason I'd really want to change this is because shipping with
VC++ 6.0 project files implies that MySQL++ works with VC++6, which
isn't the case. It's not a big enough problem to push it up my priority
list, though.

Quote:
I built the projects
individually, and didn't use the overall examples.dsw file.
Yes, it's the .dsp file that really matters.

Quote:
I'm also having a problem with null string pointers in dbinfo.
Please bring that up in a new thread.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #8  
Old   
Warren Young
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-23-2006 , 10:11 PM



Gary Anderson wrote:
Quote:
Unhandled exception at 0x104f1795 (msvcp80d.dll) in dbinfo.exe:
0xC0000005: Access violation reading location 0x74616420. The code
broke in the string library.
What exception was thrown?

Quote:
Resetdb still errors also: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory location
0x0012ebc0.. This one broke in the new function of new.cpp.
Someone reported that this sort of thing would happen with the brandest
newest MySQL. Try rolling back to 5.0.22.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #9  
Old   
Gary Anderson
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-24-2006 , 11:53 AM



--------------040207090603090803000603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I'm running 5.0.21, so the 5.0.24 problem shouldn't be affecting me. As
for your question about what exception was thrown, how do I find that
out? I tried debugging dbinfo.cpp. It errored trying to execute the
statement cout << "Query: " << query.preview() << endl; The text in the
original message was what VS provided in the error window.

As far as the string code goes, the function is shown below.

if (_State == ios_base::goodbit)
for (_Mysizt _Count = 0; _Count < _Size; ++_Count)
if (_Traits::eq_int_type(_Traits::eof(),
_Ostr.rdbuf()->sputc(_Str[_Count]))) <----- The
instruction pointer in the debug window indicated this line when the
error occurred.
{ // insertion failed, quit
_State |= ios_base::badbit;
break;
}

At the time of the break in execution, _Count was 0, _Size was
0x0000000f, the pointer to _Str was bad.
This bad string pointer appears to be the basis of most of the problems
I am seeing.

Further investigation indicates that the problem is happening when I try
to set up the first actual query. I am assuming that the original query
string is held in the sbuffer_ attribute of the query object. After the
statement:
Query query = con.query(); is executed, this attribute holds a bad
pointer.

I also noticed that the connection information in the conn_attribute
seems to be invalid.

I tried stepping into the function query << "show databases"; I noticed
that it is using ostream calls, not string calls as I would expect.
This function finished with the "show databases" string being pointed to
by _Gfirst, _Pfirst, and _Gnext in the _Mystrbuf structure. The
sbuffer_ attribute (which I would expect to point to the query) still
held a bad pointer.
Is it possible that the query.preview member function is looking in the
wrong place for the string?
Thanks
Gary


Warren Young wrote:

Quote:
Gary Anderson wrote:

Unhandled exception at 0x104f1795 (msvcp80d.dll) in dbinfo.exe:
0xC0000005: Access violation reading location 0x74616420. The code
broke in the string library.


What exception was thrown?

Resetdb still errors also: Unhandled exception at 0x7c81eb33 in
resetdb.exe: Microsoft C++ exception: std::bad_alloc at memory
location 0x0012ebc0.. This one broke in the new function of new.cpp.


Someone reported that this sort of thing would happen with the
brandest newest MySQL. Try rolling back to 5.0.22.



--------------040207090603090803000603
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------040207090603090803000603--


Reply With Quote
  #10  
Old   
Warren Young
 
Posts: n/a

Default Re: Still having pointer problems with mysqlpp examples. - 08-24-2006 , 04:35 PM



Gary Anderson wrote:
Quote:
I'm running 5.0.21, so the 5.0.24 problem shouldn't be affecting me.
That's all right, I was probably confused with another issue anyway.

Quote:
As
for your question about what exception was thrown, how do I find that
out?
I would think the debugger would tell you. If not, add this to the set
of catch statements:

catch (std::exception& e) {
cerr << "Weird exception: " << typeid(e).name() << endl;
}
catch (...) {
cerr << "A very very weird exception!" << endl;
}

(Something like that. Coding off the top of my head here...may not be
totally correct.)


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.