Fix detection of VARCHAR columns as BLOBs on 4.0 servers. Workaround for shared type FIELD_TYPE_* constants should only apply to (TINY|MEDIUM|LONG)TEXT columns. Fixes issue #1588.

This commit is contained in:
Ansgar Becker
2010-01-11 22:24:25 +00:00
parent 8abd2d0d76
commit df6397abc7

View File

@ -1178,16 +1178,18 @@ begin
FDatatypes[i] := Datatypes[Integer(dtSet)] FDatatypes[i] := Datatypes[Integer(dtSet)]
else for j:=Low(Datatypes) to High(Datatypes) do begin else for j:=Low(Datatypes) to High(Datatypes) do begin
if Field._type = Datatypes[j].NativeType then begin if Field._type = Datatypes[j].NativeType then begin
// Text and Blob types share the same constants (see FIELD_TYPEs in mysql_api) if Datatypes[j].Index in [dtTinytext, dtText, dtMediumtext, dtLongtext] then begin
// Some function results return binary collation up to the latest versions. Work around // Text and Blob types share the same constants (see FIELD_TYPEs in mysql_api)
// that by checking if this field is a real table field // Some function results return binary collation up to the latest versions. Work around
// See http://bugs.mysql.com/bug.php?id=10201 // that by checking if this field is a real table field
if Connection.IsUnicode then // See http://bugs.mysql.com/bug.php?id=10201
IsBinary := (Field.charsetnr = COLLATION_BINARY) and (Field.org_table <> '') if Connection.IsUnicode then
else IsBinary := (Field.charsetnr = COLLATION_BINARY) and (Field.org_table <> '')
IsBinary := (Field.flags and BINARY_FLAG) = BINARY_FLAG; else
if IsBinary and (Datatypes[j].Category = dtcText) then IsBinary := (Field.flags and BINARY_FLAG) = BINARY_FLAG;
continue; if IsBinary then
continue;
end;
FDatatypes[i] := Datatypes[j]; FDatatypes[i] := Datatypes[j];
break; break;
end; end;