| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
... instead three times in a row.
Pick-to: 6.7
Change-Id: If08b4c092cfb5b7d224f9a94afb7d395ce2b2eca
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
|
|
| |
To avoid usage errors like fixed with
7e5a0b54f0737986b6716bfce0a43eba2e62aae0
Pick-to: 6.7
Change-Id: I33af9721a04e80541c027fa6da8630070a5957ac
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
|
|
| |
Seems to have been left out by 874f5c1f463cad61f49e0ff7007852a73fd93e7c
Pick-to: 6.7
Fixes: QTBUG-123478
Change-Id: Ic028c3786203cbc1c3d7316c1ae22c12a928b170
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
|
|
|
|
|
|
|
|
|
|
|
| |
We must not try to escape a driver string, the user has to make sure
that everything is correctly escaped when passing a complete driver
string. This fixes a regression from QTBUG-122642.
Pick-to: 6.7
Fixes: QTBUG-123444
Change-Id: I43316c7a09060f5c8117fdc3c464d239e37d9cdf
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... but use QStringView instead in setConnectionOptions() and the
dependent functions.
Also remove the (undocumented) ability to pass the connection options in
non-uppercase - this was never supported and all other plugins don't
support this either.
[ChangeLog][SQL][ODBC] All options must now be upper-cased as documented. Lower-cased options are no longer supported.
Change-Id: I822db1ddf205c22fe939299c4ab741bbe9b56d65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
| |
Use the categorized logger qt.sql.odbc
Change-Id: I1411e80fa33582857bafdf77baee75b293df56af
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
Replace all qWarning() with qSqlWarning() to be able to get additional
error/warning output from the handles.
Change-Id: Ieaa947fe06216b3d20b20c509080fc409803683b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
|
| |
This value does not change over time so no need to retrieve it from the
driver for every call. As a drive-by change the enum to an enum class.
Change-Id: I25292d724f5173fef7054bb5e7e82e82992e41c6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Values in connection strings must be escaped when they
- contain a ; -> escape with "
- start with ' -> escape with "
- start with " -> escape with '
Fixes: QTBUG-122642
Pick-to: 6.7
Change-Id: I1df638194067af5df94a34009e1547886fdf928c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
... 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>
|
|
|
|
|
|
|
|
|
| |
... 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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
MSSql Server sometimes returns SQL_SS_TIME2 instead SQL_TIME. Since this
value is non-standard, we have to define it by ourself.
Pick-to: 5.15 6.2 6.4 6.5
Fixes: QTBUG-109206
Change-Id: I40a4b32590d877ebfdc4b2f1d9080d8cdb2ae7a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
SQLGetData was called with a nullptr for the output buffer to determine
the buffer length which is not allowed. Fix it by passing a valid buffer
with a buffer size of 0.
Fixes: QTBUG-70362
Fixes: QTBUG-110803
Change-Id: I4d547383100714901a4e2ca3b4777326cfab12fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
| |
Optimize the QVarLengthArray usage by passing the prealloc size and
directly initializing the allocated memory instead using a memset
where needed.
Change-Id: I61c6f9387fae63ae0c62ee1e87d3b3a7430369b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
| |
Change fromSQLTCHAR() to honor the fact that we know the size of
SQLTCHAR during compile time.
Change-Id: I1cebf2550be7228980083703e143c7577e8ad377
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
| |
This ensures the tst_QSqlQuery::record() test passes when checking the
tablename.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I146f9f627ea366c6813af61ce48b930ca1041b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Cleanup the codebase a little bit:
- move loop variable into for scope
- use utils functions instead homebrew
- avoid use of const_cast<>
- simplify splitTableQualifier()
Change-Id: I6962f01c94a6b4e0e38ad1b229cdf6e8b3308c78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
| |
Avoid an unneeded copy in toSQLTCHAR() when sizeof(SQLTCHAR) == 1 or 4
by directly writing the encoded data into the QVarLengthArray.
Change-Id: Ic4180343764fa1ca175a9cdd444c5359d664c754
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
string lengths
We already fixed the implementation of toSQLTCHAR() in
66767eea46bea0f19f8ae5ad6ebc641d86867701 to not assume that a UTF-8 or
UTF-32-encoded string has the same number of code points as the
equivalent UTF-16 string, but it turns out that users of the function,
as well as other code, also failed to account for this.
This patch fixes callers of toSQLTCHAR() to use
const auto encoded = toSQLTCHAR(s);
~~~ use encoded.data(), encoded.size() ~~~
(except we can't make `encoded` const, because the SQL API isn't
const-correct and takes void* instead of const void*) instead of the
anti-pattern
~~~ use toSQLTCHAR(s).data(), s.size() ~~~
As a drive-by:
- Extract Method qt_string_SQLSetConnectAttr()
- skipping an unneeded .utf16() call (a NUL-terminated string is not
required for calling toSQLTCHAR())
- de-duplicate some code in exec()
- and make a comment there slightly more informative
- replace
- NULL with nullptr
- size() == 0 with isEmpty()
- C-style with constructor-style casts
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I3696381d0a93af8861ce2b7915f212d9e5e9a243
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The QByteArray is assumed to contain an SQLTCHAR string (so, either
UTF-8, UTF-16 or UTF-32-encoded). Only in the UTF-8 case would the
size of the byte array be the same as the size of the SQLTCHAR string
in codepoints, yet the size in bytes is what the code passed to the
QVLA<SQLTCHAR> append() call, causing it to read past the QByteArray
buffer in the UTF-16 and UTF-32 cases.
Fix by properly calculating the string size from the size-in-bytes and
then memcpy()ing into the QVLA. We use memcpy() and not
QVLA::append(T*, n) because the QByteArray buffer need not be aligned
on an alignof(SQLTCHAR) boundary (certainly not since it gained the
prepend "optimization").
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: If3838c3dee89e6aca65541242642315b8e1fa6b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Neither the UTF-32, nor the UTF-8 recoding of a UTF-16 string is
necessarily of the same length as the input. The UTF-32 version may
be shorter, if surrogate pairs were encountered. The UTF-8 version
will be longer whenever the string contains non-US-ASCII characters.
Split toSQLTCHAR() into three functions, templated on sizeof(SQLTCHAR),
and use QVLA's range-append instead of manual memcpy()s.
This patch specifically doesn't use constexpr-if, as that's not
available until C++17, which Qt 5 doesn't require.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I0bfcb66eb321598908ef00ac34c888fdbccf9316
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Qt6 added a slight behavior change in QVariant - an empty QString in a
QVariant no longer results in QVariant::isNull(). This created an issue
that qGetStringData() could no longer return a NULL value. On the other
side, NULL values in Qt5 could not be distinguished to an empty string
which we now can.
Fixes: QTBUG-106607
Pick-to: 6.2
Change-Id: Iddc6f7e8b97f5abc136bbbfd02d175b80152ac90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
QODBCResult::isNull() incorrectly checked for the validity of the
internal row cache which lead to wrong results when the requested
column was not yet cached.
Pick-to: 6.4 6.2 5.15
Change-Id: Ic7dcc2117e6f05b63c83f21c6a84ba7e0bda2b2d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Task-number: QTBUG-98434
Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: I70dd492d5c8d198589bfd642db63182cf17b133f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
Add metaType()/setMetaType() methods to be used instead
of the type() methods taking a QVariant::Type.
Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
|
|
|
|
|
|
|
|
| |
It was marked internal anyway. Use the constructor taking a
QMetaType instead.
Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
kernel\qmetaobjectbuilder.cpp(1279): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
kernel\qmetaobjectbuilder.cpp(1432): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
sax\qxml.cpp(1275): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data
text\qtextengine.cpp(2664): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
text\qtextengine.cpp(2665): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
text\qtextengine.cpp(2706): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
text\qtextengine.cpp(2707): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
itemviews\qbsptree.cpp(60): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
kernel\qprintengine_win.cpp(1558): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
qsql_odbc.cpp(804): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data
qsql_odbc.cpp(822): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data
qsql_odbc.cpp(1585): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
qsql_odbc.cpp(1602): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
windows\qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
Change-Id: I04fbe17b9782f4c2704933fc005449b1e992475e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
|
|
| |
Task-number: QTBUG-84469
Change-Id: Ic86f4a3000592a1c9ae62e4a83f4fe39832a6b24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going
to be deprecated. Use the newer fromUtf16(char16_t*) and
fromUcs4(char32_t*) overloads.
As a drive-by, use std::end()/std::size() where applicable.
Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
qsql_odbc.cpp(1589): warning C4267: 'argument': conversion from 'size_t'
to 'int', possible loss of data
Change-Id: Ib36fda3e3b21bdbc8b343ae5136542dfcf3c1065
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
| |
Change-Id: Ib94b9a4e6e17da21f592e71a36fd1b97d42dfe62
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
|
|\
| |
| |
| | |
Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
|