@@ -1094,14 +1094,14 @@ static void qLibraryInit()
10941094 }
10951095#endif // Q_NO_MYSQL_EMBEDDED
10961096
1097- #if defined(MARIADB_BASE_VERSION) || defined(MARIADB_VERSION_ID )
1097+ #if defined(MARIADB_PACKAGE_VERSION_ID )
10981098 qAddPostRoutine ([]() { mysql_server_end (); });
10991099#endif
11001100}
11011101
11021102static void qLibraryEnd ()
11031103{
1104- #if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID )
1104+ #if !defined(MARIADB_PACKAGE_VERSION_ID )
11051105# if !defined(Q_NO_MYSQL_EMBEDDED)
11061106 mysql_library_end ();
11071107# endif
@@ -1360,7 +1360,7 @@ bool QMYSQLDriver::open(const QString &db,
13601360
13611361 // try utf8 with non BMP first, utf8 (BMP only) if that fails
13621362 static const char wanted_charsets[][8 ] = { " utf8mb4" , " utf8" };
1363- #ifdef MARIADB_VERSION_ID
1363+ #if defined(MARIADB_PACKAGE_VERSION_ID)
13641364 MARIADB_CHARSET_INFO *cs = nullptr ;
13651365 for (const char *p : wanted_charsets) {
13661366 cs = mariadb_get_charset_by_name (p);
@@ -1512,7 +1512,7 @@ QSqlRecord QMYSQLDriver::record(const QString &tablename) const
15121512 + d->dbName + " ' AND table_name = '%1'" _L1;
15131513 const auto baTableName = tablename.toUtf8 ();
15141514 QVarLengthArray<char > tableNameQuoted (baTableName.size () * 2 + 1 );
1515- #if defined(MARIADB_VERSION_ID )
1515+ #if defined(MARIADB_PACKAGE_VERSION_ID )
15161516 const auto len = mysql_real_escape_string (d->mysql , tableNameQuoted.data (),
15171517 baTableName.data (), baTableName.size ());
15181518#else
@@ -1614,15 +1614,15 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons
16141614 }
16151615 Q_FALLTHROUGH ();
16161616 case QMetaType::QDateTime:
1617- if (QDateTime dt = field.value ().toDateTime (); dt.isValid ()) {
1617+ if (QDateTime dt = field.value ().toDateTime (). toUTC () ; dt.isValid ()) {
16181618 // MySQL format doesn't like the "Z" at the end, but does allow
16191619 // "+00:00" starting in version 8.0.19. However, if we got here,
16201620 // it's because the MySQL server is too old for prepared queries
16211621 // in the first place, so it won't understand timezones either.
16221622 r = u' \' ' +
16231623 dt.date ().toString (Qt::ISODate) +
16241624 u' T' +
1625- dt.time ().toString (Qt::ISODate ) +
1625+ dt.time ().toString (Qt::ISODateWithMs ) +
16261626 u' \' ' ;
16271627 }
16281628 break ;
0 commit comments