summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql/kernel/qsqldatabase
Commit message (Collapse)AuthorAgeFilesLines
* QSqlDatabase: make evident the name of the driver that failed to loadThiago Macieira2025-04-141-2/+3
| | | | | | | | | | | | | | Tell me this isn't confusing: Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB") QSqlDatabase: driver not loaded QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 This also merges the two messages into a single line, which is nicer for rich logging environments. Pick-to: 6.8 6.9 Change-Id: Ieb80c6571213dddc518bfffdb6c86632df8f932c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Tests: Reduce the number of module includesFriedemann Kleint2024-11-041-19/+16
| | | | | | | | | They are an unnecessary hit on build time. Rewrite the tests using the standard Qt conventions. Pick-to: 6.8 Change-Id: Iac47e62c58b1805c3b4a0ac4f4b3db206c66cc65 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Tests/QSqlQuery: misc fixes for MsSQL ODBC ServerChristian Ehrlicher2024-07-041-0/+2
| | | | | | | | This fixes some tests for MsSQL Server. Pick-to: 6.8 Change-Id: I38b1ce5c8761706cafe63a4969770104e8b07bfe Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QSqlDatabase: Rename currentThread() to thread()Christian Ehrlicher2024-05-311-6/+6
| | | | | | | | ... to be in sync with QObject naming. This amends b4c63b89dfe136d0579bf1b6422c4d878cdd74ab. Change-Id: I25301f65aa880205d8c0cfd6f4bfa9fdba34a01c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL tests: Fix dropping procedures Firebird/IBaseChristian Ehrlicher2024-05-081-1/+4
| | | | | | | | | Firebird can not handle 'DROP PROCEDURE IF EXISTS' - need to call it unconditional without 'IF EXISTS'. Pick-to: 6.7 6.5 Change-Id: I530bcc2c756eed680a6fdaf27b3e3a0715f96bd4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QSqlDatabase: add moveToThread()/currentThread()Christian Ehrlicher2024-04-251-0/+29
| | | | | | | | | | | | | 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>
* Change license for tests filesLucie Gérard2024-02-042-2/+2
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/SQLite: add case folding for non-ascii charactersChristian Ehrlicher2023-07-081-1/+3
| | | | | | | | | | | | | 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>
* CMake: Make qtbase tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I77299f990692b4fe4721a9bc35071608d0d23982 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* SQL/Tests: make sure created procedures are cleaned up on exitChristian Ehrlicher2023-04-152-22/+42
| | | | | | | | | Similar to TableScope - create a helper class to make sure the procedures are cleaned up on exit so they don't affect the result during the next test run. Change-Id: Ic5b02ca63e03f330392797ed22313767557fc548 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: use TableScope where possibleChristian Ehrlicher2023-04-071-99/+77
| | | | | | | | Use TableScope helper class to make sure the table used for the test is really cleaned up before usage. Change-Id: I45fffcd13acae6032636ae07097b14af174ede21 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtSql: don't use deprecated QSqlDatabase::exec in testVolker Hilsheimer2023-04-071-1/+2
| | | | | Change-Id: Id9e88eb874ce70c3dea6ddb0a324e589965ff9d9 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/IBASE: Time Zone support (firebird 4.x)Andreas Bacher2023-03-241-0/+13
| | | | | | | | | | Add support for time zones in the IBASE driver, which was introduced in firebird 4.x. TIMESTAMP WITH TIME ZONE data type is supported in order to store and retrieve a QDateTime with the time zone. Task-number: QTBUG-111879 Change-Id: I631b4262d17796a17630379b7d659f88244a23ad Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/Tests: Cleanup of tst_databases.hChristian Ehrlicher2023-03-171-106/+73
| | | | | | | | | Cleanup tst_databases.h: fix identation, replace qGetHostName() with QSysInfo::machineHostName(), use QSqlTableModel::EditStrategy instead int for submitpolicy data to avoid casts. Change-Id: I4917ca23c4b39ab15bc0e006e6111baefb82d278 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/IBASE: fix testsChristian Ehrlicher2023-03-171-20/+27
| | | | | | | Fix some tests so they will correctly work with Interbase (Firebird 3.x) Change-Id: Ib3c8ceaf31fa01af3a00a9772350b49cee8b2342 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/OCI: add maximumIdentifierLength()Christian Ehrlicher2023-03-171-8/+5
| | | | | | | | A table name or identifier must not be longer than 30 (< Oracle 12.2) or 128 bytes (sadly not characters). Change-Id: I49192afaf908e12f5cfd20c754640b6117b03a71 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: Cleanup tst_QSqlDatabaseChristian Ehrlicher2023-03-171-35/+16
| | | | | | | | Remove driverQuotedCaseSensitive() as it's no longer needed, fix view creation for PostgreSQL. Change-Id: I72437252cfad762a5a245475d6652de3c7b5ef46 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: remove safeDropTable() / add helper classChristian Ehrlicher2023-03-122-38/+52
| | | | | | | | | | Add a helper class which makes sure that the used table does not exist before usage (e.g. due to leftovers from previous tests) and is properly cleaned up on exit. This also allows to remove all usages of safeDropTable(). Change-Id: Iefeffbd10e2f2f67985183ea822d7b6dd2b80be7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: remove usage of 'foreach'Christian Ehrlicher2023-03-091-32/+29
| | | | | | | And fix coding style a little bit around the change. Change-Id: Idfc232a751ccc08d0680351d48d4a68f09f18c1f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: remove some unused functionsChristian Ehrlicher2023-03-062-32/+0
| | | | | | | | | remove toHex() as it's not used at all and qTableName() with two params. Also remove some SQLite 2 specific stuff Change-Id: If285febdfbee5833f7174d70f386bd54674bd539 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QSqlDatabase: avoid some runtime warningsChristian Ehrlicher2023-03-021-2/+7
| | | | | | | | Make sure to properly close the cloned database connections and allow one test for sqlite Change-Id: Ia4eb4a684a3c432844e4b2a77bff69655b53f9b2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL tests: remove unused testsChristian Ehrlicher2023-02-201-71/+0
| | | | | | | They were leftovers from QTDS driver removed with Qt6 Change-Id: I34863912bd41e0b4ca54bf443001f1cb3f20511a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* A QtSql driver for Mimer SQLFredrik Ålund2023-02-202-5/+4
| | | | | | | | | | | | | | | | | 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>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-171-2/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* SQL: more documentation and test cleanupsChristian Ehrlicher2023-01-061-27/+0
| | | | | | | | Remove some stuff no longer supported and refine others. Pick-to: 6.5 Change-Id: I29730d5acfcf4a7ef3f569f101d3a4f72dd8b3aa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL: remove unneeded test functionsChristian Ehrlicher2022-12-222-103/+31
| | | | | | | | | | testWhiteSpaceNames() returns true for all current database drivers so it's useless and can be removed. safeDropView() and getPSQLVersion() is not called anywhere, getMySqlVersion() is only used for a check for a MySql version we no longer support. Change-Id: I8d02f17f475821e81d309ee96897e772cdfb895d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-032-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* SQL/Tests: fix tst_qsqldatabase::caseSensivity() for MySQL on linuxChristian Ehrlicher2022-10-241-10/+17
| | | | | | | | | | MySQL has a different default setting for case sensitive table names on linux and windows which makes the test fail on linux but work on windows when using the database with the default settings. Read out the respecitive setting so the test will pass every time. Change-Id: I8651858d47652022ddc4b6386a6153cf70c6fed6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QSql*/sqlite: Don't use random output in the datatagsMårten Nordheim2022-10-181-1/+9
| | | | | | | | | | | | | It makes it impossible to rerun it, bad for both CI and local test runs. As a drive-by name the database file sqlite.db instead of foo.db Pick-to: 6.2 6.4 Fixes: QTBUG-100245 Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/tests: fix tst_qsqlqueryChristian Ehrlicher2022-10-161-0/+16
| | | | | | | | | Fix two tests which got broken due to the latest changes without notifying because those tests are not run automatically. Change-Id: Ibe9d9601f0a2ad4ce8f06ca21e7503e77fa55781 Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-281-1/+1
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-162-54/+4
| | | | | | | | | | | | | 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>
* Sql ODBC driver: add direct support for float and short datatypeChristian Ehrlicher2021-01-101-0/+37
| | | | | | | | | | | | | This patch adds native support for SQL_REAL (float) and SQL_SMALLINT (short). Previously those datatypes were mapped to double and integer. [ChangeLog][QtSql] The ODBC driver now properly maps QMetaType::Float to real sql datatype and QMetaType::Short to smallint Fixes: QTBUG-8963 Fixes: QTBUG-57279 Change-Id: Ifec4c609734dbe6165c1ebdadb461c2aae47ba78 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* PSQL: Fix the QSqlDatabase testAndy Shaw2021-01-071-5/+15
| | | | | | Pick-to: 6.0 5.15 Change-Id: Ic7956b556f1f0f10574fd79f5cbd283208240353 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Remove the qmake project filesJoerg Bornemann2021-01-071-5/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-222-2/+7
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cleanup remaining QVariant::Type uses in Qt SqlLars Knoll2020-10-171-146/+146
| | | | | Change-Id: Ibcaa678cd9f9c957392a75b477fa6821f9a69127 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Interbase: Add support for the boolean typeAndy Shaw2020-09-111-0/+1
| | | | | | | | | | | | | This is added to Interbase in v7 and Firebird in v3 which has been available for sometime now. This means the minimum supported for Interbase is now v7. [ChangeLog][QtSQL][Interbase] The minimum required version for Interbase is now v7. Fixes: QTBUG-83401 Change-Id: I9927fd962f25c935be8ed5d2b7c76c00fb88cd8c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Interbase: Fix tests when running against FirebirdAndy Shaw2020-08-232-18/+41
| | | | | Change-Id: Ibfcf6b557aed3b0cd2e0ece5cf122819a1acc0c1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate QVariant::Type uses in QSqlFieldLars Knoll2020-08-151-33/+33
| | | | | | | | 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>
* CMake: Regenerate tests with new qt_ prefixed APIsAlexandru Croitor2020-07-091-1/+1
| | | | | | | | Use pro2cmake with '--api-version 2' to force regenerate projects to use the new prefixed qt_foo APIs. Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Regenerate projects one last time before mergewip/cmakeAlexandru Croitor2020-02-121-3/+2
| | | | | | Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Regenerate tests/auto/sqlAlexandru Croitor2019-11-131-1/+10
| | | | | Change-Id: If411b1e7c3a7cb58922e5a48309f42ba29f2c068 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-38/+24
|\ | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * QMYSQL: remove support for MySql 4.xChristian Ehrlicher2019-10-121-12/+0
| | | | | | | | | | | | | | | | | | | | | | MySql 5.0 was released 2005 so it's time to remove support for MySql 4.x 14 years later. [ChangeLog][QtSql][QMYSQL] Removed support for MySql < 5.0 since 5.0 was released 14 years ago. Change-Id: I45005accdffefbd9338ac0e710512a4c7ea8e09e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * QSqlDriver: deprecate one-arg notification() signalChristian Ehrlicher2019-09-211-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>