summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/oci/qsql_oci.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SQL/OCI: use categorized loggerChristian Ehrlicher11 days1-40/+38
| | | | | | | Use the categorized logger qt.sql.oci Change-Id: Ib143cfa3136a7382adbabfe4bc421b94e2a25bda Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QOCICols: fix warning for -Wdangling-referenceDennis Oberst13 days1-1/+1
| | | | | | | | .. by playing it safe and taking the QVariant by copy Pick-to: 6.7 6.5 Change-Id: I24e0507a912388b7fb17e838a22e8d4c449bcf5b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-101-1/+0
| | | | | | | | | These functions set/get the db-specific internal sql type but it's not used in any of the sql plugins since ages. Any external plugin using this for some reason must be ported away until Qt7. Change-Id: Ifb33e9d3be0b80fb4d0979d31436e89ea6a8208b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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>
* SQL plugins: add moc includesChristian Ehrlicher2023-07-191-0/+2
| | | | | Change-Id: I9ed4b63fd02b4a6fc5f4b614466590cd099609e2 Reviewed-by: Andy Shaw <andy.shaw@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/OCI: add maximumIdentifierLength()Christian Ehrlicher2023-03-171-0/+7
| | | | | | | | 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/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: small optimization for SQLDriver::escapeIdentifier()Christian Ehrlicher2023-02-281-1/+1
| | | | | | | | 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>
* Support connecting Oracle DB as system userJohannes Oikarinen2022-12-221-9/+18
| | | | | | | | Adding support to different authentication modes to Oracle DB. Adjust the connection string parsing a little bit as a drive-by. Change-Id: I24ed70ed5085f22ba58eff70caa685579d31c96f Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/OCI: replace deprecated QDateTime() ctorChristian Ehrlicher2022-12-191-1/+1
| | | | | Change-Id: I0d36f036a9814e85f4606644e0fd8801e76ffccf Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* SQL/OCI: fix compilationChristian Ehrlicher2022-10-141-1/+2
| | | | | | | | | | | Fix compilation error introduced with 917b4d3802f3c2102021610cbf977403a3d4c21a and add a missing override Pick-to: 6.4 Fixes: QTBUG-107544 Change-Id: I53571a0a113dc0f1e65f8773e66c02c1764739ee Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* Put code related to timezone functionality under QT_CONFIG(timezone)Tatiana Borisova2022-08-181-0/+2
| | | | | | Pick-to: 6.4 6.3 Change-Id: I0d1573dbb4ae4f9740fc19546950ae4316aa4c0c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Sql: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-191-2/+2
| | | | | | Task-number: QTBUG-98434 Change-Id: Ia621f9d937649dda41a7b0d13a61e6f1397f6dde Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-191-57/+56
| | | | | | Task-number: QTBUG-98434 Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Sql: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-191-30/+29
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I03477e645a94948cac3e3e2abca52aa4e3e2efff Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adapt SQL drivers to Qt 6 change of QVariant::isNullVolker Hilsheimer2022-01-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, QVariant::isNull returned true if either the variant didn't contain a value, or if the value was of a nullable type where the type's isNull member function returned true. In Qt 6, QVariant::isNull only returns true for variants that don't contain a value; if the value contained is e.g. a null-QString or QDateTime, then QVariant::isNull returns false. This change requires a follow up in the SQL drivers, which must still treat null-values the same as null-variants, lest they write data into the data base. Add a static helper to QSqlResultPrivate that implements isNull-checking of variants that contain a nullable type relevant for Sql, and add a test case to the QSqlQuery test that exercises that code. Pick-to: 6.2 6.3 Fixes: QTBUG-99408 Fixes: QTBUG-98471 Change-Id: I08b74a33aa3235c37d974f182da1f2bdcfd8217e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Revert "Don't allocate an OCIDateTime object unless we're going to use it"Edward Welbourne2021-12-061-22/+7
| | | | | | | | | This reverts commit 064c3d35e6809672323e8d912e9140ddd0ad48cd. Reason for revert: Causes crashes on querying. Better to endure the non-NULL representations of null QDateTime values. Change-Id: I33dd3b95ab35d8e3accb864aec13d21764b1270d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Close leak of QOCIDateTime objectEdward Welbourne2021-12-021-0/+1
| | | | | | | | | | | Noticed while reviewing usage of this type. The code has a whole TempStorage class to take care of keeping allocated memory live until we're done with it, explicitly including date-time objects as a special case, but neglected to use it in one place. Pick-to: 6.2 5.15 Change-Id: Ic94c56d67dda6dc3ee36a025a2e0149f6b2a1837 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Don't allocate an OCIDateTime object unless we're going to use itEdward Welbourne2021-11-301-7/+22
| | | | | | | | | | | | | | | | | | | The QOCIDateTime destructor carefully checks that dateTime is non-null before tidying it away, but the constructor allocated it independently of whether it was used, leaving it in a still-not-constructed state if the date-time it was to represent was invalid. Only allocate if the date-time is valid; and check against null when an OCIDateTime is being converted back to QDateTime. Add warnings if either allocation or construction fails. Incidentally use static_cast<> instead of C-casting (and split a long line) in the other place that allocates an OCIDateTime descriptor. Pick-to: 6.2 5.15 Task-number: QTBUG-98471 Change-Id: Idd5531d9f7101878802cb9a3a016d3fd80903543 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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>
* 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>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-3/+3
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-173/+171
| | | | | | | | | 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>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-4/+4
| | | | | | | | | 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>
* Remove QVariant(int type, void *data, ...) constructorLars Knoll2020-08-151-3/+2
| | | | | | | | It was marked internal anyway. Use the constructor taking a QMetaType instead. Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-1/+1
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use QList instead of QVector in pluginsJarek Kobus2020-07-061-21/+21
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix compilation of thee OCI driverLars Knoll2020-04-241-1/+1
| | | | | | | Amends change befd198c15b7a2b95f539372d2557063b6b397a6 Change-Id: I11cc116d31fa1f71acd9579e60a6b265811def1e Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Remove QRegExp usage from the the OCI pluginLars Knoll2020-03-171-4/+8
| | | | | | Change-Id: I95009b5bc6f9ce4356e707e07c5cb7346aaf9245 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* SQL: Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-1/+1
| | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: Ia4c698df60648c85c8e6132641e5ea7bc553129a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* oci: Use OCIBindByPos2 to accommodate data longer than USHRT_MAXAndy Shaw2018-04-061-3/+3
| | | | | | | | 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>
* SQL plugins: Fix warnings about deprecated constructor of QSqlErrorFriedemann Kleint2018-01-101-1/+2
| | | | | | | | Use the constructor taking a string and convert number unless it is -1. Change-Id: I18d1ba2c8e0d3f4af01b7955863967f75051746b Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * OCI: Match the constraints on the index_name columnAndy Shaw2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | When looking for the primary index, it is possible that the constraint_name in the all_ind_columns table does not match that of the index_name. Whereas the index_name will match in this case, so the query should set the where clause on the index_name in both tables. Task-number: QTBUG-64427 Change-Id: I1bf1fb580e620b9f75f2fde1ecf408842e377365 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-10-171-0/+9
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/fortuneclient/client.cpp examples/network/fortuneserver/server.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h src/plugins/platforms/cocoa/qcocoabackingstore.h src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoascreen.h src/plugins/platforms/ios/qiosbackingstore.h src/plugins/sqldrivers/oci/qsql_oci.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
| * OCI: Clear the cache in the result for a forward only queryAndy Shaw2017-10-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | When the query is forward-only then nextIndex() is always 0, therefore the cache values need to be cleared beforehand so that they are not reused when the next row is retrieved. Task-number: QTBUG-57765 Change-Id: I49e8427b24ec2d932e5b387699ac7f3496e9a48c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | OCI: Use TIMESTAMP for datetime dataAndy Shaw2017-10-101-85/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TIMESTAMP type has been available in Oracle since Oracle 9i which was released in June 2001 and contains more data than the DATE type so it can be reliably used for the related data types. This adds support for preserving milliseconds and the time zone information if this is passed or in the database. [ChangeLog][QtSql][OCI] Added support for the TIMESTAMP data type. Task-number: QTBUG-23 Change-Id: Icf7a012dda75fb342ce6c6aa34eaa2a52755ff2d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-11/+11
|/ | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QOCIDriver: Ensure the where clause is correctly setupAndy Shaw2017-01-051-3/+3
| | | | | | | | | | | | | | Commit 88e043a8 introduced two bugs: 1. When constructing the WHERE clause, the closing ' around the owner name was dropped. 2. When constructing QLatin1Strings for comparison with system owners, a size of -1 was passed, with the comment "force strlen call". But, unlike QString, QLatin1String does not invoke strlen(), but stores the negative length unchanged, making the comparisons always fail. Change-Id: Ie2835b76877c31ee32c900f67eb0853df7110dbb Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Always compile sql drivers as pluginsLars Knoll2016-04-071-0/+2725
Compiling the drivers into Qt Sql does not make a lot of sense anymore, as we handle plugins well enough in the build system these days. [ChangeLog][Build system] SQL drivers are now always compiled as plugins. Change-Id: I364b82a480849399d1fafe4b20e9f08922569260 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>