mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
The mysql protocol is broken design-wise a couple of places, this is one of them. The server sends us a string, but doesn't tell which encoding it's in.
Rewrite the old code a bit to make the automatic PChar->WideString conversion explicit, also add a block of code that tries to guess if the server is sending UTF-8 and react properly to that. A step on the way to fixing issue #994.
This commit is contained in:
@@ -262,9 +262,18 @@ begin
|
||||
begin
|
||||
FieldFlags := FPlainDriver.GetFieldFlags(FieldHandle);
|
||||
|
||||
ColumnLabel := FPlainDriver.GetFieldName(FieldHandle);
|
||||
ColumnName := FPlainDriver.GetFieldOrigName(FieldHandle);
|
||||
TableName := FPlainDriver.GetFieldTable(FieldHandle);
|
||||
// Note: the server does not tell us which character set these are
|
||||
// encoded in, it's not part of the protocol spec. Have to
|
||||
// make a more or less qualified guess, unfortunately.
|
||||
if not ((Statement.GetConnection) as IZMySQLConnection).GetAnsiMode then begin
|
||||
ColumnLabel := UTF8Decode(FPlainDriver.GetFieldName(FieldHandle));
|
||||
ColumnName := UTF8Decode(FPlainDriver.GetFieldOrigName(FieldHandle));
|
||||
TableName := UTF8Decode(FPlainDriver.GetFieldTable(FieldHandle));
|
||||
end else begin
|
||||
ColumnLabel := WideString(FPlainDriver.GetFieldName(FieldHandle));
|
||||
ColumnName := WideString(FPlainDriver.GetFieldOrigName(FieldHandle));
|
||||
TableName := WideString(FPlainDriver.GetFieldTable(FieldHandle));
|
||||
end;
|
||||
ReadOnly := (FPlainDriver.GetFieldTable(FieldHandle) = '');
|
||||
Writable := not ReadOnly;
|
||||
ColumnType := ConvertMySQLHandleToSQLType(FPlainDriver, FieldHandle, FieldFlags, Bug10491);
|
||||
|
||||
Reference in New Issue
Block a user