summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-08-13 17:56:11 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-08-17 17:20:03 -0700
commit74705ae17b29ad560d1d6ad741bdb065ad7a0751 (patch)
tree31bf973e38a77e0e9b589aab6e67a6732042df19 /src/plugins/sqldrivers/mysql/qsql_mysql.cpp
parent549ee216fd5bf2b3810e940bcbd4bbd8c64ac73f (diff)
MySQL: don't allocate 1-byte buffers for BLOBs
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 <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/mysql/qsql_mysql.cpp')
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 95d5bb3b12..69077f2fc8 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -364,7 +364,7 @@ bool QMYSQLResultPrivate::bindInValues()
bind->length = &f.bufLength;
bind->is_unsigned = fieldInfo->flags & UNSIGNED_FLAG ? 1 : 0;
- char *field = new char[bind->buffer_length + 1]{};
+ char *field = bind->buffer_length ? new char[bind->buffer_length + 1]{} : nullptr;
bind->buffer = f.outField = field;
++i;