diff options
author | Andy Shaw <andy.shaw@qt.io> | 2018-05-15 22:15:04 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-05-16 11:42:25 +0000 |
commit | b0f3cc1594308ed3f3977bdcd451e8cf0eb0478d (patch) | |
tree | 9a0a0b820aefbddb0ea28b6cb0bbe821834fad9d /tests | |
parent | 9c707f140e96937f2ea256a6a93dc827328f22ad (diff) |
sqlite: Allow for duplicated placeholders with just one placeholder
This accounts for a case of a placeholder being duplicated in the
prepare query, but where only one placeholder was used. This amends
e4e87a2ece1e0c9901514fea094f31863b64b570
Task-number: QTBUG-68299
Change-Id: Ia92ee912facd51a13e7222886debb219b24442b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 23c8460133..38da5431fa 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -2347,6 +2347,16 @@ void tst_QSqlQuery::prepare_bind_exec() QCOMPARE(q.value(0).toInt(), 107); QCOMPARE(q.value(1).toString(), QString("name")); QCOMPARE(q.value(2).toString(), QString("107")); + + // Test just duplicated placeholders + QVERIFY(q.prepare("insert into " + qtest_prepare + " (id, name, name2) values (110, :name, :name)")); + q.bindValue(":name", "name"); + QVERIFY_SQL(q, exec()); + QVERIFY(q.exec("select * from " + qtest_prepare + " where id > 109 order by id")); + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 110); + QCOMPARE(q.value(1).toString(), QString("name")); + QCOMPARE(q.value(2).toString(), QString("name")); } // end of SQLite scope } |