summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig.qnx@kdab.com>2013-12-02 14:01:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 10:36:34 +0100
commit1f6e461533f531a25bdb9cf60c1cafc125aa06ba (patch)
tree0eadc41efa9464e09061919043ce9a0d7cb34ef3 /tests
parent943fc7d782207b0dc35057ee934169bd8cb2a322 (diff)
Fix positional binding values order in QSqlQuery
Adapt the stringification code, that is used to produce the keys for QSqlQuery::boundValues() return value, to keep the right order of the binding values. Task-number: QTBUG-12186 Change-Id: Ic11a455bfd9ffd1418b1b021ce5cf78cae9b4504 [ChangeLog][QtSql] Fixed the order of values with positional binding in a QSqlQuery Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 38f561dbaa..5f1eb99524 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -211,6 +211,8 @@ private slots:
void QTBUG_6852();
void QTBUG_5765_data() { generic_data("QMYSQL"); }
void QTBUG_5765();
+ void QTBUG_12186_data() { generic_data("QSQLITE"); }
+ void QTBUG_12186();
void QTBUG_14132_data() { generic_data("QOCI"); }
void QTBUG_14132();
void QTBUG_18435_data() { generic_data("QODBC"); }
@@ -3054,6 +3056,27 @@ void tst_QSqlQuery::QTBUG_551()
QCOMPARE(res_outLst[2].toString(), QLatin1String("3. Value is 2"));
}
+void tst_QSqlQuery::QTBUG_12186()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+
+ // make sure that query.boundValues() returns the values in the right order even for more than 16 placeholders
+ QSqlQuery query(db);
+ query.prepare("INSERT INTO person (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13, col14, col15, col16, col17, col18) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+
+ QList<QVariant> values;
+
+ for (int i = 0; i < 18; ++i)
+ values << i;
+
+ foreach (QVariant v, values)
+ query.bindValue(v.toInt(), v);
+
+ QCOMPARE(query.boundValues().values(), values);
+}
+
void tst_QSqlQuery::QTBUG_14132()
{
QFETCH( QString, dbName );