summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql
Commit message (Collapse)AuthorAgeFilesLines
* QSqlDatabase: add moveToThread()/currentThread()Christian Ehrlicher45 hours1-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>
* CMake: Make a few more auto tests standaloneAlexandru Croitor2024-03-141-0/+6
| | | | | | Pick-to: 6.7 Change-Id: I80988114bd906447a2ab712d5432a489e095a5c1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* SQL/MySQL: retrieve default column value for QSqlDatabase::record()Christian Ehrlicher2024-03-101-2/+9
| | | | | | | | | | 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>
* Change license for tests filesLucie Gérard2024-02-0417-17/+17
| | | | | | | | | | | | 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: rename enablePositionalBinding() to setPositionalBindingEnabled()Christian Ehrlicher2024-01-101-3/+5
| | | | | | | | | | | | | | | ... 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>
* SQLite: Handle identifiers correctlyPo-Hao Su2023-09-281-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change can be described in the following 2 categories: 1. Support 3 ways to escape identifiers mentioned in SQLite Keywords In SQLite Keywords (https://sqlite.org/lang_keywords.html), it shows that there are 3 ways to escape identifiers, i.e., "", [], ``. So, I have overridden "bool isIdentifierEscaped(const QString &, IdentifierType)" to support it. In addition, there was a bug of _q_escapeIdentifier. If there is a field name called length [cm], which uses square brackets to show units, _q_escapeIdentifier will not escape it to "length [cm]". 2. Identify identifiers correctly if identifiers have been escaped There is a bug of QSQLiteDriver::record and QSQLiteDriver::primaryIndex. If we input escaped identifiers with separator, let's say "databaseName"."tableName", both will change the input into databaseName"."tableName, which is incorrect and causes qGetTableInfo cannot get the right results. In addition, I overrode stripDelimiters to strip "databaseName"."tableName" correctly. There are still some assumptions for isIdentifierEscaped, escapeIdentifier, and stripDelimiters, but I think this change it better than what we have now. 1. For isIdentifierEscaped, if identifiers have a dot and the dot is a separator, it is the users' responsibility to escape the pair of schema and table name correctly. For example, "aSchemaName"."aTableName", not "aSchemaName".a"TableName". That's because we don't know whether the dot is just a dot of the name or a separator. 2. For escapeIdentifier, if identifiers have a dot and the parts before and after the dot are not escaped, escapeIdentifier will treat the dot as part of the table name or field name. The same as the item above, it is users' responsibility to do it right. 3. For stripDelimiters, the same as above, it is users' responsibility to do escape if users want to use format schemaName.tableName or tableName.fieldName. Change-Id: I9d036a2a96180f8542436188f75a220a0fe58257 Reviewed-by: Po-Hao Su <supohaosu@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* tst_qvfssql: Don't use appless mainIevgenii Meshcheriakov2023-08-111-1/+1
| | | | | | | | | | | QSqlDatabase uses a Q_APPLICATION_GLOBAL and so should not be used without QCoreApplication instance. The test crashes if the existence of an application instance is asserted in Q_APPLICATION_GLOBAL code. Pick-to: 6.6 Change-Id: Iaa3f4dff7b2722257735680dd3885aeed0ac810b Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/PSQL: Handle jsonb operators in prepared queriesChristian Ehrlicher2023-07-231-0/+82
| | | | | | | | | | | | 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>
* SQL/SQLite: add case folding for non-ascii charactersChristian Ehrlicher2023-07-082-2/+17
| | | | | | | | | | | | | 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-0514-0/+84
| | | | | | | | | | | | | | | | | 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>
* Say hello to QtVFS for SQLite3BogDan Vatra2023-07-024-0/+119
| | | | | | | | | | | | | | | 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>
* SQL: Make QSqlDatabase::DriverDict creation thread-safeChristian Ehrlicher2023-05-241-0/+4
| | | | | | | | | | 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>
* QSqlField: add move ctor & move operatorChristian Ehrlicher2023-04-261-0/+20
| | | | | | | | Add the move ctor and move operator for QSqlField Task-number: QTBUG-109938 Change-Id: Ib66eff76c3a920de9cfb3288f4219555005e7ae5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* SQL/Tests: make sure created procedures are cleaned up on exitChristian Ehrlicher2023-04-153-78/+71
| | | | | | | | | 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>
* Put timezone related code under ifdefTatiana Borisova2023-04-141-3/+7
| | | | | | | In case FEATURE_timezone=OFF auto-tests should still be built successfully Change-Id: I0226a7d7781a412bf9e9935c2cf1a48b1ce427b5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* SQL/Tests: use TableScope where possibleChristian Ehrlicher2023-04-074-319/+242
| | | | | | | | 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: Always escape the table names when creating the SQL statementChristian Ehrlicher2023-04-071-2/+2
| | | | | | | | | Sync the IBASE driver behavior for primaryIndex() and record() with the rest by assuming that the given table name has the correct casing. Change the tests for these two function to pass an unescaped table name. Change-Id: I6d96359f97e1acc6970b9a22fdf0e968a616b7bc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlQuery: add boundValueName()/boundValueNames()Christian Ehrlicher2023-04-071-0/+6
| | | | | | | | | | [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>
* SQL/QSqlRelationalTableModel escape the auto-generated aliasChristian Ehrlicher2023-04-061-137/+94
| | | | | | | | | | | | The alias created by QSqlRelationTableModel to avoid duplicated field names was not escaped which lead to an inconsistency in the returned alias name from the database (e.g. postgres lowers all unescaped column names). Also adjust the test for QSqlRelationTableModel to use escaped table names for it's tests and fix it for QIBASE. Change-Id: I01426320c0c1a70cb9bf8e6dfa2f8b07dbb1c06b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/tests: Add testcase for QODBC toSQLTCHAR()Christian Ehrlicher2023-04-031-0/+19
| | | | | | | | | | Add a testcase for toSQLTCHAR() to make sure to pass the correct number of encoded characters to the odbc functions. Pick-to: 6.5 Task-number: QTBUG-112375 Change-Id: Ib67fab678fc3d0b098aedfc6fa9ec2139f2e75c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSqlError: also compare nativeErrorCode() in operator==() / operator!=()Christian Ehrlicher2023-04-031-3/+7
| | | | | | | | | | | | 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>
* QSqlIndex: add move ctor & move operatorChristian Ehrlicher2023-03-313-0/+142
| | | | | | | | | 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/IBASE: Time Zone support (firebird 4.x)Andreas Bacher2023-03-242-0/+126
| | | | | | | | | | 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-172-124/+84
| | | | | | | | | 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-173-24/+31
| | | | | | | 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/MySQL: Add support for Bit-Value Type - BITChristian Ehrlicher2023-03-121-0/+7
| | | | | | | | | | | | Add support for MYSQL_TYPE_BIT. Since the bitfield can be max 64bits, store it in a uint64_t. Writing such a value as MYSQL_TYPE_LONGLONG works as expected but receiving it needs a special handling. [ChangeLog][SQL][MySQL] Added handling for Bit-Value Type - BIT. Fixes: QTBUG-21326 Change-Id: Id20e3316caf6703b3bec8a828144494a20693fd8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/Tests: remove safeDropTable() / add helper classChristian Ehrlicher2023-03-125-157/+150
| | | | | | | | | | 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-096-59/+42
| | | | | | | And fix coding style a little bit around the change. Change-Id: Idfc232a751ccc08d0680351d48d4a68f09f18c1f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlDatabase: deprecate QSqlDatabase::exec()Christian Ehrlicher2023-03-063-16/+23
| | | | | | | | 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>
* SQL/Tests: remove some unused functionsChristian Ehrlicher2023-03-066-81/+42
| | | | | | | | | 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-022-2/+8
| | | | | | | | 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-202-174/+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-205-27/+56
| | | | | | | | | | | | | | | | | 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-1716-32/+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 tests: Fix for PostgreSQL 12 and aboveChristian Ehrlicher2023-01-201-1/+1
| | | | | | | | | | | The 'WITH OIDS' was deprecated some time ago and removed with PostgreSQL 12 so we have to adjust our test table creations. Don't know why it was used in the first place at all. Pick-to: 6.2 6.4 6.5 Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSqlRecord: add missing C++11 move SMFsMarc Mutz2023-01-131-0/+20
| | | | | | | | | | [ChangeLog][QtSql][QSqlRecord] Added move constructor, -assignment operator, and swap(). Task-number: QTBUG-109938 Change-Id: I54f2666defbf56f5ba2faea6358722ebd7cac157 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* tst_QSqlRecord: replace manual memory management with unique_ptrMarc Mutz2023-01-091-49/+20
| | | | | | | | | | Also replace the C array with a std::array and (some) indexed loops with ranged-for loops. Most loops need the index in one way of another, so can't easily be converted to ranged. Pick-to: 6.5 6.4 6.2 Change-Id: I7fa05f22de9df6c68ec5797c9583476a3881532c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* 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-224-127/+50
| | | | | | | | | | 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>
* Adapt to QTimeZone replacing Qt::TimeSpec usageEdward Welbourne2022-12-101-4/+7
| | | | | | | | | | | | In the process actually handle all time-spec cases in various places that only handled UTC or LocalTime, or at least note that they don't where that's not practical. Also tidy up header ordering and ensure QDateTime's header is included wherever it's used, while adding the include for QTimeZone where needed. Task-number: QTBUG-108199 Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* SQL/MySQL: fix handling of json columnChristian Ehrlicher2022-12-051-0/+40
| | | | | | | | | | | Add handling for MYSQL_TYPE_JSON by treating it the same as MYSQL_TYPE_BLOB (which is used by current MariaDB Server for a json column) Pick-to: 5.15 6.2 6.4 Fixes: QTBUG-101680 Change-Id: I4d4b0cdad73cd12e0db4df4021fddbd6a649c8ed Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-038-50/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-162-4/+20
| | | | | | | | | 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 qAsConst() to std::as_const()Marc Mutz2022-10-111-4/+4
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-045-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>