List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:November 15 2004 1:27pm
Subject:Re: Getting a segfaul
View as plain text  
Dovid Kopel wrote:

> #include "mysql.h"

That isn't necessary.  It's included indirectly by mysql++.h.

> using namespace std;

You might as well say 'using namespace mysqlpp' here as well.

>         mysqlpp::Query query = con.query();
>         query << "select * from cars";
>         cout << "Query: " << query.preview() << endl;
>         mysqlpp::Result res = query.store();

Try use() here instead of store(), and put the result in a ResUse object.

>     catch (mysqlpp::BadQuery er)

You can catch this one by const reference, which is more efficient, and 
may stop the crash.

> Query: select * from cars
> Error:
> Segmentation fault

Clearly a segfault is happening.  It would be nice if trying to dump the 
error didn't cause it, but you ought to check things like passwords, 
table names, etc.  I think you're not connecting to your database 
correctly, or using it correctly.
Thread
Getting a segfaulDovid Kopel15 Nov
  • Re: Getting a segfaulWarren Young15 Nov
    • Re: Getting a segfaulWarren Young15 Nov
Re: Getting a segfaulWarren Young17 Nov