Zeos 7.3 + MySQL TWideString.AsBytes trimmed
Posted: 21.09.2020, 21:07
I guess this will be more likely a metadata issue, but here we go.
MySQL 8.0.18, client version: 8.0.18, database access component version: 7.3.1-b99a7ce8
I run the query: "SHOW ENGINE INNODB STATUS"
And then, I am trying to get the "status" field by bytes (var tb = query.FieldByName('Status').AsBytes)
Instead of the 9-something thousand bytes, I get 80 in the array.
The trimming happens at TZAbstractRODataSet.GetFieldData, line 2787
blen is 9792 (then becomes 19584 after the SHL), that is equal to Length(PWideChar(P)). Checking with the debugger, PWideChar(P) seems to contain all the text, so all is fine until this line.
Then, the problem comes. Field.FSize is 40, so Field.DataSize returns 82. As blen is far greater than this amount it is simply trimmed at 82 - 2 = 80 byte(s), which is 40 characters in Unicode.
I know that this is not a real table, but shouldn't the correct metadata be returned by the SQL server anyway?
MySQL 8.0.18, client version: 8.0.18, database access component version: 7.3.1-b99a7ce8
I run the query: "SHOW ENGINE INNODB STATUS"
And then, I am trying to get the "status" field by bytes (var tb = query.FieldByName('Status').AsBytes)
Instead of the 9-something thousand bytes, I get 80 in the array.
The trimming happens at TZAbstractRODataSet.GetFieldData, line 2787
Code: Select all
2784 begin
2785 blen := blen shl 1;
2786 if blen >= NativeUint(Field.DataSize-2) then
2787 blen := NativeUint(Field.DataSize-2);
2788 Move(P^, Pointer(Buffer)^, blen);
2789 PWord(PAnsiChar(Buffer)+blen)^ := 0;
2790 end;
Then, the problem comes. Field.FSize is 40, so Field.DataSize returns 82. As blen is far greater than this amount it is simply trimmed at 82 - 2 = 80 byte(s), which is 40 characters in Unicode.
I know that this is not a real table, but shouldn't the correct metadata be returned by the SQL server anyway?