From 88cfcd7f3fdbcc09e2270b687b60cda70fc6b33a Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 22 Jun 2020 15:38:21 +0200 Subject: [PATCH] Use QList instead of QVector in sql tests Task-number: QTBUG-84469 Change-Id: Id429ce85da027541b53d516045a78b739c2e9745 Reviewed-by: Lars Knoll --- .../sql/kernel/qsqlquery/tst_qsqlquery.cpp | 21 +++++++++---------- .../sql/kernel/qsqlresult/testsqldriver.h | 5 +---- 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 values = QVector() << 10 << 20 << 127 << 128 << 1, tableValues; + QList values = QList() << 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::iterator begin = values.begin(), end = values.end(), it; + QList::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 -void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, - const QString &type, bool withPreparedStatement, - const QVector &values) +void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const QString &type, + bool withPreparedStatement, const QList &values) { - QVector variantValues; + QList 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 actualValues; - QVector actualVariantValues; + QList actualValues; + QList 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 values; + QList 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 boolValues = QVector() << false << true; + const QList boolValues = QList() << false << true; for (int i = 0; i < 2; ++i) { const bool withPreparedStatement = (i == 1); runIntegralTypesMysqlTest(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 boundValues() const - { - return QSqlResult::boundValues(); - } + QList boundValues() const { return QSqlResult::boundValues(); } protected: QVariant data(int /* index */) { return QVariant(); }