summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate projects one last time before mergewip/cmakeAlexandru Croitor2020-02-1210-30/+19
| | | | | | Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-241-39/+36
|\ | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-101-39/+36
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
| | * tst_QSqlQuery: fix some testsChristian Ehrlicher2019-12-101-39/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix some tests in tst_QSqlQuery: - make sure to use QSql::HighPrecision in tst_QSqlQuery::precision() (needed for psql) - remove outdated stuff for mysql 3.x - psql_bindWithDoubleColonCastOperator: the placeholder are stored as named placeholders in psql - avoid some useless old-style casts Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-191-103/+12
|\| | | | | | | | | | | Change-Id: Ifecc2d9db396d783124df8567553ba5f846f30bb
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-251-14/+13
| |\| | | | | | | | | | Change-Id: Iebedaa967a263854f18cd403ce007d7965f26d2b
| | * Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-241-14/+13
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qstandardpaths_unix.cpp src/corelib/tools/qsharedpointer_impl.h tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: Iae95c5778dc091058f16f6db76f04a0178a9e809
| | | * QODBC: Fix crash when a prepared statement is deleted after the db was removedChristian Ehrlicher2019-10-151-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a prepared statement is still alive after the database was removed with QSqlDatabase::removeDatabase(), the cleanup routine is trying to access the driver which is no longer alive which results in a crash. Fixes: QTBUG-79019 Change-Id: I4630e3b947a12b23ed062f015abc373fc0e246c1 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-181-90/+0
| |\| | | | | | | | | | | | | | Change-Id: I4fbbf100b673ab100997dbf2f42bf195dc3c050f
| | * | tst_QSqlQuery: remove tests commented out a long time agoChristian Ehrlicher2019-10-161-90/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove some code which was commented out with 'NOT_READY_YET' since the initial Qt5 import. Since the mentioned bug reports are no longer available remove this code. Change-Id: I98686e53d85619f01d16105d147eba79b557a104 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Regenerate tests/auto/sqlAlexandru Croitor2019-11-1313-13/+136
| | | | | | | | | | | | | | | | | | | | Change-Id: If411b1e7c3a7cb58922e5a48309f42ba29f2c068 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-142-59/+24
|\| | | | | | | | | | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * | | QMYSQL: remove support for MySql 4.xChristian Ehrlicher2019-10-122-33/+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>
* | | Merge branch 'wip/qt6' into wip/cmakeAlexandru Croitor2019-08-153-20/+60
|\| | | | | | | | | | | Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
| * | test: migrate QSqlDatabase test to QRegularExpressionSamuel Gaist2019-07-292-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part of the migration of qtbase from QRexExp to QRegularExpression. Task-number: QTBUG-72587 Change-Id: Id82e103d4076fed63c871385b2b0f21c04735d00 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Make sql tests build and pass with disabled deprecated APIsSona Kurazyan2019-07-231-12/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecated APIs of sql lib are used only in tests. This change makes sure, that the tests build and pass with those deprecated APIs removed or disabled, by: - Making the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. - If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Task-number: QTBUG-76541 Change-Id: I93ed6ff92c7aa7af2c106b1a9d92d3704c7d9105 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Regenerate some of the test projects that do SUBDIRS += fooAlexandru Croitor2019-08-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This show cases the new cleaner subdirs handling code in pro2cmake. Change-Id: I25001942ef020e4c4191b355f55309c4fb033ecc Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-07-112-4/+5
|\| | | | | | | | | | | Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
| * | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | Convert uses of QTime as a timer to QElapsedTimerEdward Welbourne2019-06-141-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I2297f61efa5adf9ea5194c7f3ff68574cbcf452c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Merge commit 'dev' into 'wip/cmake-merge'Tobias Hunger2019-04-168-84/+155
|\| | | | | | | | | | | Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
| * | QSqlError: fix redundant space in text() outputVincas Dargis2019-03-261-0/+24
| |/ | | | | | | | | | | | | | | | | | | | | | | | | QSqlError::text() returns single space if QSqlError is not valid. In addition, it adds space in case one of driverText or databaseText is empty. Change condition upon which space is added between databaseText and driverText, and update unit test to cover these cases. Fixes: QTBUG-74575 Change-Id: I52cce9b0287a523d7ff9059cff38bcd8b26eb303 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-213-6/+7
| |\ | | | | | | | | | Change-Id: I830beea26863323ab78a5d4b093f7763d77ad3da
| | * Fix a couple of SQL testsAndy Shaw2019-02-193-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | One of the tests was not added to the parent subdirectory pro so this is also rectified. Change-Id: I270f1c2882260e3e3fac83d074ed6444c5dece19 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-081-0/+21
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/templates/AndroidManifest.xml src/network/ssl/qsslsocket_mac.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/corelib/kernel/qtimer/BLACKLIST tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp tests/auto/testlib/selftests/expected_blacklisted.lightxml tests/auto/testlib/selftests/expected_blacklisted.tap tests/auto/testlib/selftests/expected_blacklisted.teamcity tests/auto/testlib/selftests/expected_blacklisted.txt tests/auto/testlib/selftests/expected_blacklisted.xml tests/auto/testlib/selftests/expected_blacklisted.xunitxml tests/auto/testlib/selftests/expected_float.tap tests/auto/testlib/selftests/expected_float.teamcity tests/auto/testlib/selftests/expected_float.txt tests/auto/testlib/selftests/expected_float.xunitxml Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: If93cc432a56ae3ac1b6533d0028e4dc497415a52
| | * Replace executedQuery when executing a new queryJesus Fernandez2019-01-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the first successful query was stored in the variable. When a new query is executed the function QSqlResult::setActive was not replacing the last executed query. Fixes: QTBUG-28883 Change-Id: Ib4938c42e6264f9edd0764b4a392da7988f68fc0 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * | Always escape the table names when creating the SQL statementAndy Shaw2019-01-235-77/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since some databases are case sensitive if part of the query is quoted, then we should ensure that all instances of the table name are escaped unless the test is delibrately testing the non-escaped case. As a result, this commit also removes some expected failures pertaining to PostgreSQL and also adds an entry to the list of tables being dropped when a test is finished. [ChangeLog][Sql][PostgreSQL] QSqlDatabase is now stricter about table names when used with record() and primaryIndex(). If the tablename was not quoted when it was created, then the table name passed to record() and primaryIndex() needs to be in lower case so that PostgreSQL is able to find it. Fixes: QTBUG-65788 Change-Id: Id1f54cb66b761c39edf858501b730ede7eec1fd3 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Add overload of QSqlDatabase::cloneDatabase to allow cloning cross threadsAndy Shaw2018-12-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since QSqlDatabase::database() cannot be used to access another database from another thread, then the overload is provided to make it possible to clone with just the connection name. This will handle the cloning internally safely then. Fixes: QTBUG-72545 Change-Id: I861cc5aa2c38c1e3797f6f086594a1228f05bada Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-061-1/+8
| |\| | | | | | | | | | Change-Id: Id1e4664d3c942226b76e2c3b338df3116ff89297
| | * QSqlQuery: add another testcase for bindBool()Christian Ehrlicher2018-11-021-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tst_QSqlQuery::bindBool() did not check if the bool is correctly bound as part of the WHERE statement. Add a new test to query for the bool column and check if there is exactly one row returned. Fixes: QTBUG-38891 Change-Id: I0bd1ceb1b30e50f67f44f5b06d68683195b78b29 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | | Add Sql build and testsTobias Hunger2018-11-0516-0/+84
|/ / | | | | | | | | | | Change-Id: I9bf7d61a65950eafcfe6b3ea9c437e353ff7b2ed Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* / SQLite: enable json1 extensionChristian Ehrlicher2018-10-031-0/+27
|/ | | | | | | | | | | | This patch enabled json1 support for sqlite3 by defining SQLITE_ENABLE_JSON1 [ChangeLog][QtSql][SQLite] Enable the json1-extension for the SQLite3 plugin Task-number: QTBUG-63498 Change-Id: Iaf1069ff1396c573125a5a3f490c0df5df560468 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-141-0/+18
|\ | | | | | | Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
| * sqlite: Fix QSqlError handling when opening/closing databaseFlorian Bruhin2018-09-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both sqlite3_open_v2 and sqlite3_close are documented to return an error code: https://www.sqlite.org/c3ref/open.html https://sqlite.org/c3ref/close.html However, those were ignored (other than checking whether the operation succeeded), causing QSqlError::nativeErrorCode() to always be "-1" when there was an error while opening/closing the database. Additionally, the error string needs to be read (via sqlite3_errmsg16) in qMakeError *before* d->access is set to 0, or the databaseText() will always be "out of memory" no matter what error actually happened. Task-number: QTBUG-70506 Change-Id: I75cbf178c9711442e640afd26c4502214d20c598 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | SQL PostgreSQL/SQlite: Properly decode default varchar parameterChristian Ehrlicher2018-09-121-2/+18
| | | | | | | | | | | | | | | | | | The default values for varchar columns were not decoded properly. Task-number: QTBUG-46968 Change-Id: Ie13d48c316cd694240f7e287010b97afc8c6c341 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Initialize the QSqlQuery to be invalid when creating a sql modelAndy Shaw2018-08-281-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QSqlQueryModel or QSqlTableModel is created it will create a QSqlQuery which defaults to using the default QSqlDatabase connection. If this connection belongs to another thread then it will throw a warning as this is not safe to use. Since the QSqlQuery is always recreated when a query is set, the instance which is a member of the class can effectively be invalid until a new one is set. Task-number: QTBUG-69213 Change-Id: I68a5dd59fe62788f531d59a0680da11b118ee383 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | prune cargo-culted and obsolete winsock deps from autotestsOswald Buddenhagen2018-07-191-2/+0
| | | | | | | | | | Change-Id: I9666598d34e965d7058aeb2b2e7fb3f59600675c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | tst_QSqlThread: match #if-ery on declaration to useEdward Welbourne2018-07-051-0/+2
| | | | | | | | | | | | | | | | | | Variable was declared outside #if-ery but only used inside, leading to warnings when the define wasn't set. Change-Id: Iad6a236bdf76b8ca0a58a84509d19f7e1a3e2df2 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | MySQL: Handle TIME types as a string to allow the full range of dataAndy Shaw2018-06-061-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the full range of TIME is '-838:59:59' to '838:59:59' then we cannot use QTime as the object to store this data in. Therefore a QString is used instead for passing the data to and from. This does not impact existing code using QTime already as it will still convert it from the QString to a QTime to give the same result as before. [ChangeLog][QtSql][MySQL] The TIME data type is now treated like a string-based type in order to respect the full range of the TIME data type. Task-number: QTBUG-57028 Change-Id: Ieb7105bff3043b845f76bc873d088e6bac1e4f10 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Show the display role inside the editor for the relation in a QComboBoxAndy Shaw2018-05-292-0/+175
|/ | | | | | | | | | | | | | | When a QComboBox is used as the editor for a relation inside a view then it could end up showing the contents of the EditRole. This would be the field which is used to represent the entry as opposed to the DisplayRole which is what the user would expect to see is. Therefore, setEditorData() is overridden to ensure that it is showing the right data to the user. When the model gets updated, it will take the corresponding EditRole value as before to ensure it is updated correctly. Task-number: QTBUG-59632 Change-Id: Ibbccc3e9477de1cdefb654051b97dd111df36382 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* Remove a reference to a no longer used database serverAndy Shaw2018-05-161-2/+0
| | | | | | Task-number: QTBUG-32390 Change-Id: I7556507267be04ca50c4ad0c7d49f3aa5fe31a90 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* sqlite: Allow for duplicated placeholders with just one placeholderAndy Shaw2018-05-161-0/+10
| | | | | | | | | | This accounts for a case of a placeholder being duplicated in the prepare query, but where only one placeholder was used. This amends e4e87a2ece1e0c9901514fea094f31863b64b570 Task-number: QTBUG-68299 Change-Id: Ia92ee912facd51a13e7222886debb219b24442b0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* oci: Use OCIBindByPos2 to accommodate data longer than USHRT_MAXAndy Shaw2018-04-061-0/+24
| | | | | | | | OCIBindByPos2 is only needed when using execBatch(), binding data that is longer than USHRT_MAX works for exec() so this is left unchanged. Change-Id: Ifdcf91939d184f225d24c13052ea0b81611ecf91 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QSqlDatabase: Skip confusing thread warning on invalid QSqlDatabaseDavid Faure2018-04-061-0/+3
| | | | | | | | | If the db isn't valid, then that's the actual issue, not the fact that we're getting the same invalid db (with the same driver QSqlNullDriver) in multiple threads. Change-Id: I95490818ed78e741c3823e115f139c2cff01b0b1 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* sqlite: Support using execBatch() with duplicated named placeholdersAndy Shaw2018-03-271-58/+84
| | | | | | | | | | | | | | | Also expands the tst_qsqlquery::batchExec() test to account for this case and generally test the functionality. In addition it is made to be more robust to avoid any discrepencies with the testing data. The test in general is also cleaned up to enable more of it being tested with the different database drivers where possible. An expected fail is added for MySQL due to the fact that it has a bug where null timestamp entries are being converted to the current datetime when adding it as a bind value. Change-Id: I0061bd1c69ae35b4858afc49420f13ce59cf48ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* MySQL: Fix testsAndy Shaw2018-03-172-9/+9
| | | | | | | | | | | | | This fixes the following: - tst_QSqlDatabase::recordMySQL() to account for performance improvements done for small integral types - tst_QSqlQuery::nextResult() so that NUMERIC results are seen as doubles - tst_QSqlQuery::timeStampParsing() so that MySQL accepts the CREATE TABLE statement Change-Id: I68fb1d06dac12d500bb4596463f5bdd65cc9c226 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* sqlite: Prevent a crash when sqlite does not detect any parametersAndy Shaw2018-03-171-0/+41
| | | | | | | | | | | | When using a virtual table inside a SQLite database it is possible that it does not report the right number of parameters. Therefore we need to account for this case to prevent it from crashing when trying to bind parameters it thinks does not exist. Task-number: QTBUG-66816 Change-Id: I3ff70bb1fe73091f43c3df53616f75858e451cfd Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* SQL/Postgres: Fix support for nan, inf and -infChristian Ehrlicher2018-03-071-0/+42
| | | | | | | | | | | Postgresql needs a special value for nan and +/- inf. This was considered during insert but not during select. Also remove some pre-c++11 inf/nan - handling and replace it with Qt equivalents. Change-Id: I044ca58e9cf673f4b100b05a0d8e25c8a9c29ec5 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* psql: Add expected failures where the table name is case sensitiveAndy Shaw2018-02-213-2/+16
| | | | | | | | | | Currently there is a bug in Qt regarding the PostgreSQL driver as it does not correctly escape the table names when constructing queries internally. Therefore, these tests are marked as expected failures until the bug itself is fixed in Qt. Change-Id: I74dadc187f8a08509128dfea27be99787e57ea51 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>