Tests/QSqlQuery: fix tst_QSqlQuery::lastInsertId() for PostgreSQL
Fix tst_QSqlQuery::lastInsertId() for PostgreSQL - there must be no other query inbetween insert and lastval() to acutally receive the correct last inserted id. Pick-to: 6.8 Change-Id: I6c5bda4b1e54ec89b80caa6abf7afcc9cfe1e28b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
1b393cafd2
commit
4b9631359b
@ -2794,11 +2794,12 @@ void tst_QSqlQuery::lastInsertId()
|
||||
.arg(ts.tableName())));
|
||||
QVERIFY_SQL(q, exec(QLatin1String("insert into %1 (t_varchar, t_char) values "
|
||||
"('VarChar41', 'Char41')").arg(ts.tableName())));
|
||||
QVERIFY(q.lastInsertId().isValid());
|
||||
} else {
|
||||
QVERIFY_SQL(q, exec(QLatin1String("insert into %1 (id, t_varchar, t_char) values (41, 'VarChar41', 'Char41')")
|
||||
.arg(qtest)));
|
||||
QVERIFY(q.lastInsertId().isValid());
|
||||
}
|
||||
QVERIFY(q.lastInsertId().isValid());
|
||||
}
|
||||
|
||||
void tst_QSqlQuery::lastQuery()
|
||||
|
Loading…
x
Reference in New Issue
Block a user