summaryrefslogtreecommitdiffstats
path: root/src/sql
Commit message (Collapse)AuthorAgeFilesLines
* SQL/QSqlIndex: remove unused private function createField()Christian Ehrlicher2024-04-262-19/+0
| | | | | | | | | | This function was forgotten when the Qt3 support was removed during initial Qt5 porting (f306d18fe6555a9a5c60560745773b0bf5685ec3). Pick-to: 6.7 Change-Id: I83a0be0db7e81bd9d4f84683a013e1d4faab2dd8 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* QSqlDatabase: add moveToThread()/currentThread()Christian Ehrlicher2024-04-252-0/+52
| | | | | | | | | | | | | Add QSqlDatabase::moveToThread() to be able to move the driver instance to another thread. [ChangeLog][Sql][QSqLDatabase] QSqlDatabase gained two new functions moveToThread() and currentThread() to be able to use it in another thread than the one it was created in. Fixes: QTBUG-39957 Change-Id: I9cb51358f73a3a2fa72813bfdbe059279d388bd7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL: avoid potential detach in QtSqlGlobals dtorVladimir Belyavsky2024-04-211-1/+1
| | | | | | | | | Wrap `connections` to std::as_const() to avoid unexpected detach due to use of QHash::asKeyValueRange() in range-based for loop. Change-Id: I2bf69782dc9dc63df0b3f9dfe395427909fba310 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL/QSqlDatabase: use categorized loggerChristian Ehrlicher2024-04-181-13/+15
| | | | | | | Use the categorized logger qt.sql.qsqldatabase Change-Id: I25216d0809ff0316371a62913b56e1f56ab37ab4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/QSqlQuery: use categorized loggerChristian Ehrlicher2024-04-181-19/+23
| | | | | | | Use the categorized logger qt.sql.qsqlquery Change-Id: Ib5c26751ef013261080207fc13b80b91c644a640 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Long live [[nodiscard]] QFile::openGiuseppe D'Angelo2024-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having already caught some bugs in real code because of unchecked calls to QFile::open, this commit marks QFile::open (and open() in other file-I/O classes) as [[nodiscard]]. Since it's going to raise warnings, the plan is to keep the existing behavior up to and including the next LTS. Then the warnings will switch on by default. All of this is protected by system of macros to opt-in or opt-out the behavioral change at any time. A possible counter-argument for doing this is that QFile::open is also used for opening files in the the resource system, and that opening "cannot fail". It clearly can, if the resource is moved away or renamed; code should at a minimum use a Q_ASSERT in debug builds. Another counter-argument is the opening of file handles or descriptors; but again, that opening may fail in case the handle has been closed or if the flags are incompatible. --- Why not marking *every* open() override? Because some are not meant to be called directly -- for instance sockets are supposed to be open via calls to `connectToHost` or similar. One notable exception is QIODevice::open() itself. Although rarely called directly by user code (which just calls open() on a specific subclass, which likely has an override), it may be called: 1) By code that just takes a `QIODevice *` and does something with it. That code is arguably more rare than code using QFile directly. Still, being "generic" code, they have an extra responsibility when making sure to handle a possible opening failure. 2) By QIODevice subclasses, which are even more rare. However, they usually ignore the return from QIODevice::open() as it's unconditionally true. (QIODevice::open() doesn't use the protected virtual pattern.) I'll try and tackle QIODevice in a future commit. [ChangeLog][QtCore][QFileDevice] The open() functions of file-related I/O classes (such as QFile, QSaveFile, QTemporaryFile) can now be marked with the "nodiscard" attribute, in order to prevent a category of bugs where the return value of open() is not checked and the file is then used. In order to avoid warnings in existing code, the marking can be opted in or out, by defining QT_USE_NODISCARD_FILE_OPEN or the QT_NO_USE_NODISCARD_FILE_OPEN macros. By default, Qt will automatically enable nodiscard on these functions starting from Qt 6.10. Change-Id: Ied940e1c0a37344f5200b2c51b05cd1afcb2557d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* SQL/ODBC: don't escape a driver stringChristian Ehrlicher2024-04-041-2/+7
| | | | | | | | | | | We must not try to escape a driver string, the user has to make sure that everything is correctly escaped when passing a complete driver string. This fixes a regression from QTBUG-122642. Pick-to: 6.7 Fixes: QTBUG-123444 Change-Id: I43316c7a09060f5c8117fdc3c464d239e37d9cdf Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* QSqlField: fix missing deprecation macroZhao Yuhang2024-04-041-0/+4
| | | | | | Change-Id: Ia544da629d495abdfdd0efe0e0991124a9f5d7ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-102-4/+8
| | | | | | | | | 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/MySQL: retrieve default column value for QSqlDatabase::record()Christian Ehrlicher2024-03-101-0/+2
| | | | | | | | | | Retrieve the default value (if set) of a column during QSqlDatabase::record() but not for QSqlQuery::record() as it's done for the other drivers which support retrieving the default column value. Fixes: QTBUG-122723 Change-Id: I92e052bfa6d88e019c0151fbcbc1483a65770c55 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Correct doc snippet licenseLucie Gérard2024-02-283-3/+3
| | | | | | | | | | | | | | All file under doc/snippet should be license as Documentation snippets and according to QUIP-18 [1] this is LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I76eedfb6b15c4091f726a5652e3530001d7cdaf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/SQLite: handle option SQLITE_OPEN_NOFOLLOWChristian Ehrlicher2024-02-261-1/+4
| | | | | | | | | | | | | 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>
* Doc: Fix QDoc warnings for overloadsPaul Wicking2024-02-141-0/+1
| | | | | Change-Id: I9a77b6ea0026748c7f97f73b327118f7a9212d52 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtSql: #include mocsThiago Macieira2024-02-103-0/+6
| | | | | | Pick-to: 6.7 Change-Id: I50e2158aeade4256ad1dfffd17b1f286a9001ae8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSqlQuery: remove unneeded friend tst_QSqlQueryChristian Ehrlicher2024-02-091-5/+0
| | | | | | | | ... as it is no longer needed. Pick-to: 6.7 Change-Id: Ia60b6e53675260ef0e793ac1b44c913af1454b35 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QSqlDatabase: add Q_PROPERTYChristian Ehrlicher2024-02-053-10/+18
| | | | | | | | | Add Q_PROPERTY to follow the current Qt style and simplify the documentation. Task-number: QTBUG-120566 Change-Id: I23103a921cd391f24ce0ffd915a4ae2f98686d21 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Change license of .qdoc filesLucie Gérard2024-02-011-1/+1
| | | | | | | | | | | According to QUIP-18 [1], all .qdoc files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Change-Id: I4559af21fc9069efa9bf0cbd29c5e86cfdac9082 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QSqlQuery: add Q_PROPERTYChristian Ehrlicher2024-01-242-16/+36
| | | | | | | | | Add Q_PROPERTY to follow the current Qt style and simplify the documentation. Task-number: QTBUG-120566 Change-Id: I3803f5246c1814d627a16fa2569d1342b54f6adf Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QSqlIndex: add Q_PROPERTYChristian Ehrlicher2024-01-242-14/+24
| | | | | | | | | Add Q_PROPERTY to follow the current Qt style and simplify the documentation. Task-number: QTBUG-120566 Change-Id: Iaf844eb6f60427dab7fba6ac20b16ffa11f217b8 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* SQL: remove outdated \since tagsChristian Ehrlicher2024-01-241-4/+0
| | | | | | | | | There is no need to know if a function was added in Qt4 or earlier so remove all \since 4.x tags. Amends 747581e0bf491376e39d56f6ce3ce72f0bb9c434 Change-Id: I470bc785b1e31685caec561dafaec0ba97208d99 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* SQL: remove outdated \since tagsChristian Ehrlicher2024-01-216-23/+0
| | | | | | | | There is no need to know if a function was added in Qt4 or earlier so remove all \since 4.x tags Change-Id: I5cf4e89a3e30c13fac076f1ae7abb33a625e366c Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QSqlDriver: add Q_PROPERTYChristian Ehrlicher2024-01-192-13/+12
| | | | | | | | | Add Q_PROPERTY to follow the current Qt style and simplify the documentation. Task-number: QTBUG-120566 Change-Id: Ibbafde35bb5600453ed3a3de36b6bf2b5c560e5f Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QSqlField: add Q_PROPERTYChristian Ehrlicher2024-01-192-103/+133
| | | | | | | | | Add Q_PROPERTY to follow the current Qt style and simplify the documentation. Task-number: QTBUG-120566 Change-Id: I593ba9f322273991661c1d14fb51dcb23678ea0f Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* SQL: rename enablePositionalBinding() to setPositionalBindingEnabled()Christian Ehrlicher2024-01-104-19/+21
| | | | | | | | | | | | | | | ... and the getter to isPositionalBindingEnabled() for QSqlQuery and QSqlResult. This amends e532933a2a9ff0219f0179880e05c95e0ec5e19d [ChangeLog][QtSql][QSqlQuery] Add setPositionalBindingEnabled() to be able to disable positional binding. Pick-to: 6.7 Task-number: QTBUG-119952 Fixes: QTBUG-120548 Change-Id: I0a0afb652d0fc9421f5692b0927a66b2a9b7b854 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QSqlQuery: Add QStringView overloadsChristian Ehrlicher2024-01-102-7/+23
| | | | | | | | | | | | Add an overload to QSqlQuery::isNull()/::value() taking a QStringView - those two functions can now use the newly introduced QSqlRecord::indexOf(QStringView) [ChangeLog][QtSql][QSqlRecord] QSqlQuery::isNull() and value() gained a new overload taking a QStringView. Change-Id: Icebce88b94a7413130bdd7ec0098f51726d05892 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QSqlRecord: Add QStringView overloadsChristian Ehrlicher2024-01-102-24/+103
| | | | | | | | | | | Add overloads to all functions taking a QString and internally using QSqlRecord::indexOf() - no need to create a full-blown QString here. [ChangeLog][QtSql][QSqlRecord] All functions taking a QString got an overload taking a QStringView. Change-Id: Ieb7ffcf572b5450ac81cb7d6108010052dc877ee Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QSqlRecord: style fixesChristian Ehrlicher2023-12-282-27/+27
| | | | | | | | | Misc style fixes in preparation for the new overloads taking QStringView. Pick-to: 6.7 6.6 6.5 Change-Id: I3b838543aefd08bf115488e571b1bb6eec8d968d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Highlight some examples for 'Data Processing & IO' categoryKai Köhne2023-10-311-0/+5
| | | | | | | Pick-to: 6.5 6.6 Task-number: QTBUG-117220 Change-Id: I1bf8d36ae93b96da55d18c9545c942707834c114 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* SQL: fix docChristian Ehrlicher2023-10-261-1/+1
| | | | | | | | | Fix the link to QIBase. This amends 3cb5408e9e2a05f9bd0f230d9bcc31076cb8ec81 Pick-to: 6.6 6.5 6.2 Change-Id: I99820971e4136b2cbbc6ee37d80394e0e016f444 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix datatype mappings for the Mimer SQL QtSql pluginFredrik Ålund2023-10-251-19/+86
| | | | | | | | | | Some of the datatype mappings for Mimer SQL are wrong and some are missing. Also, fix the datatype documentation for Mimer SQL. Fixes: QTBUG-111219 Pick-to: 6.6 Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlDatabase: check if QCoreApplication::instance() existsChristian Ehrlicher2023-10-121-0/+20
| | | | | | | | | | | Check if QCoreApplication::instance() and print a warning if not instead creating and assertion later on. Fixes: QTBUG-117621 Change-Id: Iffb4f7097edbbaf19cb584bff6e5ba1535bf88a0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Doc: Fix warnings and linking issuesTopi Reinio2023-10-091-0/+3
| | | | | | | | | | | | | | | | | | | | Remove or replace links to examples that were removed or moved under manual tests. Replace code snippets that were quoting the now-missing examples. Fix documentation of QSet::removeIf(). Fix typo in documentation macro: Unknown command '\examplecateogry'. Add qtopengl, qtshadertools dependencies to Qt Widgets documentation project to enable correct linking to those topics. Mark all documentation sets in qtbase as free of warnings. Pick-to: 6.6 6.5 Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Preparations to deprecate QItemDelegateChristian Ehrlicher2023-10-051-2/+2
| | | | | | | | | | | | | QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it took until Qt6.7 to remove the last occurrences in qtbase. - remove unused includes / replace with qabstractitemdelegate.h - replace references in the documentation with QStyledItemDelegate - adjust the examples and tests to use QStyledItemDelegate Pick-to: 6.5 6.6 Change-Id: I246755004ce2d01192a726ca0972106c237df0cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add QSqlField::swap() documentationIvan Solovev2023-09-121-0/+8
| | | | | | | | Fixes: QTBUG-116937 Pick-to: 6.6 Change-Id: Ic5f08c3a7d0f2c0c926ced0d194fd5a2aea191fd Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Add missing since to enum valuePaul Wicking2023-09-111-1/+1
| | | | | | | | Task-number: QTBUG-116848 Pick-to: 6.6 Change-Id: Ia137a21de5bab406a133ee032b6ccf3089de8d22 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
* QSqlIndex: implement member swap() and use a macro for move-assignmentIvan Solovev2023-08-231-1/+10
| | | | | | | | | | | | | | Also declare the type as shared using Q_DECLARE_SHARED Found during Qt 6.6 API review. This commit amends 46e909a37a38289a601333ae6f205e8946152287. [ChangeLog][QtSql] QSqlIndex is now a relocatable type. Pick-to: 6.6 Change-Id: I78394cba082b4df2e4d8a6aab8e8e87f2340962c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* SQL: add missing Q_DECLARE_SHARED to the value typesIvan Solovev2023-08-232-0/+4
| | | | | | | | | | | | | | | | | QSqlField and QSqlRecord implemented all special member functions and the member swap() function, but were missing the Q_DECLARE_SHARED macro. Found during Qt 6.6 API review [ChangeLog][QtSql] QSqlField and QSqlRecord are now relocatable types. Pick-to: 6.6 Change-Id: Ia10f1d3fd9f634864be5b36d1d3903301adfa9ab Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Fix warning about undocumented parameterKai Köhne2023-08-081-1/+2
| | | | | | | | | | | | Fixes (qdoc) warning: Undocumented parameter 'enable' in QSqlQuery::enablePositionalBinding() Amends the documentation introduced in e532933a2a9 Change-Id: I638cf7e1dc1c9af911f6ca52bc27e6072fae1035 Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQLDatabase: merge two global statics into oneChristian Ehrlicher2023-07-231-84/+51
| | | | | | | Merge the two global statics into one. Change-Id: I8a93ba848abe31527551313c8a4a449d05e3d680 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/PSQL: Handle jsonb operators in prepared queriesChristian Ehrlicher2023-07-235-1/+62
| | | | | | | | | | | | Add an option to disable handling of positional binding so jsonb operators are not screwed up [ChangeLog][QtSql][QSqlQuery] Add setEnablePositionalBinding() to be able to disable positional binding. Fixes: QTBUG-96636 Change-Id: I428a9d3b10274b97292ab86a74d9b3971d6f10e9 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Do not generate the deprecated 'QtSql/qsql.h'Alexey Edelev2023-07-191-1/+0
| | | | | | Task-number: QTBUG-115029 Change-Id: I1fe496864ce25f20421ca78fbde3fe4eb4b9fc49 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBaseGiuseppe D'Angelo2023-07-111-0/+1
| | | | | | | | | It's clean now, keep it as such. Enabling it for QtCore is still OK, because it just hides a function template declared in a header. Change-Id: I8e7dfae179732ba04241a6a3258c2d722e8259df Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtSql: Stylistic fixes based on the Qt 6.6 api reviewChristian Ehrlicher2023-07-082-2/+2
| | | | | | | | Amends 12909d7c3df74b88382b727cfd3e215914f291ba and 0efd8854c4b32ec0b011efbf6b3a1990fe684e32. Pick-to: 6.6 Change-Id: Id7cb7377bcd1f32092330d2fc5b2fa5b83ce941f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/SQLite: add case folding for non-ascii charactersChristian Ehrlicher2023-07-081-0/+4
| | | | | | | | | | | | | 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-0/+11
| | | | | | | | | | | | | | | 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>
* Use a global value for warning limit when testing documentation in CITopi Reinio2023-06-271-3/+0
| | | | | | | | | | | | | | | | | | | The most common limit for the maximum number of allowed documentation warnings is zero. Use a global value for 'warninglimit', adopted by all Qt module documentation projects that include the configuration from qtbase/doc/global. This allows for a temporary increase of the limit across all modules as needed - for example, when updating the QDoc binary that the CI provisions to a version that introduces new types of documentation warnings. Increase this base limit temporarily to 10 to help re-enable documentation testing in CI as it's currently disabled. Task-number: QTBUG-113326 Change-Id: I8b66951ca9324bcfaec3b5a7ec2cff544c62feb0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QSqlResult: remove bad API returning non-const referenceVolker Hilsheimer2023-06-213-9/+37
| | | | | | | | | | | | | | | | | | | | | | QSqlResult::boundValues is a const member function, but returned a non- const reference to a QList<QVariant>. This is a bad and potentially dangerous API, as callers can modify the list stored in QSqlResult. Move that API into the removed_api translation unit, remove it from Qt 6.6 on and replace it with two suitable overloads where the const version returns a QVariantList by value, and the non-const overload returns a mutable reference. Driver implementations that used to call the const overload to get a mutable reference are now calling the non-const overload instead (those calls are all made in the non-const exec() or equivalent driver implementations). As a drive-by, replace "vector" with "list" in the documentation. Pick-to: 6.6 Change-Id: I6e4fd8f5749b939cdb609bf5876735e9b30b2b5a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Update Cached Table example meta-dataVolker Hilsheimer2023-05-241-1/+1
| | | | | | | | | | | | | | Drop "Example" from the example's title, add SQL instead, and add it to the Input/Output category of examples. It's a documented example, does something meaningful, and looks reasonable. Having one SQL example categorised so that it's easy to see that Qt includes that functionality seems like a good idea. The other examples are mostly small API examples that are still good to have as fully-functional apps rather than just snippets. Pick-to: 6.5 Change-Id: Ib960f38db39c791f7ff5a2b9bf3157ee32b362ec Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* SQL: Make QSqlDatabase::DriverDict creation thread-safeChristian Ehrlicher2023-05-241-15/+14
| | | | | | | | | | Make the QSqlDatabase::DriverDict thread-safe and make sure it's properly cleaned up on destruction. Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-112961 Change-Id: I1ff70e477579231754ef829fdede944d6042894d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlDatabase: use a QReadWriteLock to access DriverDictChristian Ehrlicher2023-05-231-0/+3
| | | | | | | | | | | | | DriverDict might be accessed from different threads so we have to make sure it's thread-safe. Use the already existing QReadWriteLock from QConnectionDict for later merging of these two global instances. The two instances do not interfere each other (DriverDict is a dictionary for custom registered sql drivers, QConnectionDict contains all current active database connections) so the dual-use of the mutex is fine. Pick-to: 6.5 6.2 5.15 Change-Id: I84c77df666e72e826d0d3d291cecd5417bbd1baf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>