List:MySQL++« Previous MessageNext Message »
From:Joseph Hesse Date:August 5 2013 10:51pm
Subject:Problem with a query
View as plain text  
Is the following code OK?  Assume "conn" is valid.  Queries Q1 and Q2 
are MySQL queries written as C++ strings and do not return anything.

   Query query = conn.query(Q1);
   query.exec();
   query.reset();
   query = conn.query(Q2);  // query.str() is empty after this statement
   query.exec();

The reason I asked is I had a problem with this code, the exec failed 
the second time.
I diagnosed the problem by printing query.str() after both conn.query.
The second time query.str() was empty.

The problem went away if I did:

   Query query = conn.query(Q1);
   query.exec();
   query.reset();
   Query query1 = conn.query(Q2);
   query1.exec();

Thank you,
Joe Hesse
Thread
Problem with a queryJoseph Hesse5 Aug
  • Re: Problem with a queryWarren Young6 Aug
    • Re: Problem with a queryJoseph Hesse6 Aug
      • Re: Problem with a queryWarren Young6 Aug