4 messages in com.mysql.lists.plusplusRe: query.str() not returning anything
FromSent OnAttachments
Kemin Zhou10 Jan 2008 20:25 
Warren Young10 Jan 2008 21:01 
Kemin Zhou11 Jan 2008 09:34 
Warren Young11 Jan 2008 17:00 
Subject:Re: query.str() not returning anything
From:Kemin Zhou (kzh@lbl.gov)
Date:01/11/2008 09:34:38 AM
List:com.mysql.lists.plusplus

Warren Young wrote:

Kemin Zhou wrote:

Has anyone seen this problem?

Query query=connection.query(); query << "some sql string"; try { query.execute(); } catch (exception &err) {

cerr << query.str() << endl << err.what() << endl;

Are you using a v3.0 beta, or the current svn version? If so, you're running afoul of the new auto-reset logic. In MySQL++ v2, it was necessary to call Query.reset() much more often. v3 detects many cases where it can do it for you. It was a little over-aggressive, though, resetting the query object even when the query execution didn't succeed, making it hard to print info to help you debug the problem.

I've changed it so the current svn version now only resets when the query succeeds.

By the way, v3 now supports this syntax for showing the contents of the query string, when you aren't using template queries:

cerr << query << endl;

Actually I am using the version 2 /usr/lib/libmysqlpp.so.2.0.7

Kemin