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>
This commit is contained in:
Thiago Macieira 2021-08-13 17:56:11 -07:00
parent 549ee216fd
commit 74705ae17b

View File

@ -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;