summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-07-06 12:34:58 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-07-06 13:43:20 +0200
commit1e25b81e0d6c1da4643c9cc48680f5cc4399d068 (patch)
tree39f7a70e11b6b14382673167b6e183f70e3dc6c5 /src/plugins/sqldrivers
parent23b7e7972ea40afd2594d0570cbcf8192619cd56 (diff)
Use QList instead of QVector in plugins
Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers')
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp8
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp11
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp16
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp42
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp12
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp28
7 files changed, 59 insertions, 60 deletions
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index ddf54666e7..da5ff95179 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -40,13 +40,13 @@
#include "qsql_db2_p.h"
#include <qcoreapplication.h>
#include <qdatetime.h>
-#include <qsqlfield.h>
+#include <qlist.h>
#include <qsqlerror.h>
+#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qsqlrecord.h>
#include <qstringlist.h>
#include <qvarlengtharray.h>
-#include <qvector.h>
#include <QDebug>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
@@ -141,7 +141,7 @@ public:
SQLHANDLE hStmt;
QSqlRecord recInf;
- QVector<QVariant*> valueCache;
+ QList<QVariant*> valueCache;
};
static QString qFromTChar(SQLTCHAR* str)
@@ -692,7 +692,7 @@ bool QDB2Result::exec()
return false;
- QVector<QVariant> &values = boundValues();
+ QList<QVariant> &values = boundValues();
int i;
for (i = 0; i < values.count(); ++i) {
// bind parameters - only positional binding allowed
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index ba79cdad9b..eae72fff4f 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -41,20 +41,19 @@
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qdeadlinetimer.h>
-#include <qvariant.h>
+#include <qdebug.h>
+#include <qlist.h>
+#include <qmutex.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qsqlquery.h>
+#include <qvariant.h>
#include <QtSql/private/qsqlcachedresult_p.h>
#include <QtSql/private/qsqldriver_p.h>
-#include <qlist.h>
-#include <qvector.h>
-#include <qmutex.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
-#include <qdebug.h>
#include <QVarLengthArray>
QT_BEGIN_NAMESPACE
@@ -968,7 +967,7 @@ bool QIBaseResult::exec()
setAt(QSql::BeforeFirstRow);
if (d->inda) {
- QVector<QVariant>& values = boundValues();
+ QList<QVariant>& values = boundValues();
int i;
if (values.count() > d->inda->sqld) {
qWarning("QIBaseResult::exec: Parameter mismatch, expected %d, got %d parameters",
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 10c3e11bf2..2629233098 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -42,15 +42,15 @@
#include <qcoreapplication.h>
#include <qvariant.h>
#include <qdatetime.h>
+#include <qdebug.h>
+#include <qfile.h>
+#include <qlist.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <qsqlrecord.h>
#include <qstringlist.h>
-#include <qvector.h>
-#include <qfile.h>
-#include <qdebug.h>
#include <QtSql/private/qsqldriver_p.h>
#include <QtSql/private/qsqlresult_p.h>
@@ -178,7 +178,7 @@ public:
ulong bufLength = 0ul;
};
- QVector<QMyField> fields;
+ QList<QMyField> fields;
MYSQL_STMT *stmt = nullptr;
MYSQL_RES *meta = nullptr;
@@ -882,11 +882,11 @@ bool QMYSQLResult::exec()
int r = 0;
MYSQL_BIND* currBind;
- QVector<MYSQL_TIME *> timeVector;
- QVector<QByteArray> stringVector;
- QVector<my_bool> nullVector;
+ QList<MYSQL_TIME *> timeVector;
+ QList<QByteArray> stringVector;
+ QList<my_bool> nullVector;
- const QVector<QVariant> values = boundValues();
+ const QList<QVariant> values = boundValues();
r = mysql_stmt_reset(d->stmt);
if (r != 0) {
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index cf50942c69..48295f58e5 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -40,8 +40,9 @@
#include "qsql_oci_p.h"
#include <qcoreapplication.h>
-#include <qvariant.h>
#include <qdatetime.h>
+#include <qdebug.h>
+#include <qlist.h>
#include <qmetatype.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h>
@@ -54,10 +55,9 @@
#include <QtSql/private/qsqlcachedresult_p.h>
#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
-#include <qvarlengtharray.h>
-#include <qvector.h>
-#include <qdebug.h>
#include <qtimezone.h>
+#include <qvariant.h>
+#include <qvarlengtharray.h>
// This is needed for oracle oci when compiling with mingw-w64 headers
#if defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
@@ -283,9 +283,9 @@ public:
void setStatementAttributes();
int bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
const QVariant &val, dvoid *indPtr, ub2 *tmpSize, TempStorage &tmpStorage);
- int bindValues(QVector<QVariant> &values, IndicatorArray &indicators, SizeArray &tmpSizes,
+ int bindValues(QVariantList &values, IndicatorArray &indicators, SizeArray &tmpSizes,
TempStorage &tmpStorage);
- void outValues(QVector<QVariant> &values, IndicatorArray &indicators,
+ void outValues(QVariantList &values, IndicatorArray &indicators,
TempStorage &tmpStorage);
inline bool isOutValue(int i) const
{ Q_Q(const QOCIResult); return q->bindValueType(i) & QSql::Out; }
@@ -502,7 +502,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
return r;
}
-int QOCIResultPrivate::bindValues(QVector<QVariant> &values, IndicatorArray &indicators,
+int QOCIResultPrivate::bindValues(QVariantList &values, IndicatorArray &indicators,
SizeArray &tmpSizes, TempStorage &tmpStorage)
{
int r = OCI_SUCCESS;
@@ -551,7 +551,7 @@ static void qOraOutValue(QVariant &value, TempStorage &tmpStorage, OCIEnv *env,
}
}
-void QOCIResultPrivate::outValues(QVector<QVariant> &values, IndicatorArray &indicators,
+void QOCIResultPrivate::outValues(QVariantList &values, IndicatorArray &indicators,
TempStorage &tmpStorage)
{
for (int i = 0; i < values.count(); ++i) {
@@ -835,12 +835,12 @@ class QOCICols
public:
QOCICols(int size, QOCIResultPrivate* dp);
~QOCICols();
- int readPiecewise(QVector<QVariant> &values, int index = 0);
- int readLOBs(QVector<QVariant> &values, int index = 0);
+ int readPiecewise(QVariantList &values, int index = 0);
+ int readLOBs(QVariantList &values, int index = 0);
int fieldFromDefine(OCIDefine* d);
- void getValues(QVector<QVariant> &v, int index);
+ void getValues(QVariantList &v, int index);
inline int size() { return fieldInf.size(); }
- static bool execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, bool arrayBind);
+ static bool execBatch(QOCIResultPrivate *d, QVariantList &boundValues, bool arrayBind);
QSqlRecord rec;
@@ -865,7 +865,7 @@ private:
void *dataPtr;
};
- QVector<OraFieldInf> fieldInf;
+ QList<OraFieldInf> fieldInf;
const QOCIResultPrivate *const d;
};
@@ -1116,7 +1116,7 @@ OCILobLocator **QOCICols::createLobLocator(int position, OCIEnv* env)
return &lob;
}
-int QOCICols::readPiecewise(QVector<QVariant> &values, int index)
+int QOCICols::readPiecewise(QVariantList &values, int index)
{
OCIDefine* dfn;
ub4 typep;
@@ -1328,7 +1328,7 @@ struct QOCIBatchColumn
struct QOCIBatchCleanupHandler
{
- inline QOCIBatchCleanupHandler(QVector<QOCIBatchColumn> &columns)
+ inline QOCIBatchCleanupHandler(QList<QOCIBatchColumn> &columns)
: col(columns) {}
~QOCIBatchCleanupHandler()
@@ -1341,10 +1341,10 @@ struct QOCIBatchCleanupHandler
}
}
- QVector<QOCIBatchColumn> &col;
+ QList<QOCIBatchColumn> &col;
};
-bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, bool arrayBind)
+bool QOCICols::execBatch(QOCIResultPrivate *d, QVariantList &boundValues, bool arrayBind)
{
int columnCount = boundValues.count();
if (boundValues.isEmpty() || columnCount == 0)
@@ -1364,7 +1364,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
: tp);
}
SizeArray tmpSizes(columnCount);
- QVector<QOCIBatchColumn> columns(columnCount);
+ QList<QOCIBatchColumn> columns(columnCount);
QOCIBatchCleanupHandler cleaner(columns);
TempStorage tmpStorage;
@@ -1612,7 +1612,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
return false;
}
- // for out parameters we copy data back to value vector
+ // for out parameters we copy data back to value list
for (i = 0; i < columnCount; ++i) {
if (!d->isOutValue(i))
@@ -1739,7 +1739,7 @@ int qReadLob(T &buf, const QOCIResultPrivate *d, OCILobLocator *lob)
return r;
}
-int QOCICols::readLOBs(QVector<QVariant> &values, int index)
+int QOCICols::readLOBs(QVariantList &values, int index)
{
OCILobLocator *lob;
int r = OCI_SUCCESS;
@@ -1778,7 +1778,7 @@ int QOCICols::fieldFromDefine(OCIDefine* d)
return -1;
}
-void QOCICols::getValues(QVector<QVariant> &v, int index)
+void QOCICols::getValues(QVariantList &v, int index)
{
for (int i = 0; i < fieldInf.size(); ++i) {
const OraFieldInf &fld = fieldInf.at(i);
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index 4081cd1122..03c197053a 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -44,15 +44,15 @@
#include <qt_windows.h>
#endif
#include <qcoreapplication.h>
-#include <qvariant.h>
#include <qdatetime.h>
+#include <qlist.h>
+#include <qmath.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
#include <qstringlist.h>
+#include <qvariant.h>
#include <qvarlengtharray.h>
-#include <qvector.h>
-#include <qmath.h>
#include <QDebug>
#include <QSqlQuery>
#include <QtSql/private/qsqldriver_p.h>
@@ -206,7 +206,7 @@ public:
SQLHANDLE hStmt = nullptr;
QSqlRecord rInf;
- QVector<QVariant> fieldCache;
+ QVariantList fieldCache;
int fieldCacheIdx = 0;
int disconnectCount = 0;
bool hasSQLFetchScroll = true;
@@ -1399,8 +1399,8 @@ bool QODBCResult::exec()
if (isSelect())
SQLCloseCursor(d->hStmt);
- QVector<QVariant>& values = boundValues();
- QVector<QByteArray> tmpStorage(values.count(), QByteArray()); // holds temporary buffers
+ QVariantList &values = boundValues();
+ QByteArrayList tmpStorage(values.count(), QByteArray()); // holds temporary buffers
QVarLengthArray<SQLLEN, 32> indicators(values.count());
memset(indicators.data(), 0, indicators.size() * sizeof(SQLLEN));
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 3424400cc1..b477f701e2 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -848,7 +848,7 @@ void QPSQLResult::virtual_hook(int id, void *data)
QSqlResult::virtual_hook(id, data);
}
-static QString qCreateParamString(const QVector<QVariant> &boundValues, const QSqlDriver *driver)
+static QString qCreateParamString(const QList<QVariant> &boundValues, const QSqlDriver *driver)
{
if (boundValues.isEmpty())
return QString();
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index e900ccf5ec..f507e44d32 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -41,7 +41,8 @@
#include <qcoreapplication.h>
#include <qdatetime.h>
-#include <qvariant.h>
+#include <qdebug.h>
+#include <qlist.h>
#include <qsqlerror.h>
#include <qsqlfield.h>
#include <qsqlindex.h>
@@ -49,8 +50,7 @@
#include <QtSql/private/qsqlcachedresult_p.h>
#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
-#include <qvector.h>
-#include <qdebug.h>
+#include <qvariant.h>
#if QT_CONFIG(regularexpression)
#include <qcache.h>
#include <qregularexpression.h>
@@ -146,7 +146,7 @@ class QSQLiteDriverPrivate : public QSqlDriverPrivate
public:
inline QSQLiteDriverPrivate() : QSqlDriverPrivate(QSqlDriver::SQLite) {}
sqlite3 *access = nullptr;
- QVector<QSQLiteResult *> results;
+ QList<QSQLiteResult *> results;
QStringList notificationid;
};
@@ -166,7 +166,7 @@ public:
sqlite3_stmt *stmt = nullptr;
QSqlRecord rInf;
- QVector<QVariant> firstRow;
+ QList<QVariant> firstRow;
bool skippedStatus = false; // the status of the fetchNext() that's skipped
bool skipRow = false; // skip the next fetchNext()?
};
@@ -413,15 +413,15 @@ bool QSQLiteResult::execBatch(bool arrayBind)
{
Q_UNUSED(arrayBind);
Q_D(QSqlResult);
- QScopedValueRollback<QVector<QVariant>> valuesScope(d->values);
- QVector<QVariant> values = d->values;
+ QScopedValueRollback<QList<QVariant>> valuesScope(d->values);
+ QList<QVariant> values = d->values;
if (values.count() == 0)
return false;
for (int i = 0; i < values.at(0).toList().count(); ++i) {
d->values.clear();
- QScopedValueRollback<QHash<QString, QVector<int>>> indexesScope(d->indexes);
- QHash<QString, QVector<int>>::const_iterator it = d->indexes.constBegin();
+ QScopedValueRollback<QHash<QString, QList<int>>> indexesScope(d->indexes);
+ auto it = d->indexes.constBegin();
while (it != d->indexes.constEnd()) {
bindValue(it.key(), values.at(it.value().first()).toList().at(i), QSql::In);
++it;
@@ -435,7 +435,7 @@ bool QSQLiteResult::execBatch(bool arrayBind)
bool QSQLiteResult::exec()
{
Q_D(QSQLiteResult);
- QVector<QVariant> values = boundValues();
+ QList<QVariant> values = boundValues();
d->skippedStatus = false;
d->skipRow = false;
@@ -460,7 +460,7 @@ bool QSQLiteResult::exec()
// can end up in a case where for virtual tables it returns 0 even though it
// has parameters
if (paramCount >= 1 && paramCount < values.count()) {
- const auto countIndexes = [](int counter, const QVector<int> &indexList) {
+ const auto countIndexes = [](int counter, const QList<int> &indexList) {
return counter + indexList.length();
};
@@ -471,10 +471,10 @@ bool QSQLiteResult::exec()
paramCountIsValid = bindParamCount == values.count();
// When using named placeholders, it will reuse the index for duplicated
- // placeholders. So we need to ensure the QVector has only one instance of
+ // placeholders. So we need to ensure the QList has only one instance of
// each value as SQLite will do the rest for us.
- QVector<QVariant> prunedValues;
- QVector<int> handledIndexes;
+ QList<QVariant> prunedValues;
+ QList<int> handledIndexes;
for (int i = 0, currentIndex = 0; i < values.size(); ++i) {
if (handledIndexes.contains(i))
continue;