mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
BINARY_FLAG seems broken for fields of a utf8_bin table. Instead use the charset nr returned by a PMYSQL_FIELD. Fixes issue #1479
This commit is contained in:
@ -141,6 +141,10 @@ const
|
||||
FIELD_TYPE_CHAR = FIELD_TYPE_TINY;
|
||||
FIELD_TYPE_INTERVAL = FIELD_TYPE_ENUM;
|
||||
|
||||
COLLATION_BINARY = 63;
|
||||
// Equivalent to COLLATION_BINARY, this is what a new driver returns when connected to a pre-4.1 server.
|
||||
COLLATION_NONE = 0;
|
||||
|
||||
MAX_MYSQL_MANAGER_ERR = 256;
|
||||
MAX_MYSQL_MANAGER_MSG = 256;
|
||||
|
||||
|
@ -650,6 +650,7 @@ procedure TMySQLQuery.Execute;
|
||||
var
|
||||
i, j, NumFields: Integer;
|
||||
Field: PMYSQL_FIELD;
|
||||
IsBinary: Boolean;
|
||||
begin
|
||||
FLastResult := Connection.Query(FSQL, True);
|
||||
FRecordCount := Connection.RowsFound;
|
||||
@ -664,7 +665,11 @@ begin
|
||||
for j:=Low(Datatypes) to High(Datatypes) do begin
|
||||
if Field._type = Datatypes[j].NativeType then begin
|
||||
// Text and Blob types share the same constants (see FIELD_TYPEs in mysql_api)
|
||||
if ((Field.flags and BINARY_FLAG) = BINARY_FLAG) and (Datatypes[j].Category <> dtcBinary) then
|
||||
if Connection.IsUnicode then
|
||||
IsBinary := Field.charsetnr = COLLATION_BINARY
|
||||
else
|
||||
IsBinary := (Field.flags and BINARY_FLAG) = BINARY_FLAG;
|
||||
if IsBinary and (Datatypes[j].Category = dtcText) then
|
||||
continue;
|
||||
FDatatypes[i] := Datatypes[j];
|
||||
break;
|
||||
|
Reference in New Issue
Block a user