summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
Commit message (Collapse)AuthorAgeFilesLines
* Compile autotests for IntegrityTatiana Borisova2021-09-201-3/+4
| | | | | | | | | - process environment/DNS are OFF for INTEGRITY Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I189a97f88c96a428586c31a66b8d250e04482900 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* MySQL: pedantism: create and destroy the MYSQL_TIME typeThiago Macieira2021-08-181-3/+7
| | | | | | | | This is a no-op. But take the opportunity to make a drive-by update on the loop, which improves it. Change-Id: I4a40ccbd3321467a8429fffd169b08590d28c928 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: implement binding output (SELECT) results to MYSQL_TIMEThiago Macieira2021-08-181-0/+23
| | | | | | | We already do it for inputs but weren't doing it for outputs. Change-Id: I4a40ccbd3321467a8429fffd169afeb5730ad75e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: don't allocate 1-byte buffers for BLOBsThiago Macieira2021-08-171-1/+1
| | | | | | | | | We set the buffer length to 0 for blobs, as we need to do it for each row, in bindBlobs() (apparently a workaround for MySQL 4.1.8 API). That function was deleting the buffer and reallocating. Change-Id: I4a40ccbd3321467a8429fffd169b06422612ca13 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: treat the MYSQL_FIELD as read-onlyThiago Macieira2021-08-171-14/+13
| | | | | | | | | | | | | | | | | | The MariaDB-connector-c version 3.2 and MariaDB server version 10.6 cooperate to avoid re-transferring the query metadata, so the fact that we were modifying it was causing it to improperly decode the DATETIME data types into string, as we had asked. We ended up with a 7-byte string that was actually the date binary-encoded. References: - https://jira.mariadb.org/browse/MDEV-26271 - https://github.com/MythTV/mythtv/issues/373 - https://bugs.kde.org/show_bug.cgi?id=440296 Pick-to: 5.12 5.15 6.2 Fixes: QTBUG-95639 Change-Id: I4a40ccbd3321467a8429fffd169afdbb26cf29f6 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: remove left-over charset-setting codeThiago Macieira2021-08-171-7/+0
| | | | | | | | Complements commit 472520afb9081856a2556c7df221c084a42a2d42. We were doing it twice. Change-Id: I4a40ccbd3321467a8429fffd169b05fa5e22f204 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: properly fix setting the character setThiago Macieira2021-08-101-3/+31
| | | | | | | | | | | | | | | Commit e4bd73dc54542fe16121825c2a369b7f863e0de8 moved the mysql_set_character_set() call above the mysql_real_connect() but that doesn't actually work, as there's no connection to send the "SET NAMES" statement on. So do it in two steps: first, by setting the charset in the MYSQL structure, then by asking the server to match. Pick-to: 6.2 Task-number: QTBUG-55444 Change-Id: I4a40ccbd3321467a8429fffd1699bd829f342124 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: don't format QDateTime with timezonesThiago Macieira2021-08-101-0/+14
| | | | | | | | | | | | | | | | | | | | | Neither MySQL nor MariaDB like it. According to the documentation[1], MySQL now accepts timezones using the [+-]HH:MM format (and -00:00 is rejected). MariaDB does not accept timezones at all[2]. This has apparently been broken since Qt 5.0 (the "Z" suffix was introduced in commit 2528f4ffe53dfbd640249f63497522929264f3d7), but this issue was never noticed because the of prepared queries: when they're in use, we transfer the time using a MYSQL_TIME structure, which does not support timezone offsets either. We've only noticed this issue when the code to determine if the MySQL client library supported prepared statements broke. [1] https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html [2] https://mariadb.com/kb/en/date-and-time-literals/ Task-number: QTBUG-95071 Change-Id: I4a40ccbd3321467a8429fffd1699cc4c050ae746 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* MySQL: remove the version number checks in favor of actual functionalityThiago Macieira2021-08-101-2/+15
| | | | | | | | | | | | | | | | | | | | | MariaDB library version 3.2 no longer returns the server version in the 10.x range but the library version itself, which is lower than 4.x. That meant we concluded the server did not support prepared statements. And because of the lack of prepared statements, all QDateTime conversions failed, because of the timezone. I don't know if this was intended or what, but it's a side issue. [ChangeLog][QtSql][MySQL] Fixed the detection of whether the client and server support prepared statements. This was caused by the mariadb connector library reporting its own version numbers (starting in version 3.2) instead of the server version. Fixes: QTBUG-95071 Pick-to: 5.15 6.2 Change-Id: I4a40ccbd3321467a8429fffd1699bc089ba706e6 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-067-7/+7
| | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Bump project versionsAlexandru Croitor2021-08-021-1/+1
| | | | | | Fixes: QTBUG-95454 Change-Id: I2467d3ae27b54424e59a7a4ab00d364eaec517d5 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Tidy up in OCI driver codeEdward Welbourne2021-06-221-36/+42
| | | | | | | | | | | | | Use nullptr instead of 0 for null pointers. Compare OCIHandleAlloc() return values to OCI_SUCCESS rather than 0. Initialize instance variables in the class where possible, rather than in the constructor. Conform to coding style o long lines and braces. Assert pointers are null before allocating and overwriting them, so we might have a chance of catching leaks. Change-Id: Ia885ec18f46de5219a51fb6f9f23f474b3046585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Move tidy-up of private to its own destructorEdward Welbourne2021-06-221-8/+4
| | | | | | | | | | | QOCIResult::~QOCIResult() was doing part of the tidy-up for QOCIResultPrivate, whose own destructor took care of the rest. So move that part to the private, where it makes more sense. Also correct an error message in part of the private's existing tidy-up and eliminate a needless local variable. Change-Id: I09a51c72afd7a30bcee7f6127c59d703650f1c41 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix potential double-free in QSqlCachedResult::cleanup()Edward Welbourne2021-06-221-1/+3
| | | | | | | | | | | If d->sql is non-null, it gets freed; later in the same function, it gets reallocated, unless the query is empty, in which case the now-freed value was still recorded, so that later clean-up might find it and mistakenly think it needs to be freed again. Clear when freeing. Pick-to: 6.2 6.1 Change-Id: I8d37d2ba1fcaa320916eaf30dceaa720bbf62f38 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix leak of transaction context handle in QSql's OCI driverEdward Welbourne2021-06-221-11/+21
| | | | | | | | | | | | | | Transaction handles were allocated but nowhere freed. Thanks to Stefan Latsch for pointing this out and suggesting the fix. Make the handle yet another member of QOCIDriverPrivate so that close() can free it. At the same time, also free the service context handle d->svc when failing do open(); and shuffle the order of frees to be the reverse of the order of allocations. Fixes: QTBUG-94246 Pick-to: 6.2 6.1 5.15 Change-Id: I45818ada6d884b06028056d28635390a300e2def Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Remove old configure-related filesJoerg Bornemann2021-06-182-278/+0
| | | | | | | | | | | | | Remove the configure.json and configure.pri files that were used for the qmake-based configure. Remove the .prev_*.cmake files that were a by-product of configurejson2cmake.py. Pick-to: 6.2 Task-number: QTBUG-89536 Change-Id: Ie827562f7fd2513d59f69234d77b8b93124ea78e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Port some fallthrough comments to Q_FALLTHROUGHGiuseppe D'Angelo2021-06-132-3/+3
| | | | | Change-Id: I70dd492d5c8d198589bfd642db63182cf17b133f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQLite plugin: use QString::unicode(), not utf16()Giuseppe D'Angelo2021-06-011-1/+1
| | | | | | | | | | utf16() reallocates a QString if it was created from raw data, in order to ensure NUL termination. But here we don't need NUL termination anyways because we also pass the string size, so just use unicode() instead. Change-Id: I4a01ab9f4e53b94b80d3d00272cb0f0e35e30959 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQLite driver: fix crash when binding a QByteArray/QStringGiuseppe D'Angelo2021-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing SQLITE_STATIC to sqlite3_bind_*() means that ownership of the data stays in the caller, i.e. SQLite itself doesn't make a copy; such data must be therefore be kept valid until sqlite3_step() is called. The code in the SQLite driver uses that option to avoid copying byte array or string data. But, unlike what the comments in the code say, we do NOT keep the QByteArray/QString alive long enough: they're contained by a temporary QVariant object which gets destroyed at the end of the loop that binds each argument. Luckily the fix is simple: since that QVariant is just a copy of the QVariants used as bound parameters, and these are held in a container (which lives long enough), simply create a reference to the container's elements rather than a copy. This ensures that the data is alive by the time sqlite3_step() is called. This problem doesn't normally appear because of implicit sharing of QByteArray/QString. When the QVariant is copied, the inner element is just a shallow copy. Getting the pointer to the data, and destroying the QVariant, does not destroy the data (it's kept alive by the QByteArray/QString inside the *copied-from* QVariant). Of course there's a catch: if the *copied-from* QVariant contains a QString created via fromRawData, then everything blows up. In this case, 1. the copied QVariant is created (which bumps the QString refcount)¹ 2. the QString inside of it is accessed directly (via QVariant::constData) 3. utf16() is called on that string, which detaches it (!) 4. the result of utf16() is passed to SQLite, with SQLITE_STATIC 5. the copied QVariant is destroyed; this destroys the inner QString, which, being detached, deallocates the data too early. 6. sqlite3_step() is called, kaboom. (The copied-from QVariant still has the string created by fromRawData.) ¹ Note that QString uses the Small QVariant Optimization, so the QString object itself into the QVariant is copied, it's not just a *QVariant* refcount increase. Change-Id: Idcdb192809f1f8f79b4a901e1247f933eb06e854 Pick-to: 6.1 5.15 5.12 Fixes: QTBUG-94070 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQLite: Handle tables and fields with a dot in the name correctlyAndy Shaw2021-04-231-9/+24
| | | | | | | Fixes: QTBUG-91885 Pick-to: 6.1 6.0 5.15 Change-Id: Iba76bb50266dd4fb5f50e4ea1549d1d2bb6e3431 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Skip adding externally added plugins to the plugin meta-setsAlexey Edelev2021-04-081-3/+0
| | | | | | | | Plugin meta-sets are not visible outside of the module build tree, so there is no point in adding dependencies for externally added plugins. Change-Id: Ica5b29b57c032f4fc9b128172aaa806392e9e581 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix building multi-arch universal macOS QtAlexandru Croitor2021-04-017-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the same approach we use for iOS, which is to set multiple CMAKE_OSX_ARCHITECTURES values and let the clang front end deal with lipo-ing the final libraries. For now, Qt can be configured to build universal macOS libraries by passing 2 architectures to CMake, either via: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" or -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" Currently we recommend specifying the intel x86_64 arch as the first one, to get an intel slice configuration that is comparable to a non-universal intel build. Specifying the arm64 slice first could pessimize optimizations and reduce the feature set for the intel slice due to the limitation that we run configure tests only once. The first specified architecture is the one used to do all the configure tests. It 'mostly' defines the common feature set of both architecture slices, with the excepion of some special handling for sse2 and neon instructions. In the future we might want to run at least the Qt architecture config test for all specified architectures, so that we can extract all the supported sub-arches and instruction sets in a reliable way. For now, we use the same sse2 hack as for iOS simulator_and_device builds, otherwise QtGui fails to link due to missing qt_memfill32_sse2 and other symbols. The hack is somewhat augmented to ensure that reconfiguration still succeeds (same issue happened with iOS). Previously the sse2 feature condition was broken due to force setting the feature to be ON. Now the condition also checks for a special QT_FORCE_FEATURE_sse2 variable which we set internally. Note that we shouldn't build for arm64e, because the binaries get killed when running on AS with the following message: kernel: exec_mach_imgact: not running binary built against preview arm64e ABI. Aslo, by default, we disable the arm64 slice for qt sql plugins, mostly because the CI provisioned sql libraries that we depend on only contain x86_64 slices, and trying to build the sql plugins for both slices will fail with linker errors. This behavior can be disabled for all targets marked by qt_internal_force_macos_intel_arch, by setting the QT_FORCE_MACOS_ALL_ARCHES CMake option to ON. To disble it per-target one can set QT_FORCE_MACOS_ALL_ARCHES_${target} to ON. Task-number: QTBUG-85447 Change-Id: Iccb5dfcc1a21a8a8292bd3817df0ea46c3445f75 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QSql/MariaDB/MySQL: use utf-8 as encoding for username and passwordChristian Ehrlicher2021-03-191-29/+20
| | | | | | | | | | | | | The mariadb driver sets the encoding for the connection to utf-8 but only after the username and password was already set. Therefore non-ascii characters were not correctly encoded when the local character set was not the default one from the database. Move mysql_set_character_set() above the username/password setting and encode all as utf-8 instead local8Bit. Fixes: QTBUG-55444 Change-Id: Iff7ee24159d54b578cd854e620aa814d72da3801 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QSql/MariaDB/MySQL: misc cleanupChristian Ehrlicher2021-03-081-24/+16
| | | | | | | | | | Cleanup the mariadb driver a little bit: - use nullptr instead NULL - use unsigned long instead int for blob handling now that QByteArray can handle more than 2^31 bytes Change-Id: I79639a42a739aabdf776cc688cb5d664248aa610 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-247-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add some special case markers that seem to have been neglectedEdward Welbourne2021-02-152-2/+79
| | | | | | | | At least, running util/cmake/configurejson2cmake.py changes these lines. Adding them has provoked the script to add a .prev_configure.cmake file. Change-Id: Idc123d1dee2ce51cd640c090c7910ecc1f0fc5a4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix compilation of the QPSQLDriverPlugin plugin with enabled PCHAlexey Edelev2021-02-091-0/+11
| | | | | | | | | | | | | | | PostgreSQL package delivers several header files such as pthread, zlib, zconf, uuid, etc. within Windows installation package. The headers are exposed to the compiler by PostgreSQL include paths and have different versions. When compiling PCH of the QPSQLDriverPlugin plugin, MinGW uses the pthread.h header from the PostgreSQL include paths, that cause an error related to pthread implementation mismatch. Disable PCH for the QPSQLDriverPlugin plugin, when using MinGW. Fixes: QTBUG-90850 Change-Id: I0be91bbefe37731acb2658d679b5b644ef552b23 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix compilation of ibase sqldriver plugin, added overrideAndreas Buhr2021-02-011-1/+1
| | | | | | | | With gcc 10.2, I cannot compile qtbase without this patch. Pick-to: 6.0 5.15 Change-Id: I5be48947e2301d5befeec397291c0da597f7eb63 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* ibase: Fix the compilation and include it again so it can be detectedAndy Shaw2021-01-264-19/+36
| | | | | Change-Id: I38721155f090173862da8beab8cb04b2e015dcff Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Add upstream version of FindPostgreSQL.cmakeAlexey Edelev2021-01-261-3/+0
| | | | | | | | | | | | Add CMake upstream(3.20.0) version of FindPostgreSQL.cmake, to avoid server-related headers lookup. Avoid using the Qt version of the PostgreSQL module, if it's older than the CMake's one. Fixes: QTBUG-89639 Change-Id: I71a0c3508000901969933aea8a08d1ad431db711 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QSql/PostgreSQL: allow blobs with more than 2^30 bytesChristian Ehrlicher2021-01-251-2/+2
| | | | | | | | | | | | Due to limitations of QByteArray it was not possible to store more than 2^31 bytes. This was fixed in Qt6 so throw away the casts to int in the postgres plugin Fixes: QTBUG-79059 Change-Id: I8ae7276a04d4936bcf5ba6c413e3412f6c342ff5 Pick-to: 6.0 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix separately building SQL plugins with CMake 3.16Joerg Bornemann2021-01-211-1/+3
| | | | | | | | | | | | | Also move the cmake_minimum_required call to the top of the file, because the line before already requires some policy settings, which is what cmake_minimum_required() is establishing. For the standard Qt build, we make sure to get appropriate policy settings by calling qt_internal_upgrade_cmake_policies(). Pick-to: 6.0 Change-Id: If97556a9dd00646e83957959d0f9f16916625160 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Interbase: Don't error out if closing an already closed cursorAndy Shaw2021-01-141-1/+7
| | | | | | Pick-to: 6.0 5.15 Change-Id: If6964f5ae45c5ca4c0b34e417326fea1f33d7628 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QODBC: Preserve the whole value when using HighPrecisionAndy Shaw2021-01-141-1/+2
| | | | | | | | | | | | Some ODBC drivers do not properly handle SQL_NO_DATA and therefore decimal values returned with HighPrecision are cut off because the decimal point is not taken into account. Fixes: QTBUG-73286 Pick-to: 6.0 5.15 5.12 Change-Id: I905c947b4d0266a3245d5735300300ca00f77480 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Remove .prev_CMakeLists.txt filesJoerg Bornemann2021-01-124-157/+0
| | | | | | | | | | Those serve no purpose anymore, now that the .pro files are gone. Task-number: QTBUG-88742 Change-Id: I39943327b8c9871785b58e9973e4e7602371793e Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QSql/QSqlite: return extended error codes by defaultChristian Ehrlicher2021-01-111-0/+4
| | | | | | | | | | | | | SQlite allows to return fine-granulated error codes but this behavior is not enabled by default (due to backwards compatibility concerns). Enable them for the SQLite driver by default but provide an option to disable them when needed. [ChangeLog][QtSql][QSQLITE] The plugin now returns the extended error codes by default. Change-Id: I59cec9aea46eb03f1e7ca02903d769c003a1ae30 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Bump versionPaul Wicking2021-01-111-1/+1
| | | | | | | | | CMake edition. Also update default compiled version. Task-number: QTQAINFRA-4126 Change-Id: Ia6f535f553e73bd6b00e2e20752f4961af21ede5 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Sql ODBC driver: add direct support for float and short datatypeChristian Ehrlicher2021-01-101-4/+49
| | | | | | | | | | | | | 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>
* Remove the qmake project filesJoerg Bornemann2021-01-0710-198/+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>
* CMake: Fix error and print summary for standalone building sqldriversLi Xinwei2021-01-041-0/+7
| | | | | | | | | | | qt_plugins target is needed by qt_internal_add_plugin function, but when standalone building sqldrivers, this target does not exist, which causes configure error. So we need to add this target manually. Fixes: QTBUG-89714 Pick-to: 6.0 Change-Id: Ia7d613faabb82399c2f3e5771aab24302b3c8f56 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* fix potential mem leak on connection lostMatthias Möller2020-12-301-15/+12
| | | | | | | | | | | | | | | The PostgreSQL driver can change it's connection status after the first established connection. In this case, the function "isOpen()" returns false and the "close()" function would not free all resources. With this fix, the "close()" function always frees any allocated resource independent of the connection status. Fixes: QTBUG-88984 Pick-to: 6.0 5.15 5.12 Change-Id: I7c9add6a183bf46a8573952ab39f8cb1f728c00c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* sqlite: Replace NULL by nullptrFriedemann Kleint2020-12-211-6/+7
| | | | | Change-Id: I8e845ae093a68d2d7ecf0e358a2316a54d0f2144 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* sqlite: Fix MSVC integer conversion warningsFriedemann Kleint2020-12-211-6/+11
| | | | | Change-Id: I58ab6a8d7787abce5b0f73562eb53f40e39c8186 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* OCI: Fix the compilation of the pluginAndy Shaw2020-12-131-5/+6
| | | | | | Pick-to: 6.0 Change-Id: I9637bab6cc217d4fd9692f6745b4f14db6ffb259 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Reduce the scope of variables in exec() and fetchNext()Zou Ya2020-11-262-7/+3
| | | | | | | | | | | | The scope of the variable 'currBind' can be reduced if the variable 'r' is not 0. So declare the variable when the variable 'r' is 0. The local variable 'i' shadows outer variable in fetchNext(), so move it to the front of switch. Don't declare 'res' until we need and initialize it. Change-Id: Idfb220b96cfbcd4088fd7858ed9392d0a3e10aea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Reduce the scope of variables in bindInValues()Huang Jie2020-11-241-4/+3
| | | | | | | | | The scope of the variables 'bind', 'field', 'i' can be reduced if the variable 'meta' is a null pointer. So declare the variables when the variable 'meta' is valid. Change-Id: I599406c034168dd73799c69dfb9c5e676861cdf2 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-166-28/+28
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-235-325/+322
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Cleanup remaining QVariant::Type uses in Qt SqlLars Knoll2020-10-171-23/+23
| | | | | Change-Id: Ibcaa678cd9f9c957392a75b477fa6821f9a69127 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-077-17/+17
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>