Dovid Kopel wrote:
That isn't necessary. It's included indirectly by mysql++.h.
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.