diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-01-05 13:26:36 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-01-10 04:32:49 +0100 |
commit | b1e5d9275d4cf6152e4e9456b1bc2d585a5512e2 (patch) | |
tree | 4c1847e658851bad098891ca0776285ee8d02630 /tests/auto/sql | |
parent | c53955eaa085b14ef8e5348e951f8cd2cbfa4ea5 (diff) |
SQL: rename enablePositionalBinding() to setPositionalBindingEnabled()
... and the getter to isPositionalBindingEnabled() for QSqlQuery and
QSqlResult.
This amends e532933a2a9ff0219f0179880e05c95e0ec5e19d
[ChangeLog][QtSql][QSqlQuery] Add setPositionalBindingEnabled() to be
able to disable positional binding.
Pick-to: 6.7
Task-number: QTBUG-119952
Fixes: QTBUG-120548
Change-Id: I0a0afb652d0fc9421f5692b0927a66b2a9b7b854
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/sql')
-rw-r--r-- | tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 70b71d6654..53f2ea4801 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -5067,7 +5067,8 @@ void tst_QSqlQuery::positionalBindingEnabled() QVERIFY_SQL(qry, exec("CREATE TABLE " + tableName + " (integer_col integer)")); QVERIFY_SQL(qry, exec("INSERT INTO " + tableName + "(integer_col) VALUES(42)")); - qry.enablePositionalBinding(true); + qry.setPositionalBindingEnabled(true); + QCOMPARE(qry.isPositionalBindingEnabled(), true); QVERIFY_SQL(qry, prepare("SELECT integer_col FROM " + tableName + " WHERE integer_col = :integer_val")); qry.bindValue(":integer_val", 42); QVERIFY_SQL(qry, exec()); @@ -5079,7 +5080,8 @@ void tst_QSqlQuery::positionalBindingEnabled() QVERIFY_SQL(qry, next()); QCOMPARE(qry.value(0).toInt(), 42); - qry.enablePositionalBinding(false); + qry.setPositionalBindingEnabled(false); + QCOMPARE(qry.isPositionalBindingEnabled(), false); QVERIFY_SQL(qry, prepare("SELECT integer_col FROM " + tableName + " WHERE integer_col = :integer_val")); qry.bindValue(":integer_val", 42); QVERIFY_SQL(qry, exec()); @@ -5109,7 +5111,7 @@ void tst_QSqlQuery::psqlJsonOperator() const QString &tableName = ts.tableName(); QSqlQuery qry(db); - qry.enablePositionalBinding(false); // don't allow / handle '?' as placeholder + qry.setPositionalBindingEnabled(false); // don't allow / handle '?' as placeholder QVERIFY_SQL(qry, exec("CREATE TABLE " + tableName + " (integer_col integer, json_col jsonb)")); QVERIFY_SQL(qry, exec("INSERT INTO " + tableName + "(integer_col, json_col) VALUES(42, '{\"a\": [1, 2]}')")); QVERIFY_SQL(qry, exec("INSERT INTO " + tableName + "(integer_col, json_col) VALUES(43, '{\"b\": [3, 4]}')")); |