List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:January 11 2008 5:01am
Subject:Re: query.str() not returning anything
View as plain text  
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;
Thread
query.str() not returning anythingKemin Zhou11 Jan
  • Re: query.str() not returning anythingWarren Young11 Jan
    • Re: query.str() not returning anythingKemin Zhou11 Jan
      • Re: query.str() not returning anythingWarren Young12 Jan