diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-03-21 08:59:26 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-03-21 08:59:26 +0100 |
commit | cc920b4cddc170a7442d8fdfb53076c208a3d71e (patch) | |
tree | e4757cffe420bd3c61dda1d369b452a0fac9eff7 /src/plugins/sqldrivers | |
parent | c8c8cc790a315710b0dae2282dc32e3472e107ee (diff) | |
parent | fc8fd508165c8e4dcfe0da397b63cf99f15178e3 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
Diffstat (limited to 'src/plugins/sqldrivers')
-rw-r--r-- | src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index d1a6582c5a..cb3d905f46 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -51,7 +51,7 @@ #include <qstringlist.h> #include <qvector.h> #include <qdebug.h> -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) #include <qcache.h> #include <qregularexpression.h> #endif @@ -467,7 +467,10 @@ bool QSQLiteResult::exec() #if (SQLITE_VERSION_NUMBER >= 3003011) // In the case of the reuse of a named placeholder - if (paramCount < values.count()) { + // We need to check explicitly that paramCount is greater than 1, as sqlite + // 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 QList<int>& indexList) { return counter + indexList.length(); }; @@ -622,7 +625,7 @@ QVariant QSQLiteResult::handle() const ///////////////////////////////////////////////////////// -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) static void _q_regexp(sqlite3_context* context, int argc, sqlite3_value** argv) { if (Q_UNLIKELY(argc != 2)) { @@ -721,7 +724,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c bool sharedCache = false; bool openReadOnlyOption = false; bool openUriOption = false; -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) static const QLatin1String regexpConnectOption = QLatin1String("QSQLITE_ENABLE_REGEXP"); bool defineRegexp = false; int regexpCacheSize = 25; @@ -745,7 +748,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) { sharedCache = true; } -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) else if (option.startsWith(regexpConnectOption)) { option = option.mid(regexpConnectOption.size()).trimmed(); if (option.isEmpty()) { @@ -774,7 +777,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); -#ifndef QT_NO_REGULAREXPRESSION +#if QT_CONFIG(regularexpression) if (defineRegexp) { auto cache = new QCache<QString, QRegularExpression>(regexpCacheSize); sqlite3_create_function_v2(d->access, "regexp", 2, SQLITE_UTF8, cache, &_q_regexp, NULL, |