summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
Commit message (Collapse)AuthorAgeFilesLines
...
* SQL/ODBC: use SQL_SUCCEEDED(r)Christian Ehrlicher2024-03-021-33/+33
| | | | | | | | Use SQL_SUCCEEDED(r) instead checking for SQL_SUCCESS and SQL_SUCCESS_WITH_INFO separately on every return. Change-Id: Ic5c0e7d13b4ce117a23bbee9311980146b13ba4d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/ODBC: Add helper class SqlStmtHandleChristian Ehrlicher2024-03-021-68/+68
| | | | | | | | | | Add RAII SqlStmtHandle helper class to make sure the statement handle is properly cleaned up also on early exit. Pick-to: 6.7 Change-Id: I7aba4472be1e2991f395eeb7e43f8dd272336694 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/ODBC: Don't assert when no error record is availableChristian Ehrlicher2024-02-291-0/+2
| | | | | | | | | | | | | | When SQLGetDiagRec() does not return an record, the list of DiagRecords might be empty. This will create an assertion when trying to access QList::front() or similar. Therefore we need to check if the list is empty before accessing it. This amends 4ec5c0efc756a39162b43367438fee965c229ae7 Fixes: QTBUG-122073 Pick-to: 6.7 6.6 Change-Id: I6f421d82f9b6fdf84672d755cbbe8d2adec13266 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/SQLite: handle option SQLITE_OPEN_NOFOLLOWChristian Ehrlicher2024-02-261-0/+12
| | | | | | | | | | | | | Since SQLite 3.31 there is a new open() option SQLITE_OPEN_NOFOLLOW to disallow a filename with a symlink for security reason. Expose this option to QSQLite via QSQLITE_OPEN_NOFOLLOW. [ChangeLog][SQL][SQLite] Add new option QSQLITE_OPEN_NOFOLLOW to expose open mode SQLITE_OPEN_NOFOLLOW. Pick-to: 6.7 Change-Id: I2d6218bde2bf8b4f1bc36125dffa551b52369072 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/ODBC: Remove code duplication - merge SQLFetch/SQLFetchScrollChristian Ehrlicher2024-02-091-41/+14
| | | | | | | | | ... into an own function instead doing the check if fetchScroll is available in every function. Pick-to: 6.7 Change-Id: I8c8a1c8693f667ddf89a660b733e31505427073a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/ODBC: avoid code duplicationChristian Ehrlicher2024-02-091-40/+20
| | | | | | | | | ... by moving the adjustment for the table/schema/catalog name into splitTableQualifier(). Pick-to: 6.7 Change-Id: Ia392b1c2e7f29e63ea88c21492f2116eac573b5e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/ODBC: remove unneeded qMakeFieldInfo(... QString *errMsg)Christian Ehrlicher2024-02-091-19/+7
| | | | | | | | | This function can be merged with the other overload of qMakeFieldInfo() because no-one uses it except qMakeFieldInfo() itself. Pick-to: 6.7 Change-Id: I7ed07ac0c673801fed9c00c9b0ce1628cfea3837 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/OCI: fix QOCIDriver::formatValue()Christian Ehrlicher2024-02-091-1/+1
| | | | | | | | | | | The switch needs to be on QSqlField::metaType() instead the internal QSqlField::typeID() which holds the db-specific type of this field. This amends 7b391c0d2c03d8d25449eca3868cd010d75ff81e. Pick-to: 6.7 6.6 6.5 6.2 Change-Id: Id1d1791826f08adb01cc3da45bf5a66bad288046 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Override detection of OS for sqlite3Michał Łoś2024-02-081-0/+5
| | | | | | | | sqlite3 doesn't detect properly VxWorks. Add workaround that hardcodes detected OS to "UNIX". Change-Id: I255bb1af94caf7b15c0bd05a4d4d9df6a076fc22 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Simplify default CMAKE_BUILD_TYPE logicAlexandru Croitor2024-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we had four-ish locations where the CMAKE_BUILD_TYPE was force set. Twice in QtBuildInternalsExtra.cmake via qt_internal_force_set_cmake_build_type_conditionally(), depending on some conditions. This was executed right at find_package(Qt6 COMPONENTS BuildInternals) time. And twice in qt_internal_set_default_build_type() via qt_build_repo_begin() / qt_prepare_standalone_project() that goes through QtSetup.cmake. This was executed only if the relevant functions were called, rather than directly at find_package() time. The exact logic of which build type ended up being set was very confusing. Refactor the code to decide the build type in one single location when qt_build_repo_begin() / qt_prepare_standalone_project() are called, rather than directly at find_package() time. The actual logic when we override the build type depends on many factors: - when an explicit CMAKE_BUILD_TYPE is given, honor it, unless it's a multi-config build - when it's a multi-config build, don't set any CMAKE_BUILD_TYPE, use the value of CMAKE_CONFIGURATION_TYPES - when it's a qtbase build, compute a default unless an explicit value was given - the default is Debug if FEATURE_developer_build is ON - otherwise the default is Release - when it's a top-level build, only choose a build type for qtbase - when it's another repo build, use the original build type unless another was given explicitly (including in a top-level build) - when it's a standalone tests build - if qt is multi-config, the tests will be single config, due to various CI failure reasons, this hasn't changed - if qt is single config, use the original unless an explicit value was given - when it's a single standalone test build, use the original unless an explicit value was given To determine when an explicit CMAKE_BUILD_TYPE was given in contrast to when it was default initialized, we now have one single function that uses a few heuristics. The heuristics are needed because we can't reliably determine an explicitly given 'Debug' build on Windows, because CMake default initializes to that. The heuristics include: - checking whether CMAKE_BUILD_TYPE_INIT is different from CMAKE_BUILD_TYPE - checking what the CMAKE_BUILD_TYPE was before the first project() call when CMake default initializes - we save the previous value in the qt.toolchain.cmake file - also in QtAutoDetect during qtbase configuration - also when building the sqldrivers project - honoring the value of QT_NO_FORCE_SET_CMAKE_BUILD_TYPE As a result of the above changes, the build type will be set exactly zero or one times, for a particular build directory. Note that the configure script also has some logic on which CMAKE_BUILD_TYPE / CMAKE_CONFIGURATION_TYPES to pass to CMake depending on whether -debug / -release / -debug-and-release / -force-debug-info were passed. But once the values are passed, CMake will honor them. Amends 48841c34d2e86a741ec9992b9704c0fa5973503c Amends 8c912cddebe544010e7da3f87af5b21f3328d7ec Pick-to: 6.7 Task-number: QTBUG-114958 Task-number: QTBUG-120436 Change-Id: I30db14d1e8e9ff9bd2d7ea1d2256cdeb9493ca0d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix sqldrivers project to allow building as Debug MSVC configAlexandru Croitor2024-01-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the user: - has a non-developer-build -debug-and-release Qt - and tries to configure the sqldrivers project with -DCMAKE_BUILD_TYPE=Debug our build system discarded the user request, and defaulted to 'Release'. That happens because CMake sets CMAKE_BUILD_TYPE_INIT to 'Debug' by default on Windows-MSVC, and we have no marker to differentiate that the 'Debug' value was user-specified. We have such a marker - via the __qt_auto_detect_cmake_build_type_before_project_call variable when configuring qtbase / top-level qt - via the __qt_toolchain_cmake_build_type_before_project_call variable when configuring via the qt toolchain file (although that doesn't apply when configuring a multi-config build for obscure reasons, which should be addressed). A conservative fix is to add a new variable / marker called __qt_internal_standalone_project_cmake_build_type_before_project_call which the 'sqldrivers' project will set with the build type that is detected before the first project() call, and use that to decide whether to override the build type, similar how we do with toolchain file variable. We could reuse one of the previous variables, but I figured it's better to be explicit with a new one. And hopefully we can clean up the whole logic in a follow-up commit. Amends 48841c34d2e86a741ec9992b9704c0fa5973503c Amends 8c912cddebe544010e7da3f87af5b21f3328d7ec Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-120436 Task-number: QTBUG-114958 Change-Id: I37e3d8041088fe6084a9976ecc80ddd62d73ef81 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* SQL/MySQL: Fix compilation with MySQL 8.3Christian Ehrlicher2024-01-221-17/+11
| | | | | | | | | | | | | | | | With MySQL 8.3 mysql_fetch_field() was removed which was used in QMYSQLDriver::record(). There is no real replacement function so we use 'SELECT * from table LIMIT 0' to retrieve the schema information. Additionally mysql_stmt_bind_param() was deprecated and needs to be replaced by mysql_stmt_bind_named_param(). [ChangeLog][SQL][MySQL] Fixed compilation with MySQL 8.3. Pick-to: 6.7 6.6 6.5 6.2 5.15 Fixes: QTBUG-121183 Change-Id: I149836bd5674d0784255baf416d437c424992f20 Reviewed-by: silverqx <silver.zachara@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Bump version to 6.8.0Jani Heikkinen2023-12-111-1/+1
| | | | | Change-Id: I407e6fd7a766450bb6fe00da7f6ebbd49496e5cd Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Fix datatype mappings for the Mimer SQL QtSql pluginFredrik Ålund2023-10-251-15/+22
| | | | | | | | | | Some of the datatype mappings for Mimer SQL are wrong and some are missing. Also, fix the datatype documentation for Mimer SQL. Fixes: QTBUG-111219 Pick-to: 6.6 Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/PostgreSQL: misc cleanupChristian Ehrlicher2023-10-061-13/+11
| | | | | | | | | | Misc cleanup for the PostgreSQL driver: - use constexpr instead const for some constants - use new signal/slot syntax - unconditionally call PQfinish() - check is done inside the function Change-Id: I47b83ef3436225f698fca24c68e5c9cde32c1163 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQLite: Handle identifiers correctlyPo-Hao Su2023-09-282-78/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* SQL/SQLite: fix compilation with SQLite < 3.40.0Christian Ehrlicher2023-08-311-0/+3
| | | | | | | | | | sqlite3_filename was indroduced with SQlite 3.40.0 so we have to define it by our own for older versions. Task-number: QTBUG-107120 Fixes: QTBUG-116572 Change-Id: I3186e58c3538135dc01a1be9cc54621699d1cec1 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Mimer SQL driver plugin: Fix messagesFriedemann Kleint2023-08-221-1/+2
| | | | | | | | | | | Amends 0efd8854c4b32ec0b011efbf6b3a1990fe684e32. Task-number: QTBUG-111219 Pick-to: 6.6 Change-Id: I8425c13a324562beb4a687ecdd0339a129fe190e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* SQL/PSQL: Handle jsonb operators in prepared queriesChristian Ehrlicher2023-07-231-2/+2
| | | | | | | | | | | | 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: use QT_NO_CONTEXTLESS_CONNECT for sql pluginsChristian Ehrlicher2023-07-196-0/+6
| | | | | | | | | Use QT_NO_CONTEXTLESS_CONNECT to disable 3-arg connects which are considered dangerous. Change-Id: I0ac711491de60e0eeaca9edb60715eafe9da841a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL plugins: add moc includesChristian Ehrlicher2023-07-195-0/+10
| | | | | Change-Id: I9ed4b63fd02b4a6fc5f4b614466590cd099609e2 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/SQLite: add case folding for non-ascii charactersChristian Ehrlicher2023-07-081-0/+33
| | | | | | | | | | | | | 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>
* QIbaseResult: null parameter follow up fixAxel Spoerl2023-07-051-2/+5
| | | | | | | | | | | | | a7deddba519fc1f6fd637496e92ca5daccf6d453 implemented a warning for disallowed null parameters. A check, was missing, if the argument is actually null. This patch adds the missing check. Fixes: QTBUG-114683 Pick-to: 6.6 6.5 Change-Id: Iecbd636599a28284a0a9afe2987e48552f3658ff Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* QIbaseResult: qWarning, when disallowed null parameter becomes zeroAxel Spoerl2023-07-041-0/+3
| | | | | | | | | | | | | | | QIbaseResult turns null into zero when database field doesn't accept a null argument. This patch adds a warning in that case. It would be better to return with an error, but that breaks existing behavior with code relying on it. Fixes: QTBUG-114683 Pick-to: 6.6 6.5 Change-Id: Ib50b7b6b4dd6c51489ba8b355f7baa8b1b14dc15 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QtVFS: Attempt to fix compilation error on YoctoFabian Kosmale2023-07-041-1/+1
| | | | | | | The yocto compiler finds no matching function for some reason. Change-Id: I9fb7c00aeb3bd00b24bcf7513f68f6c8cffc5cbd Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Say hello to QtVFS for SQLite3BogDan Vatra2023-07-025-1/+283
| | | | | | | | | | | | | | | 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>
* Bump version to 6.7.0Jani Heikkinen2023-06-121-1/+1
| | | | | Change-Id: I69954ccc5cfb44e7bf02b8fcab18e9320e7e8748 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Mimer SQL driver plugin: Reduce repetitive error messagesFriedemann Kleint2023-06-081-99/+45
| | | | | | | | | | | | | | | Introduce message helper functions for get/set, sparing the translators having to translate the data types. As a drive-by, use UUID/CLOB/BLOB consistently. Amends 0efd8854c4b32ec0b011efbf6b3a1990fe684e32. Task-number: QTBUG-111219 Pick-to: 6.6 Change-Id: I7a137c3797947523af5478b3add6ee0a26b295d7 Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove the manual undef of the min/max macros, or def NOMINMAXAmir Masoud Abdol2023-06-081-7/+0
| | | | | | | | | | We now add NOMINMAX to PlatformCommonInternal target which will be linked to everything else, so min/max will not be defined upon the inclusion of `windows.h`, or other headers. Pick-to: 6.5 6.6 Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* SQL: replace qPrintable() / toLocal8Bit() with unicode versionsChristian Ehrlicher2023-04-183-17/+19
| | | | | | | Replace qPrintable() and toLocal8Bit() with qUtf16Printable() Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: properly initialize variableChristian Ehrlicher2023-04-111-3/+3
| | | | | | | | | | Properly initialize outBinds - even it should be initialized by mysql/mariadb client lib we should correctly initialize it with 0 to avoid valgrind warnings about accessing uninitialized data. Pick-to: 6.5 6.2 5.15 Change-Id: I85b99a7e639dad9f8d24f554cd96c5997a5838ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/IBASE: Always escape the table names when creating the SQL statementChristian Ehrlicher2023-04-071-11/+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>
* SQL/MySQL: add option MYSQL_OPT_TLS_VERSION & MYSQL_OPT_SSL_MODEChristian Ehrlicher2023-04-061-0/+27
| | | | | | | | | | | | | | Add the two options MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE to properly support encrypted connections to MySQL 8.0 servers. MYSQL_OPT_SSL_MODE will not work when compiled against the MariaDB C-Connector since it's not supported by the MariaDB client. [ChangeLog][QtSql][MySQL] Added the two new connect options MYSQL_OPT_TLS_VERSION and MYSQL_OPT_SSL_MODE. Fixes: QTBUG-84797 Change-Id: Iec7d682fc00072ce5b2a824c4ea00fca4575a93e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/PSQL: remove non utf-8 supportChristian Ehrlicher2023-04-051-14/+14
| | | | | | | | | PostgreSQL supports the utf-8 encoding ('UNICODE') since at least version 7.3 which is the oldest version we support. Therefore remove the non utf-8 codepath completely. Change-Id: I64b1a4e7b0b85141fe13f5f57e6f35f9eb7d542e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/IBASE: Time Zone support (firebird 4.x)Andreas Bacher2023-03-241-9/+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>
* QSQL/ODBC: fix regression (trailing NUL)Marc Mutz2023-03-211-2/+2
| | | | | | | | | | | | | | | | | | | When we fixed the callers of toSQLTCHAR() to use the result's size() instead of the input's (which differ, if sizeof(SQLTCHAR) != 2), we exposed callers to the append(0), which changes the size() of the result QVLA. Callers that don't rely on NUL-termination (all?) now saw an additional training NUL. Fix by not NUL-terminating, and changing the only user of SQL_NTS to use an explicit length. Amends 4c445ef0bae8b36ec4a742552f0ebd81a1a90723 and 46af1fe49f7f419dc1b3231de9860e2da0ea48f8. Done-with: Christian Ehrlicher <ch.ehrlicher@gmx.de> Pick-to: 6.5 6.5.0 6.4 6.2 5.15 Change-Id: I6210b77e9417f46294df94cb32ab4134af8dc4c2 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/IBASE: fix testsChristian Ehrlicher2023-03-171-7/+0
| | | | | | | 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-172-0/+8
| | | | | | | | 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/IBASE: misc cleanupChristian Ehrlicher2023-03-171-54/+45
| | | | | | | | Misc cleanup of the IBASE driver - use qsizetype and range-based for loops. Change-Id: I69fe8ed3303fb352b59989c625de5a51239cf604 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: Add support for Bit-Value Type - BITChristian Ehrlicher2023-03-121-2/+28
| | | | | | | | | | | | 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/ODBC: add another check to detect unicode availability in driverChristian Ehrlicher2023-03-121-1/+12
| | | | | | | | | | | | | | | | | | Since ODBC does not have a direct way finding out if unicode is supported by the underlying driver the ODBC plugin does some checks. As a last resort a sql statement is executed which returns a string. But even this may fail because the select statement has no FROM part which is rejected by at least Oracle does not allow. Therefore add another query which is correct for Oracle & DB2 as a workaround. The question why the first three statements to check for unicode availability fail is still open but can't be checked since I've no access to an oracle database. Pick-to: 6.5 Fixes: QTBUG-96616 Fixes: QTBUG-102958 Change-Id: I8ec0115bbfbfc40852bcfb8e94b4b4ad3e395b37 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/MySQL: fix QSqlDatabase::tables() with MySQL 8.0.xChristian Ehrlicher2023-03-121-2/+5
| | | | | | | | | | | | The (undocumented) struct MYSQL returned by mysql_real_connect() no longer stores the db name in MYSQL.db but something else. This leads to a wrong select statement within QMYSQLDriver::tables(). Therefore store the current database name in QMYSQLDriverPrivate to be able to use it in tables() later on. Pick-to: 6.5 6.2 5.15 Change-Id: I27d3345dd44a0d8642ca120cddc5c151b8bed85d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/OCI: Compile with QT_NO_CAST_FROM_ASCIIChristian Ehrlicher2023-03-121-1/+1
| | | | | | | | Don't know why this even went through the ci. Pick-to: 6.5 Change-Id: I9f0d1cee0c600c98f5b71bdd10f8f0260e43afcf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/ODBC: Return all native error codesChristian Ehrlicher2023-03-071-78/+76
| | | | | | | | | | | | | | 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>
* SQL: small optimization for SQLDriver::escapeIdentifier()Christian Ehrlicher2023-02-286-8/+9
| | | | | | | | Avoid a memmove (and replace it with a memcpy) by not using QString::prepend() but create a completely new string object instead. Change-Id: Ibdb4a9c6b15b96f1743d47e158ff0fb9b2048221 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/OCI: use QDateTime::toString("ttt")Christian Ehrlicher2023-02-281-10/+1
| | | | | | | | | | | Use QDateTime::toString("ttt") which is available since Qt6.5 instead own implementation Pick-to: 6.5 Fixes: QTBUG-111275 Change-Id: I41676d3a327c5aaabdeb4f54b9d169e228c482e1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/OCI: Correctly calculate utc offset string when icu is not availableChristian Ehrlicher2023-02-271-2/+11
| | | | | | | | | | | | | When ICU is not available, QTimeZone::displayName() does not return a valid timezone offset string so the OCI driver will get a wrong utc offset string and inserting a QDateTime will go wrong. Fix it by creating the utc offset string by ourself (toOffsetString() inside qdatetime.cpp is static and therefore not accessible for us). Pick-to: 6.5 6.4 6.2 5.15 Fixes: QTBUG-111275 Change-Id: Ib724d760688614e162246e1e028ee5e004cc9477 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/OCI: Fix QSQLDriver::record() when tablename is a synonymChristian Ehrlicher2023-02-221-3/+2
| | | | | | | | | | | Fix the statement when the tablename is a synonym by not appending the where clause for the table name to the initial statement used for tables and synonyms later on. Pick-to: 6.5 6.4 6.2 5.15 Fixes: QTBUG-111339 Change-Id: Ie18a858427d124e80462048b1a9c5e2afa327546 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* A QtSql driver for Mimer SQLFredrik Ålund2023-02-209-0/+1782
| | | | | | | | | | | | | | | | | 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>
* ODBC/MySQL: fix compilation with MySQL < 5.7.9Christian Ehrlicher2023-02-121-0/+5
| | | | | | | | | | | MYSQL_TYPE_JSON was introduced in MySQL 5.7.9 but our documentation states that we still support 5.6 so we have to define this value by ourself for the older versions. Pick-to: 5.15 6.2 6.4 6.5 Fixes: QTBUG-109832 Change-Id: I935edb14495d162ed58109610946b2805d37bbc4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>