summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-22 15:38:21 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-25 10:14:15 +0200
commit88cfcd7f3fdbcc09e2270b687b60cda70fc6b33a (patch)
tree1042f1255e7b0c48c9f427e28302a24d32d116df /tests/auto/sql
parentfe5b04346c08eea42b5acd502cb01d2e6a4062d1 (diff)
Use QList instead of QVector in sql tests
Task-number: QTBUG-84469 Change-Id: Id429ce85da027541b53d516045a78b739c2e9745 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/sql')
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp21
-rw-r--r--tests/auto/sql/kernel/qsqlresult/testsqldriver.h5
2 files changed, 11 insertions, 15 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 67d160d6af..dae44c8ec0 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -2168,7 +2168,7 @@ void tst_QSqlQuery::prepare_bind_exec()
/*** Below we test QSqlQuery::boundValues() with position arguments.
* Due to the fact that the name of a positional argument is not
- * specified by the Qt docs, we test that the QVector contains
+ * specified by the Qt docs, we test that the QList contains
* the correct values in the same order as QSqlResult::boundValueName
* returns since it should be in insertion order (i.e. field order). ***/
QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (?, ?)" ) );
@@ -4054,7 +4054,7 @@ void tst_QSqlQuery::QTBUG_36211()
void tst_QSqlQuery::QTBUG_53969()
{
QFETCH( QString, dbName );
- QVector<int> values = QVector<int>() << 10 << 20 << 127 << 128 << 1, tableValues;
+ QList<int> values = QList<int>() << 10 << 20 << 127 << 128 << 1, tableValues;
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
tableValues.reserve(values.size());
@@ -4069,7 +4069,7 @@ void tst_QSqlQuery::QTBUG_53969()
QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (test_number) VALUES (:value)"));
- QVector<int>::iterator begin = values.begin(), end = values.end(), it;
+ QList<int>::iterator begin = values.begin(), end = values.end(), it;
for (it = begin; it != end; ++it) {
q.bindValue(":value", *it);
QVERIFY_SQL(q, exec());
@@ -4416,11 +4416,10 @@ void tst_QSqlQuery::aggregateFunctionTypes()
}
template<typename T>
-void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName,
- const QString &type, bool withPreparedStatement,
- const QVector<T> &values)
+void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const QString &type,
+ bool withPreparedStatement, const QList<T> &values)
{
- QVector<QVariant> variantValues;
+ QList<QVariant> variantValues;
variantValues.reserve(values.size());
QSqlQuery q(db);
@@ -4448,8 +4447,8 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName,
} else {
QVERIFY_SQL(q, exec("SELECT id FROM " + tableName));
}
- QVector<T> actualValues;
- QVector<QVariant> actualVariantValues;
+ QList<T> actualValues;
+ QList<QVariant> actualVariantValues;
actualValues.reserve(values.size());
while (q.next()) {
QVariant value = q.value(0);
@@ -4472,7 +4471,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName,
// insert some values
const int steps = 20;
const T increment = (max / steps - min / steps);
- QVector<T> values;
+ QList<T> values;
values.reserve(steps);
T v = min;
for (int i = 0; i < steps; ++i, v += increment)
@@ -4486,7 +4485,7 @@ void tst_QSqlQuery::integralTypesMysql()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- const QVector<bool> boolValues = QVector<bool>() << false << true;
+ const QList<bool> boolValues = QList<bool>() << false << true;
for (int i = 0; i < 2; ++i) {
const bool withPreparedStatement = (i == 1);
runIntegralTypesMysqlTest<bool>(db, "tinyInt1Test", "TINYINT(1)", withPreparedStatement, boolValues);
diff --git a/tests/auto/sql/kernel/qsqlresult/testsqldriver.h b/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
index 9de76bc198..b4fb65bf7d 100644
--- a/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
+++ b/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
@@ -46,10 +46,7 @@ public:
return QSqlResult::savePrepare(sqlquery);
}
- QVector<QVariant> boundValues() const
- {
- return QSqlResult::boundValues();
- }
+ QList<QVariant> boundValues() const { return QSqlResult::boundValues(); }
protected:
QVariant data(int /* index */) { return QVariant(); }