Some features are server-dependent and therefore an open db connection
is needed to make sure that the feature is available.
Pick-to: 6.7 6.5
Fixes: QTBUG-10016
Change-Id: Ia9a117a64ba5fe7cdd69bf95a41cfc301ab5fd94
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 139b8779469244dd1aa226dd3222e6e4aeb2c932)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Don't move them around during deprecation.
Change-Id: I647fec5a440ea063463dc285def5d793726a9e61
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 70475a652a9a44651c25126f6615770e8b43ca1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Add a note to all functions now taking a QAnyStringView that their
signature changed from QString to QAnyStringView
Change-Id: Ib9743b5b2c437724c6308e74ef3c5820136a34f5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a736a3c670929e3b73e11b33cc1705957c42961b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Change all functions taking a QStringView to take a QAnyStringView and
remove all functions taking a const QStringRef since this can now be
fully handled by the QAnyStringView ones.
This amends f2dba19194 and
993f318014
[ChangeLog][QtSql][QSqlRecord] All functions taking a QString were
changed to take a QAnyStringView.
Change-Id: Ia1c968c4e2a7a93aa26d090ef6605271305c14a6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6b096271cf0aac38d80f292f8b37edd671a8d17f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Move it to the private implementation to be later used as a template
when switching to QAnyStringView.
Change-Id: If9977711757677546cfc058602ada9f54b978509
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
... to be in sync with QObject naming.
This amends b4c63b89df.
Change-Id: I25301f65aa880205d8c0cfd6f4bfa9fdba34a01c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This requires some fixes in several classes that are also included
in this patch.
The QTestEvent hierarchy is all-inline and changes layout depending on
QT_GUI_LIB and QT_WIDGETS_LIB, so we can't just export it. Suppress the
warning in that header for now. Created QTBUG-104486 to track a fix for
the real issue.
The QFutureInterface hierarchy is also all-inline, but templates, so
doesn't trigger, except the <void> specialization. Created
QTBUG-125115 to track a fix for the real issue.
Done-with: Marc Mutz <marc.mutz@qt.io>
Task-number: QTBUG-45582
Change-Id: I96b3e109aa989b70e0d4809b90bd53a369e50d55
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add the move ctor and move operator for QSqlField
Task-number: QTBUG-109938
Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Use QSharedData for the private class instead a home-brew version.
Change-Id: Id3625bb0eb8f81c9caa672e2453dab3d44b15ea9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Avoid some code duplication and enhance the documentation about
thread-safeness of QSQLDatabase::cloneDatabase()
Fixes: QTBUG-60505
Change-Id: I6ca6b9f47d818d49ca51395da14051e40317cef6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make QSqlError implicitly shared and adjust the ctors / assignment
operators to be consistent with other implicitly shared Qt classes.
Fixes: QTBUG-91912
Change-Id: Ie73292817fd4e7b274a3033a74d62e712a01c2b0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
[ChangeLog][SQL][SqlQuery] Added two new functions
boundValueName()/boundValueNames() to return the names of the bound
values.
Fixes: QTBUG-97847
Change-Id: I8df5f15e8df13141a34d38b0a2e13b37f4e7829c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
A QSqlError is not equal when the native error code differs. The
database and driver text should not be considered during the
comparison because they might differ due to e.g. different locales.
[ChangeLog][QtSql][QSqlError] The comparison operators have been fixed to
take both error type and error code into account.
Change-Id: Ie7511f183f88dd454eb165c6ff237e51b79d1c08
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>