summaryrefslogtreecommitdiffstats
path: root/src/sql/kernel
Commit message (Collapse)AuthorAgeFilesLines
* SQL/QSqlIndex: remove unused private function createField()Christian Ehrlicher9 days2-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 Ehrlicher10 days2-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 Belyavsky14 days1-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>
* 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>
* 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>
* 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-214-14/+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>
* 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>
* 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>
* 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>
* QSqlResult: remove bad API returning non-const referenceVolker Hilsheimer2023-06-212-4/+23
| | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* QSqlField: add move ctor & move operatorChristian Ehrlicher2023-04-262-37/+17
| | | | | | | | Add the move ctor and move operator for QSqlField Task-number: QTBUG-109938 Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSqlRecord: use QSharedData for private classChristian Ehrlicher2023-04-262-25/+12
| | | | | | | Use QSharedData for the private class instead a home-brew version. Change-Id: Id3625bb0eb8f81c9caa672e2453dab3d44b15ea9 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSQLDatabase: avoid some code duplicationChristian Ehrlicher2023-04-141-15/+11
| | | | | | | | | 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>
* QSqlError: Make QSqlErrorPrivate implicitly sharedChristian Ehrlicher2023-04-122-23/+12
| | | | | | | | | 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>
* QSqlQuery: add boundValueName()/boundValueNames()Christian Ehrlicher2023-04-074-2/+51
| | | | | | | | | | [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>
* QSqlError: also compare nativeErrorCode() in operator==() / operator!=()Christian Ehrlicher2023-04-031-4/+8
| | | | | | | | | | | | 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>
* QSqlError: misc cleanupChristian Ehrlicher2023-04-012-10/+10
| | | | | | | | | - fix formatting for qsqlerror.cpp/.h - replace a size() == 1 "x"_L1 with u'x' Pick-to: 6.5 Change-Id: I74c92f27be4345737fcfc73368f834a2f7920808 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSqlIndex: add move ctor & move operatorChristian Ehrlicher2023-03-312-0/+24
| | | | | | | | | Add the move ctor and move operator for QSqlIndex, also add an explicit testcase for QSqlIndex Task-number: QTBUG-109938 Change-Id: I46cc6a24c2e7d5b23d2ac3427cafd01b9ba257ed Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* SQL/SQLDatabase: do not copy q within QSqlDatabasePrivate::copy()Christian Ehrlicher2023-03-161-9/+5
| | | | | | | | | | Copying the QSqlDatabase pointer inside QSqlDatabasePrivate::copy() is not a good idea since it must point to the owning instance and not another one. Since it's not used anywhere we can safely remove it. Change-Id: Ie45b594305059afd9b8d8b25d4864dd77769acf7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/ODBC: Return all native error codesChristian Ehrlicher2023-03-071-3/+3
| | | | | | | | | | | | | | ODBC can (similar to DB2) return more than one native error code for an error but only the last one was recorded which may made the error diagnostic more complicated. Therefore return a concatenated list of native error codes the way it's done for DB2. [ChangeLog][SQL][ODBC] QSqlError::errorCode() might return a semicolon separated list of native error codes. Fixes: QTBUG-45087 Change-Id: I70d02adeb33e72897f13e0c72fbbd2c60f307e2f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlDatabase: deprecate QSqlDatabase::exec()Christian Ehrlicher2023-03-062-4/+6
| | | | | | | | The note that QSqlDatabase::exec() is deprecated was added more than 12 years ago so it's time to also mark the function as such. Change-Id: Ic5e7c31b3ff5b21e16e2640548cba1a4baaeeb1c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* A QtSql driver for Mimer SQLFredrik Ålund2023-02-203-1/+9
| | | | | | | | | | | | | | | | | The QtSql for Mimer SQL sqldriver makes it possible to work with the Mimer SQL database on different plattforms. There are drivers for several other databases in QtSql and a driver for Mimer SQL will benefit many users. To build the Mimer SQL driver, download Mimer SQL from https://developer.mimer.com [ChangeLog][QtSql] Added a QtSql plugin to work with the Mimer SQL database Fixes: QTBUG-111219 Change-Id: Id6ba5de4de01189d0516ffbfa89efcb0d013115f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix usages of deleted QVariant constructorsSze Howe Koh2023-01-252-3/+3
| | | | | | | | Finish the job started at 879d30394a41b7b7124fc8139e787a9bdbe0dfee Pick-to: 6.5 6.4 6.2 Change-Id: I217a4830ac8e17d5d1f8900e2d3134fbabf8b9a2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* SQL: use qsizetype and range-based for loops where possibleChristian Ehrlicher2023-01-206-50/+45
| | | | | | | | Some public functions are still using int instead qsizetype which can't be changed until Qt7. Change-Id: Ib6f210c344acce9f3836e8a5493a741eb8b2b385 Reviewed-by: Marc Mutz <marc.mutz@qt.io>