A
andref
Hello!
I use Visual C++ 2005 Express Edition and mysql++2.1.1.
Everythink works fine when I'm useing object mysqlpp::Connection(...)
only.
mysqlpp::Connection baza("information_schema",
"localhost","root","pass",0);
It even realy connects to MySQL.
But when I create mysqlpp::Query objeckt like that:
mysqlpp::Query and=baza.query();
The progrogram compiles, links, but when I run the program it crushes
when object is deleteing from memory - destructor works. i.e:
// -1
{
mysqlpp::Query and=baza.query();
.
.
/*here: destructor is colled automatically. - and somewhere here my
program crushes.*/
}
The only way to omit destruction is:
// -2
{
//dinamic allocation:
mysqlpp::Query *and = new mysqlpp::Query(baza.query());
.
.
/*here is NO destructor colled. so it works ok and goes ahead.
When I uncoment the following line, program will crush again:
delete and;*/
}
The problem seems to be with destruction of the object.
I know that not useing delete will cause a memory leak.
Here is the compilation report:
http://student.agh.edu.pl/~andref/Compilation/Compilation.txt
(as you see everything goes proper - however there were warnings)
Please, help. I cannot handle this problem.
Does anyone of U have the same problem, or only I do something wrong?
I use Visual C++ 2005 Express Edition and mysql++2.1.1.
Everythink works fine when I'm useing object mysqlpp::Connection(...)
only.
mysqlpp::Connection baza("information_schema",
"localhost","root","pass",0);
It even realy connects to MySQL.
But when I create mysqlpp::Query objeckt like that:
mysqlpp::Query and=baza.query();
The progrogram compiles, links, but when I run the program it crushes
when object is deleteing from memory - destructor works. i.e:
// -1
{
mysqlpp::Query and=baza.query();
.
.
/*here: destructor is colled automatically. - and somewhere here my
program crushes.*/
}
The only way to omit destruction is:
// -2
{
//dinamic allocation:
mysqlpp::Query *and = new mysqlpp::Query(baza.query());
.
.
/*here is NO destructor colled. so it works ok and goes ahead.
When I uncoment the following line, program will crush again:
delete and;*/
}
The problem seems to be with destruction of the object.
I know that not useing delete will cause a memory leak.
Here is the compilation report:
http://student.agh.edu.pl/~andref/Compilation/Compilation.txt
(as you see everything goes proper - however there were warnings)
Please, help. I cannot handle this problem.
Does anyone of U have the same problem, or only I do something wrong?