Commit Graph

883 Commits (5ea248155654b58fcb52ef326dc4d94de83d0409)

Author SHA1 Message Date
Christian Ehrlicher 5a7d41667d SQL/QSqlIndex: remove unused private function createField()
This function was forgotten when the Qt3 support was removed during
initial Qt5 porting (f306d18fe6).

Pick-to: 6.7
Change-Id: I83a0be0db7e81bd9d4f84683a013e1d4faab2dd8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2024-04-26 16:37:55 +01:00
Christian Ehrlicher b4c63b89df QSqlDatabase: add moveToThread()/currentThread()
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>
2024-04-25 08:27:21 +02:00
Vladimir Belyavsky b8d92d2ef8 SQL: avoid potential detach in QtSqlGlobals dtor
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>
2024-04-21 15:09:52 +00:00
Christian Ehrlicher 2cd0bc729e SQL/QSqlDatabase: use categorized logger
Use the categorized logger qt.sql.qsqldatabase

Change-Id: I25216d0809ff0316371a62913b56e1f56ab37ab4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-18 20:11:14 +02:00
Christian Ehrlicher 6bc454b247 SQL/QSqlQuery: use categorized logger
Use the categorized logger qt.sql.qsqlquery

Change-Id: Ib5c26751ef013261080207fc13b80b91c644a640
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-18 20:11:14 +02:00
Giuseppe D'Angelo 7466831509 Long live [[nodiscard]] QFile::open
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>
2024-04-17 20:07:47 +02:00
Christian Ehrlicher 9873f4b283 SQL/ODBC: don't escape a driver string
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>
2024-04-04 23:43:02 +02:00
Zhao Yuhang 90217f37ca QSqlField: fix missing deprecation macro
Change-Id: Ia544da629d495abdfdd0efe0e0991124a9f5d7ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-04-04 12:21:12 +00:00
Christian Ehrlicher e65dc19332 SQL/QSqlField: deprecate internal functions setSqlType()/typeID()
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>
2024-03-10 18:16:00 +00:00
Christian Ehrlicher e2e818483f SQL/MySQL: retrieve default column value for QSqlDatabase::record()
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>
2024-03-10 19:15:47 +01:00
Lucie Gérard 1556a3a5eb Correct doc snippet license
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>
2024-02-28 19:15:51 +01:00
Christian Ehrlicher 3379fd2322 SQL/SQLite: handle option SQLITE_OPEN_NOFOLLOW
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>
2024-02-26 14:43:10 +01:00
Paul Wicking 99b9eb7177 Doc: Fix QDoc warnings for overloads
Change-Id: I9a77b6ea0026748c7f97f73b327118f7a9212d52
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-02-14 21:47:28 +01:00
Thiago Macieira f3832b63de QtSql: #include mocs
Pick-to: 6.7
Change-Id: I50e2158aeade4256ad1dfffd17b1f286a9001ae8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-10 02:39:14 -08:00
Christian Ehrlicher 74722411d3 QSqlQuery: remove unneeded friend tst_QSqlQuery
... as it is no longer needed.

Pick-to: 6.7
Change-Id: Ia60b6e53675260ef0e793ac1b44c913af1454b35
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-09 17:12:23 +01:00
Christian Ehrlicher 781135b0d2 QSqlDatabase: add Q_PROPERTY
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>
2024-02-05 21:52:33 +01:00
Lucie Gérard 865d0133fc Change license of .qdoc files
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>
2024-02-01 19:25:42 +00:00
Christian Ehrlicher 212e88889a QSqlQuery: add Q_PROPERTY
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>
2024-01-24 21:35:09 +01:00
Christian Ehrlicher 294da15696 QSqlIndex: add Q_PROPERTY
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>
2024-01-24 20:35:09 +00:00
Christian Ehrlicher c10530fd97 SQL: remove outdated \since tags
There is no need to know if a function was added in Qt4 or earlier so
remove all \since 4.x tags.
Amends 747581e0bf

Change-Id: I470bc785b1e31685caec561dafaec0ba97208d99
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2024-01-24 21:35:09 +01:00
Christian Ehrlicher 747581e0bf SQL: remove outdated \since tags
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>
2024-01-21 10:12:31 +01:00
Christian Ehrlicher 6dfc988ea0 QSqlDriver: add Q_PROPERTY
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>
2024-01-19 17:29:09 +01:00
Christian Ehrlicher 9806f54a58 QSqlField: add Q_PROPERTY
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>
2024-01-19 17:29:06 +01:00
Christian Ehrlicher b1e5d9275d SQL: rename enablePositionalBinding() to setPositionalBindingEnabled()
... and the getter to isPositionalBindingEnabled() for QSqlQuery and
QSqlResult.
This amends e532933a2a

[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>
2024-01-10 04:32:49 +01:00
Christian Ehrlicher f2dba19194 QSqlQuery: Add QStringView overloads
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>
2024-01-10 04:11:52 +01:00
Christian Ehrlicher 993f318014 QSqlRecord: Add QStringView overloads
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>
2024-01-10 04:11:51 +01:00
Christian Ehrlicher ddad911f9b QSqlRecord: style fixes
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>
2023-12-28 08:14:56 +01:00
Kai Köhne e45937c22d Highlight some examples for 'Data Processing & IO' category
Pick-to: 6.5 6.6
Task-number: QTBUG-117220
Change-Id: I1bf8d36ae93b96da55d18c9545c942707834c114
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-31 19:35:59 +02:00
Christian Ehrlicher a553d00179 SQL: fix doc
Fix the link to QIBase.
This amends 3cb5408e9e

Pick-to: 6.6 6.5 6.2
Change-Id: I99820971e4136b2cbbc6ee37d80394e0e016f444
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-26 23:03:45 +02:00
Fredrik Ålund 00ed8d7822 Fix datatype mappings for the Mimer SQL QtSql plugin
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>
2023-10-25 23:01:56 +02:00
Christian Ehrlicher d70b873c37 QSqlDatabase: check if QCoreApplication::instance() exists
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>
2023-10-12 06:16:46 +02:00
Topi Reinio dc33b0ca7a Doc: Fix warnings and linking issues
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>
2023-10-09 17:24:07 +00:00
Christian Ehrlicher 4e8b54eb81 Preparations to deprecate QItemDelegate
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>
2023-10-05 21:08:45 +02:00
Ivan Solovev 5a1a80861f Add QSqlField::swap() documentation
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>
2023-09-12 02:35:03 +02:00
Paul Wicking 8f448d7ac7 Doc: Add missing since to enum value
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>
2023-09-11 17:50:15 +02:00
Ivan Solovev f081578ce0 QSqlIndex: implement member swap() and use a macro for move-assignment
Also declare the type as shared using Q_DECLARE_SHARED

Found during Qt 6.6 API review.

This commit amends 46e909a37a.

[ChangeLog][QtSql] QSqlIndex is now a relocatable type.

Pick-to: 6.6
Change-Id: I78394cba082b4df2e4d8a6aab8e8e87f2340962c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-23 14:21:57 +00:00
Ivan Solovev 2f87711913 SQL: add missing Q_DECLARE_SHARED to the value types
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>
2023-08-23 16:21:57 +02:00
Kai Köhne 3883b0a7b6 Doc: Fix warning about undocumented parameter
Fixes
 (qdoc) warning: Undocumented parameter 'enable' in QSqlQuery::enablePositionalBinding()

Amends the documentation introduced in e532933a2a

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>
2023-08-08 09:12:16 +02:00
Christian Ehrlicher 3d284d9b8d SQLDatabase: merge two global statics into one
Merge the two global statics into one.

Change-Id: I8a93ba848abe31527551313c8a4a449d05e3d680
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-23 16:49:16 +02:00
Christian Ehrlicher e532933a2a SQL/PSQL: Handle jsonb operators in prepared queries
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>
2023-07-23 16:49:15 +02:00
Alexey Edelev 1e3bf10786 Do not generate the deprecated 'QtSql/qsql.h'
Task-number: QTBUG-115029
Change-Id: I1fe496864ce25f20421ca78fbde3fe4eb4b9fc49
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2023-07-19 13:51:36 +02:00
Giuseppe D'Angelo 536a4299be Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBase
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>
2023-07-11 22:44:29 +02:00
Christian Ehrlicher 7a732413ff QtSql: Stylistic fixes based on the Qt 6.6 api review
Amends 12909d7c3d and 0efd8854c4.

Pick-to: 6.6
Change-Id: Id7cb7377bcd1f32092330d2fc5b2fa5b83ce941f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-08 18:34:10 +00:00
Christian Ehrlicher 4b7b5edf26 SQL/SQLite: add case folding for non-ascii characters
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>
2023-07-08 00:08:44 +02:00
BogDan Vatra e84dc809e2 Say hello to QtVFS for SQLite3
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>
2023-07-02 17:12:02 +00:00
Topi Reinio 43ea57b901 Use a global value for warning limit when testing documentation in CI
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>
2023-06-27 15:12:31 +00:00
Volker Hilsheimer 3f72b0d5fc QSqlResult: remove bad API returning non-const reference
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>
2023-06-21 00:30:41 +02:00
Volker Hilsheimer 8fa28b0cff Update Cached Table example meta-data
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>
2023-05-24 17:29:20 +02:00
Christian Ehrlicher 048a68c1e9 SQL: Make QSqlDatabase::DriverDict creation thread-safe
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>
2023-05-24 17:27:55 +02:00
Christian Ehrlicher 67b8dec0d0 QSqlDatabase: use a QReadWriteLock to access DriverDict
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>
2023-05-23 06:20:09 +02:00