QSqlQuery qry;qry.prepare("insert into table1 (f1, f2, f3) values(?,?,?);qry.bindValue(0, 1);...etcqry.exec();
#define CHECK_QUERY(qry) { \ if ((qry).lastError().number()!=QSqlError::NoError) \ qWarning("%s:%d %s", __FILE__, __LINE__, (qry).lastError().text().toLocal8Bit().constData()); \ }qry.prepare("insert into table1 (f1, f2, f3) values(?,?,?);CHECK_QUERY(qry);qry.bindValue(0,1);CHECK_QUERY(qry);qry.exec();CHECK_QUERY(qry);