[neon/qt/qtbase/Neon/release] debian: Backport upstream patch to remove MySQL version checks.
Dmitry Shachnev
null at kde.org
Thu May 5 10:59:24 BST 2022
Git commit 10932c6c980ad86e50ccbff068ca3529c046ea67 by Dmitry Shachnev.
Committed on 10/08/2021 at 17:59.
Pushed by jriddell into branch 'Neon/release'.
Backport upstream patch to remove MySQL version checks.
Which led to wrong conclusions with MariaDB Connector ≥ 3.2.
Thanks to Sune Vuorela for the hint!
M +2 -0 debian/changelog
A +44 -0 debian/patches/mysql_remove_version_checks.diff
M +1 -0 debian/patches/series
https://invent.kde.org/neon/qt/qtbase/commit/10932c6c980ad86e50ccbff068ca3529c046ea67
diff --git a/debian/changelog b/debian/changelog
index 8ba46a3..8b48433 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ qtbase-opensource-src (5.15.2+dfsg-10) UNRELEASED; urgency=medium
[ Dmitry Shachnev ]
* Backport upstream patch to fix icon display on checkable QPushButtons
with Fusion style (closes: #991255).
+ * Backport upstream patch to remove MySQL version checks, which led to
+ wrong conclusions with MariaDB Connector ≥ 3.2.
-- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Tue, 10 Aug 2021 14:22:02 +0300
diff --git a/debian/patches/mysql_remove_version_checks.diff b/debian/patches/mysql_remove_version_checks.diff
new file mode 100644
index 0000000..40b7f1d
--- /dev/null
+++ b/debian/patches/mysql_remove_version_checks.diff
@@ -0,0 +1,44 @@
+Description: remove the version number checks in favor of actual functionality
+ 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.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=211369133cf40b2f
+Last-Update: 2021-08-10
+
+--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
++++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+@@ -158,6 +158,20 @@ static inline QVariant qDateTimeFromStri
+ #endif
+ }
+
++// check if this client and server version of MySQL/MariaDB support prepared statements
++static inline bool checkPreparedQueries(MYSQL *mysql)
++{
++ std::unique_ptr<MYSQL_STMT, decltype(&mysql_stmt_close)> stmt(mysql_stmt_init(mysql), &mysql_stmt_close);
++ if (!stmt)
++ return false;
++
++ static const char dummyQuery[] = "SELECT ? + ?";
++ if (mysql_stmt_prepare(stmt.get(), dummyQuery, sizeof(dummyQuery) - 1))
++ return false;
++
++ return mysql_stmt_param_count(stmt.get()) == 2;
++}
++
+ class QMYSQLResultPrivate;
+
+ class QMYSQLResult : public QSqlResult
+@@ -1371,8 +1385,7 @@ bool QMYSQLDriver::open(const QString& d
+ }
+ #endif // MYSQL_VERSION_ID >= 50007
+
+- d->preparedQuerysEnabled = mysql_get_client_version() >= 40108
+- && mysql_get_server_version(d->mysql) >= 40100;
++ d->preparedQuerysEnabled = checkPreparedQueries(d->mysql);
+
+ #if QT_CONFIG(thread)
+ mysql_thread_init();
diff --git a/debian/patches/series b/debian/patches/series
index 2277fb7..1956da4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,6 +8,7 @@ fix-invalid-pointer-return-with-QGridLayout.diff
fix-misplacement-of-placeholder-text-in-QLineEdit.diff
fix-placement-of-placeholder-text-in-QLineEdits-with-action-icons.diff
fusion_checkable_qpushbutton.diff
+mysql_remove_version_checks.diff
# Debian specific.
gnukfreebsd.diff
More information about the Neon-commits
mailing list