dbTalk Databases Forums  

Destroying Query object causes unhandled exception

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


Discuss Destroying Query object causes unhandled exception in the mailing.database.mysql-plusplus forum.



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

Default Destroying Query object causes unhandled exception - 10-14-2005 , 10:21 AM






Hello all,

right to the point. I have the following code in my application:

try
{
mysqlpp::Connection sqlCon( db, host, user, passwd );

mysqlpp::Query query = sqlCon.query( );
}
catch ( const mysqlpp::BadQuery &e )
{
cerr << e.what( ) << endl;
return;
}
catch ( const mysqlpp::Exception &e )
{
cerr << e.what( ) << endl;
return;
}

With this code it is possible to use the connection and the query object to manipulate database.
But when the application is going out of the try block and tries to destroy Query
object it stops in "dbgheap.c" with unhandled exception or assert says:

Expression: _BLOCK_TYPE_IS_VALIDE(pHead->nBlockUse)

I have found this type of error on google but without any replyes. I've
been playing more with this code and tried to set up new project. In new
project it is without error.

Therefore I thought, I have problem with memory leaks. But it was
strange because the application runs without any error. So I've commented
everything before that try block but it haven't helped.

Does anybody have any idea what might be the problem? Thanks in advance!

--
Stromek

--
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
  #2  
Old   
Stromek
 
Posts: n/a

Default Re: Destroying Query object causes unhandled exception - 10-14-2005 , 11:02 AM






On Fri, Oct 14, 2005 at 05:20:06PM +0200, Stromek wrote:
Quote:
Hello all,

right to the point. I have the following code in my application:

try
{
mysqlpp::Connection sqlCon( db, host, user, passwd );

mysqlpp::Query query = sqlCon.query( );
}
catch ( const mysqlpp::BadQuery &e )
{
cerr << e.what( ) << endl;
return;
}
catch ( const mysqlpp::Exception &e )
{
cerr << e.what( ) << endl;
return;
}

With this code it is possible to use the connection and the query object to manipulate database.
But when the application is going out of the try block and tries to destroy Query
object it stops in "dbgheap.c" with unhandled exception or assert says:

Expression: _BLOCK_TYPE_IS_VALIDE(pHead->nBlockUse)

I have found this type of error on google but without any replyes. I've
been playing more with this code and tried to set up new project. In new
project it is without error.

Therefore I thought, I have problem with memory leaks. But it was
strange because the application runs without any error. So I've commented
everything before that try block but it haven't helped.

Does anybody have any idea what might be the problem? Thanks in advance!
Well, maybe I'm lucky man :-) but I have found one solution. Examples
from MySQL++ also worked so I bet it must be error of the stupid
microsoft VC++. I played with project settings of the example containing
only code above. I've created application but Runtime Library settings
in Code Generation part were set to Multi-threaded Debug DLL. I set it
to Multi-threaded DLL and the same error from my application appeared.
So I have changed my application settings and it surprisingly works.

So my solution is, use /MDd (Multi-threaded Debug DLL) switch with
VC7.1 and have a nice day, lol.

--
Stromek

--
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
  #3  
Old   
Paul Martin
 
Posts: n/a

Default Re: Re: Destroying Query object causes unhandled exception - 04-07-2006 , 05:33 PM



I am having the same problem as below... I can use my
app in Debug mode no problem, but when I build Release
I get the error below.

His solution didn't work for me... plus that is just a
workaround in my opinion. I think possibly there is a
problem in the MySql++ code? I was using 1.7 with
MySql 4.1.x before and didn't see this error, its only
with 2.1 and MySql 5.0.x that it's reared its ugly
head.

Any ideas would be most welcome... for now I guess I
can release the debug version only.

Paul


On Fri, Oct 14, 2005 at 05:20:06PM +0200, Stromek
wrote:
Quote:
Hello all,

right to the point. I have the following code in my
application:

try
{
mysqlpp::Connection sqlCon( db, host, user, passwd
);

mysqlpp::Query query = sqlCon.query( );
}
catch ( const mysqlpp::BadQuery &e )
{
cerr << e.what( ) << endl;
return;
}
catch ( const mysqlpp::Exception &e )
{
cerr << e.what( ) << endl;
return;
}

With this code it is possible to use the connection
and the query object to
manipulate database.
But when the application is going out of the try
block and tries to destroy Query
object it stops in "dbgheap.c" with unhandled
exception or assert says:

Expression: _BLOCK_TYPE_IS_VALIDE(pHead->nBlockUse)

I have found this type of error on google but
without any replyes. I've
been playing more with this code and tried to set up
new project. In new
project it is without error.

Therefore I thought, I have problem with memory
leaks. But it was
strange because the application runs without any
error. So I've commented
everything before that try block but it haven't
helped.

Does anybody have any idea what might be the
problem? Thanks in advance!

Well, maybe I'm lucky man :-) but I have found one
solution. Examples
from MySQL++ also worked so I bet it must be error of
the stupid
microsoft VC++. I played with project settings of the
example containing
only code above. I've created application but Runtime
Library settings
in Code Generation part were set to Multi-threaded
Debug DLL. I set it
to Multi-threaded DLL and the same error from my
application appeared.
So I have changed my application settings and it
surprisingly works.

So my solution is, use /MDd (Multi-threaded Debug DLL)
switch with
VC7.1 and have a nice day, lol.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
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.