summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SQL/SQLite: use categorized loggerChristian Ehrlicher2024-04-041-6/+11
| | | | | | | Use the categorized logger qt.sql.sqlite Change-Id: I70880fca579df56500ddc94a72bc6c616c475e67 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-101-1/+0
| | | | | | | | | These functions set/get the db-specific internal sql type but it's not used in any of the sql plugins since ages. Any external plugin using this for some reason must be ported away until Qt7. Change-Id: Ifb33e9d3be0b80fb4d0979d31436e89ea6a8208b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SQL/SQLite: Silence warning "Unsupported option ''"Friedemann Kleint2024-03-021-1/+1
| | | | | | | | | It shows for example when starting assistant. Amends 3379fd2322d112af4ef7ce75aafe18c27746acae. Pick-to: 6.7 Change-Id: I85196c62ff9d9caaa46a5279c3b965dc28266ba8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/SQLite: handle option SQLITE_OPEN_NOFOLLOWChristian Ehrlicher2024-02-261-0/+12
| | | | | | | | | | | | | Since SQLite 3.31 there is a new open() option SQLITE_OPEN_NOFOLLOW to disallow a filename with a symlink for security reason. Expose this option to QSQLite via QSQLITE_OPEN_NOFOLLOW. [ChangeLog][SQL][SQLite] Add new option QSQLITE_OPEN_NOFOLLOW to expose open mode SQLITE_OPEN_NOFOLLOW. Pick-to: 6.7 Change-Id: I2d6218bde2bf8b4f1bc36125dffa551b52369072 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQLite: Handle identifiers correctlyPo-Hao Su2023-09-281-76/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change can be described in the following 2 categories: 1. Support 3 ways to escape identifiers mentioned in SQLite Keywords In SQLite Keywords (https://sqlite.org/lang_keywords.html), it shows that there are 3 ways to escape identifiers, i.e., "", [], ``. So, I have overridden "bool isIdentifierEscaped(const QString &, IdentifierType)" to support it. In addition, there was a bug of _q_escapeIdentifier. If there is a field name called length [cm], which uses square brackets to show units, _q_escapeIdentifier will not escape it to "length [cm]". 2. Identify identifiers correctly if identifiers have been escaped There is a bug of QSQLiteDriver::record and QSQLiteDriver::primaryIndex. If we input escaped identifiers with separator, let's say "databaseName"."tableName", both will change the input into databaseName"."tableName, which is incorrect and causes qGetTableInfo cannot get the right results. In addition, I overrode stripDelimiters to strip "databaseName"."tableName" correctly. There are still some assumptions for isIdentifierEscaped, escapeIdentifier, and stripDelimiters, but I think this change it better than what we have now. 1. For isIdentifierEscaped, if identifiers have a dot and the dot is a separator, it is the users' responsibility to escape the pair of schema and table name correctly. For example, "aSchemaName"."aTableName", not "aSchemaName".a"TableName". That's because we don't know whether the dot is just a dot of the name or a separator. 2. For escapeIdentifier, if identifiers have a dot and the parts before and after the dot are not escaped, escapeIdentifier will treat the dot as part of the table name or field name. The same as the item above, it is users' responsibility to do it right. 3. For stripDelimiters, the same as above, it is users' responsibility to do escape if users want to use format schemaName.tableName or tableName.fieldName. Change-Id: I9d036a2a96180f8542436188f75a220a0fe58257 Reviewed-by: Po-Hao Su <supohaosu@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/SQLite: add case folding for non-ascii charactersChristian Ehrlicher2023-07-081-0/+33
| | | | | | | | | | | | | SQLite does not provide a proper case folding for non-ascii characters due to a lack of a proper ICU library. Therefore add an option so Qt can do it for SQLite. [ChangeLog][SQL][SQLite] Add new option QSQLITE_ENABLE_NON_ASCII_CASE_FOLDING for correct case folding of non-ascii characters. Fixes: QTBUG-18871 Change-Id: Ib62fedf750f05e50a581604253cf30d81e367b42 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Say hello to QtVFS for SQLite3BogDan Vatra2023-07-021-1/+4
| | | | | | | | | | | | | | | This patch allows to open databases using QFile. This way it can open databases from RW locations as android shared storage or even from RO resources e.g. qrc or android assets. [ChangeLog][QtSql][SQLite3 driver] QtVFS for SQLite3 allows to open databases using QFile. This way it can open databases from RW locations such as android shared storage, or even from read-only resources e.g. qrc or android assets. Fixes: QTBUG-107120 Change-Id: I889ad44de966c96105fe1954ee4eda175dd5a886 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL: replace qPrintable() / toLocal8Bit() with unicode versionsChristian Ehrlicher2023-04-181-2/+2
| | | | | | | Replace qPrintable() and toLocal8Bit() with qUtf16Printable() Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL: small optimization for SQLDriver::escapeIdentifier()Christian Ehrlicher2023-02-281-1/+1
| | | | | | | | Avoid a memmove (and replace it with a memcpy) by not using QString::prepend() but create a completely new string object instead. Change-Id: Ibdb4a9c6b15b96f1743d47e158ff0fb9b2048221 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-1/+1
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* plugins: use nullptr instead of 0 and NULLJohannes Kauffmann2022-10-021-3/+3
| | | | | Change-Id: I7f3e56db1d0db178d8a7d9eb91c09e03cae89f6b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QSQLiteDriverPlugin: includemocsMarc Mutz2022-04-281-0/+2
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I3ad19796499e5fd4bb2bd1a495aeed7729890650 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Sql: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-191-28/+28
| | | | | | Task-number: QTBUG-98434 Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-191-16/+16
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I03477e645a94948cac3e3e2abca52aa4e3e2efff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace QString::utf16 with QString::data where appropriateØystein Heskestad2022-01-171-4/+4
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: Ibd5e56798c0c666893c12c91ff0881842b8430c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Adapt SQL drivers to Qt 6 change of QVariant::isNullVolker Hilsheimer2022-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, QVariant::isNull returned true if either the variant didn't contain a value, or if the value was of a nullable type where the type's isNull member function returned true. In Qt 6, QVariant::isNull only returns true for variants that don't contain a value; if the value contained is e.g. a null-QString or QDateTime, then QVariant::isNull returns false. This change requires a follow up in the SQL drivers, which must still treat null-values the same as null-variants, lest they write data into the data base. Add a static helper to QSqlResultPrivate that implements isNull-checking of variants that contain a nullable type relevant for Sql, and add a test case to the QSqlQuery test that exercises that code. Pick-to: 6.2 6.3 Fixes: QTBUG-99408 Fixes: QTBUG-98471 Change-Id: I08b74a33aa3235c37d974f182da1f2bdcfd8217e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* SQLite plugin: use QString::unicode(), not utf16()Giuseppe D'Angelo2021-06-011-1/+1
| | | | | | | | | | utf16() reallocates a QString if it was created from raw data, in order to ensure NUL termination. But here we don't need NUL termination anyways because we also pass the string size, so just use unicode() instead. Change-Id: I4a01ab9f4e53b94b80d3d00272cb0f0e35e30959 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQLite driver: fix crash when binding a QByteArray/QStringGiuseppe D'Angelo2021-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing SQLITE_STATIC to sqlite3_bind_*() means that ownership of the data stays in the caller, i.e. SQLite itself doesn't make a copy; such data must be therefore be kept valid until sqlite3_step() is called. The code in the SQLite driver uses that option to avoid copying byte array or string data. But, unlike what the comments in the code say, we do NOT keep the QByteArray/QString alive long enough: they're contained by a temporary QVariant object which gets destroyed at the end of the loop that binds each argument. Luckily the fix is simple: since that QVariant is just a copy of the QVariants used as bound parameters, and these are held in a container (which lives long enough), simply create a reference to the container's elements rather than a copy. This ensures that the data is alive by the time sqlite3_step() is called. This problem doesn't normally appear because of implicit sharing of QByteArray/QString. When the QVariant is copied, the inner element is just a shallow copy. Getting the pointer to the data, and destroying the QVariant, does not destroy the data (it's kept alive by the QByteArray/QString inside the *copied-from* QVariant). Of course there's a catch: if the *copied-from* QVariant contains a QString created via fromRawData, then everything blows up. In this case, 1. the copied QVariant is created (which bumps the QString refcount)¹ 2. the QString inside of it is accessed directly (via QVariant::constData) 3. utf16() is called on that string, which detaches it (!) 4. the result of utf16() is passed to SQLite, with SQLITE_STATIC 5. the copied QVariant is destroyed; this destroys the inner QString, which, being detached, deallocates the data too early. 6. sqlite3_step() is called, kaboom. (The copied-from QVariant still has the string created by fromRawData.) ¹ Note that QString uses the Small QVariant Optimization, so the QString object itself into the QVariant is copied, it's not just a *QVariant* refcount increase. Change-Id: Idcdb192809f1f8f79b4a901e1247f933eb06e854 Pick-to: 6.1 5.15 5.12 Fixes: QTBUG-94070 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQLite: Handle tables and fields with a dot in the name correctlyAndy Shaw2021-04-231-9/+24
| | | | | | | Fixes: QTBUG-91885 Pick-to: 6.1 6.0 5.15 Change-Id: Iba76bb50266dd4fb5f50e4ea1549d1d2bb6e3431 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSql/QSqlite: return extended error codes by defaultChristian Ehrlicher2021-01-111-0/+4
| | | | | | | | | | | | | SQlite allows to return fine-granulated error codes but this behavior is not enabled by default (due to backwards compatibility concerns). Enable them for the SQLite driver by default but provide an option to disable them when needed. [ChangeLog][QtSql][QSQLITE] The plugin now returns the extended error codes by default. Change-Id: I59cec9aea46eb03f1e7ca02903d769c003a1ae30 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* sqlite: Replace NULL by nullptrFriedemann Kleint2020-12-211-6/+7
| | | | | Change-Id: I8e845ae093a68d2d7ecf0e358a2316a54d0f2144 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* sqlite: Fix MSVC integer conversion warningsFriedemann Kleint2020-12-211-6/+11
| | | | | Change-Id: I58ab6a8d7787abce5b0f73562eb53f40e39c8186 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Reduce the scope of variables in exec() and fetchNext()Zou Ya2020-11-261-5/+2
| | | | | | | | | | | | The scope of the variable 'currBind' can be reduced if the variable 'r' is not 0. So declare the variable when the variable 'r' is 0. The local variable 'i' shadows outer variable in fetchNext(), so move it to the front of switch. Don't declare 'res' until we need and initialize it. Change-Id: Idfb220b96cfbcd4088fd7858ed9392d0a3e10aea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-1/+1
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Cleanup remaining QVariant::Type uses in Qt SqlLars Knoll2020-10-171-23/+23
| | | | | Change-Id: Ibcaa678cd9f9c957392a75b477fa6821f9a69127 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSqlite: Don't crash after binding too many placeholdersMarcel Krems2020-08-241-1/+6
| | | | | | | | | | | | | | When you bind more values than the query has placeholders, indexes will be empty which causes an out-of-bounds access in indexes.first. We can't check the parameter count because of multiple placeholders with the same name, so we check if the name is null. Tested with SQLite and PostgreSQL Pick-to: 5.15 Change-Id: Id5d4bd15d7ed16603f47b87d6e0bf811a20157d8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Deprecate QVariant::Type uses in QSqlFieldLars Knoll2020-08-151-1/+1
| | | | | | | | Add metaType()/setMetaType() methods to be used instead of the type() methods taking a QVariant::Type. Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-061-14/+14
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QtSql from QStringRef to QStringViewLars Knoll2020-06-111-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: Icc9b955dae1aa13b16c01e26192cb82f828903b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-261-17/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/bearermonitor/CMakeLists.txt examples/network/CMakeLists.txt src/corelib/tools/qlinkedlist.h src/sql/kernel/qsqldriver_p.h src/sql/kernel/qsqlresult_p.h src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/tools/moc/allmocs_baseline_in.json Change-Id: I21a3c34570ae79ea9d30107fae71759d7eac17d9
| * QtSql: cleanup QSqlDriverPrivate and QSqlResultPrivateChristian Ehrlicher2020-02-191-17/+8
| | | | | | | | | | | | | | | | Cleanup QSqlDriverPrivate/QSqlResultPrivate and their derived classes in ODBC, MySql, PostgreSQL and SQLite. Change-Id: I52e69c00cf981b81dde7c3a0370f86f06ef756bb Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | SQL: cleanup private classesChristian Ehrlicher2020-01-071-8/+1
|/ | | | | | | | | | | Cleanup private SQL classes: - use nullptr - use member initialization - adjust style - remove deprecated functions Change-Id: I845f5b1081649fdd40f4f80e1052331806230cf7 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QSqlDriver: deprecate one-arg notification() signalChristian Ehrlicher2019-09-211-0/+5
| | | | | | | | | | | | | QSqlDriver::notifcation() signal is available in two versions since Qt4 times. They are both emitted in the corresponding places which is useless. Therefore deprecate the one-arg version. [ChangeLog][QtSql][QSqlDriver] The one-arg version of QSqlDriver::notifcation() is now deprecated. Change-Id: Ie09aa0cc952f4d854c6fb617b37b9047a3194ee3 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Port from QStringViewLiteral to u""Marc Mutz2019-07-291-1/+1
| | | | | | | | | Now that all our supported compilers know char16_t, we no longer need QStringViewLiteral, whose only purpose in life was to turn u"" into L"" for MSVC < 2015. Change-Id: I25a094fe7992d9d5dbeb4a524d9e99e043dcb8ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-141-7/+12
|\ | | | | | | Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
| * sqlite: Fix QSqlError handling when opening/closing databaseFlorian Bruhin2018-09-131-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both sqlite3_open_v2 and sqlite3_close are documented to return an error code: https://www.sqlite.org/c3ref/open.html https://sqlite.org/c3ref/close.html However, those were ignored (other than checking whether the operation succeeded), causing QSqlError::nativeErrorCode() to always be "-1" when there was an error while opening/closing the database. Additionally, the error string needs to be read (via sqlite3_errmsg16) in qMakeError *before* d->access is set to 0, or the databaseText() will always be "out of memory" no matter what error actually happened. Task-number: QTBUG-70506 Change-Id: I75cbf178c9711442e640afd26c4502214d20c598 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | SQL PostgreSQL/SQlite: Properly decode default varchar parameterChristian Ehrlicher2018-09-121-1/+8
| | | | | | | | | | | | | | | | | | The default values for varchar columns were not decoded properly. Task-number: QTBUG-46968 Change-Id: Ie13d48c316cd694240f7e287010b97afc8c6c341 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Remove a deprecation warning coming from QRegularExpressionGiuseppe D'Angelo2018-07-211-1/+1
| | | | | | | | | | | | | | The flag is deprecated. Change-Id: Ice6ffafac6a5fa79675fc7cd84a9fb746f17dfb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-241-2/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_common.prf src/corelib/tools/qstring.cpp src/plugins/platforms/windows/qwindowsmousehandler.cpp src/widgets/widgets/qmainwindowlayout_p.h Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
| * sqlite: Allow for duplicated placeholders with just one placeholderAndy Shaw2018-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | This accounts for a case of a placeholder being duplicated in the prepare query, but where only one placeholder was used. This amends e4e87a2ece1e0c9901514fea094f31863b64b570 Task-number: QTBUG-68299 Change-Id: Ia92ee912facd51a13e7222886debb219b24442b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-081-1/+0
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp tests/auto/corelib/io/qresourceengine/qresourceengine_test.pro Change-Id: I3169f709cc2a1b75007cb23c02c4c79b74feeb04
| * Fix build without features.timezoneTasuku Suzuki2018-05-081-0/+4
| | | | | | | | | | Change-Id: I3f8421103afa61baf415636b4dc8cf93fb477bcc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Use QDateTime::toString(Qt::ISODateWithMS) instead of reinventing itEdward Welbourne2018-05-031-27/+1
|/ | | | | | | | | Following up on a review comment on commit 0a5f71c6062d575602ff041fb1b88ec2d8ad92bc. Change-Id: I46924f5ad1b291039d22a3d6015d80306679ad26 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* sqlite: Support using execBatch() with duplicated named placeholdersAndy Shaw2018-03-271-0/+25
| | | | | | | | | | | | | | | Also expands the tst_qsqlquery::batchExec() test to account for this case and generally test the functionality. In addition it is made to be more robust to avoid any discrepencies with the testing data. The test in general is also cleaned up to enable more of it being tested with the different database drivers where possible. An expected fail is added for MySQL due to the fact that it has a bug where null timestamp entries are being converted to the current datetime when adding it as a bind value. Change-Id: I0061bd1c69ae35b4858afc49420f13ce59cf48ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSqlResult: use QVector<int> instead QList<int> for indexes valueChristian Ehrlicher2018-03-231-4/+5
| | | | | | | | Minor tweak: QList<int> is taking 64bit per entry, QVector<int> only 32bit - this should reduce memory usage a little bit. Change-Id: I3e17269feb4840343f5cecfc71f8fccd70edc80f Reviewed-by: Andy Shaw <andy.shaw@qt.io>