From: Joseph Hesse
Date: August 5 2013 10:51pm
Subject: Problem with a query
List-Archive: http://lists.mysql.com/plusplus/9601
Message-Id: <52002C6F.1080307@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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