Here is the code:
QSqlQuery q1(db_connection), q2(db_connection);
q1.exec("SELECT * from users");
while(q1.next())
{
q2.exec("delete from table1");
if (!q2.isValid())
qDebug() << "q2 is not valid";
if (q1.isActive() && q1.isValid())
qDebug() << q1.record();
}
q1 is the correct query. q2 is KNOWINGLY wrong one, cuz there is no table with name "table1".
The deal is: why q1 returns wrong (empty) data with QSqlQuery::record() method, but absolutely right data with QSqlQuery::value() method after q2 is beeing exec()'d?