QSqlQueryModel test: don't copy a QSqlQuery
Move the query into the model, and use a local scope to make sure that we don't use the moved-from query later. Pick-to: 6.9 Change-Id: I9d216e770733af8b0771280276dba0775209a802 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Dheerendra Purohit <dheerendra@pthinks.com>
This commit is contained in:
parent
d884abaf8b
commit
af760da541
@ -694,11 +694,13 @@ void tst_QSqlQueryModel::refreshQueryWithBoundValues()
|
||||
QSqlDatabase db = QSqlDatabase::database(dbName);
|
||||
QSqlQueryModel model;
|
||||
|
||||
{
|
||||
QSqlQuery query(db);
|
||||
query.prepare("SELECT name FROM " + qTableName("test", __FILE__, db) + " WHERE id = :id");
|
||||
query.bindValue(":id", 1);
|
||||
query.exec();
|
||||
model.setQuery(query);
|
||||
model.setQuery(std::move(query));
|
||||
}
|
||||
|
||||
QCOMPARE(model.rowCount(), 1);
|
||||
QCOMPARE(model.data(model.index(0, 0)).toString(), QString("harry"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user