summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add security tags to the Qt Sql moduleVolker Hilsheimer2025-09-171-0/+1
| | | | | | | | | | | | | | Tag code that constructs SQL statements, parses results, or deals with user credentials as security critical. This is the driver code, the implementation of QSqlResult, QSqlTableModel, and the QSqlDatabase implementation (which deals with, and optionally stores, credentials). The rest of the code is not critical and gets the default tag. Fixes: QTBUG-135591 Pick-to: 6.10 6.9 6.8 Change-Id: I18fb565fd27ed8d1c9c1f3a1f572816b718eb3e8 Reviewed-by: Mate Barany <mate.barany@qt.io>
* SQL/IBase fix compile with ancient Firebird 2.xChristian Ehrlicher2025-08-081-0/+5
| | | | | | | | | | | Firbird 2.5 added SQL_BOOLEAN in 2014 (https://www.firebirdsql.org/file/community/conference-2014/pdf/02_fb.2014.whatsnew.30.en.pdf). Simply add the missing define to fix compilation. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-138904 Change-Id: I4bd4a04be46a844fa18506b1a298b984a0299cbb Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/Firebird: Fix interpretation of time stamp with timezoneAndreas Bacher2024-09-121-3/+7
| | | | | | | | | | The firebird api expects the timestamp (ISC_TIMESTAMP_TZ) of a timestamp with time zone is provided in UTC. Pick-to: 6.8 6.7 Task-number: QTBUG-128493 Change-Id: Iacc85ca1141407f5ab73fd0198c7b2db770bf589 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Johann Anhofer <johann.anhofer@meon-medical.com>
* SQL/IBase: Don't let open() fail when lastError() is setChristian Ehrlicher2024-07-181-5/+0
| | | | | | | | | | | | | | | | Since QSqlDriver::lastError() always contains the last error, it is not a valid source to check if the last operation failed or not. Therefore remove the check for lastError() when initializing the timezone mapping - the function is optional since an old database might not contain the timezone mapping table which is perfectly fine. Pick-to: 6.8 Fixes: QTBUG-127175 Task-number: QTBUG-125467 Change-Id: I22ea75c004654cead9a4461d2eaccfcbe8a116be Reviewed-by: Andreas Bacher <andi.bacher@outlook.com> Reviewed-by: Hamish Moffatt <hamish@risingsoftware.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Straighten out various logging categoriesUlf Hermann2024-06-191-1/+1
| | | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I6f3b596ed4f0adc9873dd0a5f54f055a991a6207 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/IBase: simplify date/time conversionChristian Ehrlicher2024-06-121-46/+24
| | | | | | | | | | Simplify date/time conversion by using QTime::fromMSecsSinceStartOfDay() / QTime::toMSecsSinceStartOfDay() and avoiding some intermediate variables. Pick-to: 6.8 Change-Id: I16e673405a347417866cdf100a13d817c1b17ff8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* SQL/IBase: Fix some translatable messagesFriedemann Kleint2024-06-101-2/+2
| | | | | | | | Amends 4b0b41ec3b362715012f8c771b72c4704f8170f3. Pick-to: 6.8 Change-Id: If51e22fb9b19755a0d8f222f8c0044563f8c55f8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* SQL/IBase: code cleanup part 5/5Christian Ehrlicher2024-06-071-9/+14
| | | | | | | | Make some untranslated texts translatable. Pick-to: 6.8 Change-Id: I636cdcaff749d6770d82095e4a2381097f83ed2c Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: code cleanup part 4/5Christian Ehrlicher2024-06-071-24/+20
| | | | | | | | | Make sure that QByteArray does not detach when not needed and avoid some copies by using QByteArray::fromRawData(). Pick-to: 6.8 Change-Id: I4454a3113c6bd1fe30b404af091f5cc0f904f78a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: code cleanup part 3/5Christian Ehrlicher2024-06-071-12/+15
| | | | | | | | Pass 'const char *' when the string doesn't get modified. Pick-to: 6.8 Change-Id: I8b2e06b027362debcd81282dc3123235a7e643a3 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: code cleanup part 2/5Christian Ehrlicher2024-06-071-7/+10
| | | | | | | | | | The lower bit of the sqltype is used to express NULL values and needs therefore masked out. Do this before the acutal operations for better readability/debugability. Pick-to: 6.8 Change-Id: I71ee97f4c38241ccc9804562e2826ce9b53567ba Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: code cleanup part 1/5Christian Ehrlicher2024-06-071-58/+60
| | | | | | | | | | Cleanup the code by replacing repeated access to sqlda->sqlvar[] with a temporary (const) ref to enhance readability and avoid repeated lookups. Pick-to: 6.8 Change-Id: I716812f4446bac7fb3e92bc6fbb099845836624f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
* SQL/IBase: cache return value of record()Christian Ehrlicher2024-06-051-6/+9
| | | | | | | | | Cache the return value of QIBaseResult::record() to avoid the recreation (e.g. when using QSqlQuery::value(QString) instead index-based ones). Pick-to: 6.8 Change-Id: I88568d99ba96e19ae6b661d058e7709ebc5ef2a2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase use QT_USE_MSVC_INT128Christian Ehrlicher2024-06-051-1/+1
| | | | | | | | | | ... instead Q_CC_MSVC to be in sync with qlocale_tools_p.h and avoid compiler erros when used with msvc versions not providing int128 support. Pick-to: 6.8 Change-Id: Ia2166a6260a9340a5e5bbca3f46c3b77a9f8d50d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: add partial support for SQL_INT128 datatypeChristian Ehrlicher2024-06-051-0/+4
| | | | | | | | | | | | The previous patch missed the handling of SQL_INT128 in qIBaseTypeName2(). This amends 373ae6cbd24cf0ddbed453e14b1f683e76c92bb5 Pick-to: 6.8 Change-Id: I646bd5af23c14761195f9c1089dc4cbbe2e94790 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
* SQL/IBase: add partial support for SQL_INT128 datatypeChristian Ehrlicher2024-05-251-21/+71
| | | | | | | | | | | | | | | | Implement partial support for SQL_INT128 datatype which is used for DECIMAL/NUMERIC columns with a precision > 18. This support is only available when QT_SUPPORTS_INT128 is defined and for MSVC. Binding values to columns which need SQL_INT128 is supported but numbers given as QString will be converted to doubles even if QSql::HighPrecision is set. [ChangeLog][SQL][IBASE] Added support for SQL_INT128 datatype. Task-number: QTBUG-124575 Change-Id: If3fb1eb0f19dc60f000d163f3bf45da7acb08c87 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
* SQL/IBase: factor out setting numeric valuesChristian Ehrlicher2024-05-251-20/+17
| | | | | | | Factor out setting numeric values for better readability. Change-Id: I8980c63e87934e3bc3777897e9cd42aef17caf51 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* SQL/IBase: don't let open() fail when no timezones are availableChristian Ehrlicher2024-05-231-11/+4
| | | | | | | | | | | | When connecting to an old Firebird instence with a Qt Firebird plugin linked against Firebird >= 4 the timezone table is not available and therefore open() will fail. Therefore downgrade the non-existence of this table to a qCInfo(). Fixes: QTBUG-125467 Change-Id: Iae6d110bc2a48b5b90ffb9cb38f3fba60f30770f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
* QSql/IBase: fix compilationChristian Ehrlicher2024-05-021-0/+1
| | | | | | | | Looks like the CI does not compile the IBase/Firebird plugin so this compile error slipped through. Change-Id: I2e20088e10baa91f2e1e5e2b5656dfb7bdf42896 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* SQL/IBase: factor out applying decimal scale into own functionChristian Ehrlicher2024-04-271-37/+51
| | | | | | | | Move the calculation of the decimal scale into own function and preserve HighPrecision string values by not converting them into doubles before. Change-Id: I839923189e9f6b1f8fb9ce234c987423703b79bf Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: print warning in case of unsupported data typeChristian Ehrlicher2024-04-261-1/+6
| | | | | | | | Print a warning when we encounter an unsupported data type. Pick-to: 6.7 6.5 Change-Id: If35ac4dfdf29e555ec406f592c1001b5e16f8ff2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/IBase: use categorized loggerChristian Ehrlicher2024-04-121-20/+23
| | | | | | | Use the categorized logger qt.sql.ibase Change-Id: Id7cdc54b8b01ee5af0526e3c522c2511697380d3 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-101-2/+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 plugins: add moc includesChristian Ehrlicher2023-07-191-0/+2
| | | | | Change-Id: I9ed4b63fd02b4a6fc5f4b614466590cd099609e2 Reviewed-by: Andy Shaw <andy.shaw@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>
* SQL: replace qPrintable() / toLocal8Bit() with unicode versionsChristian Ehrlicher2023-04-181-7/+7
| | | | | | | Replace qPrintable() and toLocal8Bit() with qUtf16Printable() Change-Id: Id30b5ba611b005faab91a08b10a9dc5569fd7a07 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/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>
* 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/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: 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>
* 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-33/+35
| | | | | | 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-24/+24
| | | | | | | | | | | 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>
* qsql_ibase: fix includesShawn Rutledge2022-03-211-13/+14
| | | | | | | | | QMap was a transitive include, apparently; and we have mostly standardized on specifying the module where each include comes from. Change-Id: I1a54db879e744120f5b10eb0b16f8ba36cde8300 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Adapt SQL drivers to Qt 6 change of QVariant::isNullVolker Hilsheimer2022-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* sqldrivers: Fix typo in error messageJonas Kvinge2021-10-181-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6354275d04ee9474d4baeaaf0b14a52aca3dd70c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* ibase: Fix the compilation and include it again so it can be detectedAndy Shaw2021-01-261-17/+19
| | | | | Change-Id: I38721155f090173862da8beab8cb04b2e015dcff Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* 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>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-6/+6
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-46/+46
| | | | | | | | | 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-2/+2
| | | | | | | | | 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>
* Interbase: Add support for the boolean typeAndy Shaw2020-09-111-1/+22
| | | | | | | | | | | | | This is added to Interbase in v7 and Firebird in v3 which has been available for sometime now. This means the minimum supported for Interbase is now v7. [ChangeLog][QtSQL][Interbase] The minimum required version for Interbase is now v7. Fixes: QTBUG-83401 Change-Id: I9927fd962f25c935be8ed5d2b7c76c00fb88cd8c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Interbase: Correctly read/write arrays to the databaseAndy Shaw2020-09-081-17/+3
| | | | | | | | | | | The fix ensures that it can find the column for the array correctly when reading/writing and also handles the integer typed arrays correctly too. Pick-to: 5.15 Fixes: QTBUG-83409 Change-Id: I92d982bdf0927e6ebc6dce84fec9ad6c44c26c25 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Interbase: Close the cursor before reopening it later onAndy Shaw2020-08-231-3/+3
| | | | | Change-Id: If21d33262b8ca53c17a7d236baaa828907116cab Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QVariant(int type, void *data, ...) constructorLars Knoll2020-08-151-2/+2
| | | | | | | | It was marked internal anyway. Use the constructor taking a QMetaType instead. Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce maximumIdentifierLength to return database limits for namesAndy Shaw2020-08-111-0/+6
| | | | | | | | | Since Interbase/Firebird has a limit for column and table names then this function can be used by QSqlRelationalTableModel to make sure that the aliases created are within that limit. Change-Id: I0cb1c65b34befcb3690ccad3f081556dd2691344 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Interbase: Don't call toUpper() on the names as they are escapedAndy Shaw2020-08-101-2/+2
| | | | | | | | | | Interbase is case sensitive when tables/fields are escaped so we should ensure that we pass the value as is. Pick-to: 5.15 Change-Id: Ia6c4edc9c1e675bd95913c85d47bf22c418d2113 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>