[neon/qt/qtbase/Neon/release] debian: Backport upstream patch to treat MYSQL_FIELD as read-only.
Dmitry Shachnev
null at kde.org
Thu May 5 10:59:25 BST 2022
Git commit bd4a9c21c0fffaa0301567b70bf62aa259f9a169 by Dmitry Shachnev.
Committed on 13/11/2021 at 13:53.
Pushed by jriddell into branch 'Neon/release'.
Backport upstream patch to treat MYSQL_FIELD as read-only.
To fix issues with MariaDB server 10.6.
Closes: #999595.
M +4 -0 debian/changelog
A +80 -0 debian/patches/mysql_field_readonly.diff
M +1 -0 debian/patches/series
https://invent.kde.org/neon/qt/qtbase/commit/bd4a9c21c0fffaa0301567b70bf62aa259f9a169
diff --git a/debian/changelog b/debian/changelog
index a49527a..33c73cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,10 @@ qtbase-opensource-src (5.15.2+dfsg-13) UNRELEASED; urgency=medium
* Backport upstream patch to fix recursion crash when calling
setStyleSheet with `qproperty-styleSheet`: fix_recursion_crash.diff.
+ [ Dmitry Shachnev ]
+ * Backport upstream patch to treat MYSQL_FIELD as read-only, to fix issues
+ with MariaDB server 10.6 (closes: #999595).
+
-- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Sat, 13 Nov 2021 16:20:31 +0300
qtbase-opensource-src (5.15.2+dfsg-12) unstable; urgency=medium
diff --git a/debian/patches/mysql_field_readonly.diff b/debian/patches/mysql_field_readonly.diff
new file mode 100644
index 0000000..c33b752
--- /dev/null
+++ b/debian/patches/mysql_field_readonly.diff
@@ -0,0 +1,80 @@
+Description: treat the MYSQL_FIELD as read-only
+ 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.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=549ee216fd5bf2b3
+Last-Update: 2021-11-13
+
+--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
++++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+@@ -223,7 +223,7 @@ public:
+ struct QMyField
+ {
+ char *outField = nullptr;
+- MYSQL_FIELD *myField = nullptr;
++ const MYSQL_FIELD *myField = nullptr;
+ QMetaType::Type type = QMetaType::UnknownType;
+ my_bool nullIndicator = false;
+ ulong bufLength = 0ul;
+@@ -361,11 +361,10 @@ static bool qIsInteger(int t)
+ void QMYSQLResultPrivate::bindBlobs()
+ {
+ int i;
+- MYSQL_FIELD *fieldInfo;
+ MYSQL_BIND *bind;
+
+ for(i = 0; i < fields.count(); ++i) {
+- fieldInfo = fields.at(i).myField;
++ const MYSQL_FIELD *fieldInfo = fields.at(i).myField;
+ if (qIsBlob(inBinds[i].buffer_type) && meta && fieldInfo) {
+ bind = &inBinds[i];
+ bind->buffer_length = fieldInfo->max_length;
+@@ -392,35 +391,34 @@ bool QMYSQLResultPrivate::bindInValues()
+ inBinds = new MYSQL_BIND[fields.size()];
+ memset(inBinds, 0, fields.size() * sizeof(MYSQL_BIND));
+
+- MYSQL_FIELD *fieldInfo;
++ const MYSQL_FIELD *fieldInfo;
+
+ while((fieldInfo = mysql_fetch_field(meta))) {
++ MYSQL_BIND *bind = &inBinds[i];
++
+ QMyField &f = fields[i];
+ f.myField = fieldInfo;
+-
++ bind->buffer_length = f.bufLength = fieldInfo->length + 1;
++ bind->buffer_type = fieldInfo->type;
+ f.type = qDecodeMYSQLType(fieldInfo->type, fieldInfo->flags);
+ if (qIsBlob(fieldInfo->type)) {
+ // the size of a blob-field is available as soon as we call
+ // mysql_stmt_store_result()
+ // after mysql_stmt_exec() in QMYSQLResult::exec()
+- fieldInfo->length = 0;
++ bind->buffer_length = f.bufLength = 0;
+ hasBlobs = true;
+ } else if (qIsInteger(f.type)) {
+- fieldInfo->length = 8;
++ bind->buffer_length = f.bufLength = 8;
+ } else {
+- fieldInfo->type = MYSQL_TYPE_STRING;
++ bind->buffer_type = MYSQL_TYPE_STRING;
+ }
+- bind = &inBinds[i];
+- field = new char[fieldInfo->length + 1];
+- memset(field, 0, fieldInfo->length + 1);
+
+- bind->buffer_type = fieldInfo->type;
+- bind->buffer = field;
+- bind->buffer_length = f.bufLength = fieldInfo->length + 1;
+ bind->is_null = &f.nullIndicator;
+ bind->length = &f.bufLength;
+ bind->is_unsigned = fieldInfo->flags & UNSIGNED_FLAG ? 1 : 0;
+- f.outField=field;
++
++ char *field = new char[bind->buffer_length + 1]{};
++ bind->buffer = f.outField = field;
+
+ ++i;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index b2e979b..20e561f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,6 +12,7 @@ mysql_remove_version_checks.diff
full_width_selection_rtl.diff
xcb_add_a_timeout_control_when_reading_INCR_property.diff
fix_recursion_crash.diff
+mysql_field_readonly.diff
# Debian specific.
gnukfreebsd.diff
More information about the Neon-commits
mailing list