| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add option MYSQL_OPT_SSL_VERIFY_SERVER_CERT to disable ssl for MySQL
5.7.x and MariaDB. This is needed as MariaDB does not support the
SSL_MODE options but defaults to ssl nowadays.
Also enhance the documentation for MYSQL_OPT_TLS_VERSION and
MYSQL_OPT_SSL_MODE by providing the needed MySQL/MariaDB versions for
those options.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136550
Change-Id: If570cf8e92d0df7c9e2c4d0e009857eaf33f4f2d
Reviewed-by: Axel Spoerl <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
The correct define to check for MariaDB C Connector is
MARIADB_PACKAGE_VERSION_ID, not MARIADB_BASE_VERSION (which is a string
describing the server version the c connector relates to).
Pick-to: 6.9 6.8
Task-number: QTBUG-136550
Change-Id: I844900d9b6622fd3a72db63298e5c34de8a2f3dc
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
MySQL does understand ISO 8601 formatted datetime strings with
milliseconds so use Qt::ISODateWithMs instead Qt::ISODate within
formatValue().
Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-95071
Fixes: QTBUG-136042
Change-Id: I182475c706c8eda0e3f97e23d98d3f91e372244a
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We store timestamps as utc in the database but QSqlDriver::formatValue()
does not format the datetime string as utc. Fix it by converting the
datetime object to utc first.
This amends 2781c3b6248fe4410a7afffd41bad72d8567fc95
Pick-to: 6.9 6.8
Fixes: QTBUG-135135
Change-Id: Id26b251e9ed9800d6caff7f43de25fd9e9b08f43
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
...and fromUtf8() format strings.
QString::arg() is now available on QUtf8StringView, too and can handle
UTF-8 arguments directly.
Change-Id: Ifa8b1ea0f41414d15a6919b1967e0a45e4d7929f
Reviewed-by: Ahmad Samir <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Honor the schema when retrieving the table record - otherwise we might
end up getting the data for the wrong table (same tablename but wrong
schema).
Pick-to: 6.8
Fixes: QTBUG-127129
Task-number: QTBUG-122723
Change-Id: Ia3e9293dbdc77da760dd4d0702104048187fad5f
Reviewed-by: Axel Spoerl <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
| |
Use the categorized logger qt.sql.mysql
Change-Id: I7e6529025dceb81c47571c65b7aea9bd274814e2
Reviewed-by: Axel Spoerl <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The MYSQL_TIME structure doesn't support per-datum timezone and in any
case the server would not store it: the TIMESTAMP type is always stored
in UTC. So instead let's configure the session time zone to UTC and use
QDateTime to convert to/from it.
Fixes https://bugs.kde.org/show_bug.cgi?id=483060
[ChangeLog][SQL][MySQL] Fixed a bug in passing QDateTime to be passed as
local time to the server, regardless of the QDateTime's time zone
setting. This would cause certain timestamps to be rejected by the
server, such as a UTC time stamp whose time numerically matched the
local timezone's spring forward gap in the transition into Daylight
Savings Time.
Change-Id: I6818d78a57394e37857bfffd17bbce4ae43e823c
Reviewed-by: Christian Ehrlicher <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was the only place that called it. Makes the code slightly uglier,
but removes a function that returned a raw pointer. More importantly, it
gets the actual type from QVariant, without relying on it internally
converting from QDateTime to QDate and QTime, or failing to do so in
some cases. This is going to be needed for the next commit.
Pick-to: 6.5 6.6 6.7
Change-Id: I6818d78a57394e37857bfffd17bbcd3f5057eadc
Reviewed-by: Christian Ehrlicher <[email protected]>
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Retrieve the default value (if set) of a column during
QSqlDatabase::record() but not for QSqlQuery::record() as it's done for
the other drivers which support retrieving the default column value.
Fixes: QTBUG-122723
Change-Id: I92e052bfa6d88e019c0151fbcbc1483a65770c55
Reviewed-by: Axel Spoerl <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][QtSql] Added the ability to specify the MySQL/MariaDB
connection type using the "MYSQL_OPT_PROTOCOL" connection string
option. In case the connection type is "MEMORY" for shared memory,
applications can specify the shared memory segment name using the
"MYSQL_SHARED_MEMORY_BASE_NAME" option.
Fixes: QTBUG-2551
Change-Id: I91e0981994c045fb74478d0e765e2ec24eefeece
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Somewhere between libmysql 8.0.18 and 8.0.27, the MYSQL_TIME structure
gained an additional member which increased the struct size by 4 bytes.
This makes an internal check for the correct size of the structi go fail.
Since it can now happen that the plugin is linked against a new libmysql
and used with an old and the other way round, duplicate the old
MYSQL_TIME struct to use this in our code
Pick-to: 6.4 6.5
Fixes: QTBUG-110967
Change-Id: I5bc631179a0a1be47a5966954e757f27a72f1592
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Add the connect option MYSQL_OPT_LOCAL_INFILE to be able to specify the
client-side LOCAL capability for LOAD DATA operations
Fixes: QTBUG-104916
Change-Id: I9914250059e7dc1a705941d3b409fa624e105ecd
Reviewed-by: Andy Shaw <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Replace plain int with enum 'enum_field_types' and don't use deprecated
MySQL type names.
Pick-to: 6.4
Change-Id: I8a629ac1b4ad7d6d78604ff641b5b35397cd769c
Reviewed-by: Edward Welbourne <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
Add handling for MYSQL_TYPE_JSON by treating it the same as
MYSQL_TYPE_BLOB (which is used by current MariaDB Server for a json
column)
Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-101680
Change-Id: I4d4b0cdad73cd12e0db4df4021fddbd6a649c8ed
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Rework the parsing of client option to make it easier to add new
options. Add the two options MYSQL_OPT_SSL_CRL and MYSQL_OPT_SSL_CRLPATH
and deprecate the SSL_foo options without the MYSQL_OPT_ prefix.
Change-Id: Ibaf5f553d77d9c102ca2bfef2fe68be0572f594b
Reviewed-by: Thiago Macieira <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
| |
Cleanup the code a little bit and use qsizetype on some obvious places.
Change-Id: Ib9e5ec79a39c45c9fab7e21dbda70ed728025191
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
1df974590f19dec7b632d000ab9408a4de6f117a introduced a regression which
kills the escaping of a QByteArray because QString::fromUtf8() gets a
wrong length from a QVarLengthArray.
Pick-to: 6.4
Fixes: QTBUG-105078
Change-Id: Ic2f76c82c246e1e9eaf1d3f907d11fc345b5655e
Reviewed-by: Samuel Gaist <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Found by codespell
Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <[email protected]>
Reviewed-by: Edward Welbourne <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
Reviewed-by: Jörg Bornemann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 6feb28918924d80c94b6f435bc3bc981855d59d6. It causes
a crash when field.myField is null.
Fixes: QTBUG-102489
Pick-to: 6.3
Change-Id: I7e305799c8594ebab255fffd16ee1a41cac8d387
Reviewed-by: Andy Shaw <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
Including moc files directly into their classes' TU tends to improve
codegen and enables extended compiler warnings, e.g. about unused
private functions or fields.
Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-102886
Change-Id: Idf1a38d8a293e3cbf74443f00d2a9765eb68a9c0
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
| |
Task-number: QTBUG-98434
Change-Id: Ia621f9d937649dda41a7b0d13a61e6f1397f6dde
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
| |
Task-number: QTBUG-98434
Change-Id: Ie12ca82fd912617eabe4f602c08914f12878cb32
Reviewed-by: Volker Hilsheimer <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
| |
Change-Id: I9407c34c9fb6add655649dd7058bce7a25be5f5d
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
No point otherwise. But do it before trying to select the database, in
case the database name has non-US-ASCII characters.
Task-number: QTBUG-97054
Pick-to: 6.2 6.2.1
Change-Id: Iea05060bc2c046928536fffd16adf036367b07bb
Reviewed-by: Liang Qi <[email protected]>
|
|
|
|
|
|
|
|
|
| |
It returns zero on success and non-zero on failure.
Fixes: QTBUG-97054
Pick-to: 6.2 6.2.1
Change-Id: Iea05060bc2c046928536fffd16adf0177aadb082
Reviewed-by: Liang Qi <[email protected]>
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
We already do it for inputs but weren't doing it for outputs.
Change-Id: I4a40ccbd3321467a8429fffd169afeb5730ad75e
Reviewed-by: Andy Shaw <[email protected]>
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
| |
Complements commit 472520afb9081856a2556c7df221c084a42a2d42. We were
doing it twice.
Change-Id: I4a40ccbd3321467a8429fffd169b05fa5e22f204
Reviewed-by: Andy Shaw <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Reviewed-by: Fabian Vogt <[email protected]>
|
|
|
|
|
| |
Change-Id: I70dd492d5c8d198589bfd642db63182cf17b133f
Reviewed-by: Thiago Macieira <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|