mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Cast date/time columns to char on MySQL when generating an all-column filter. Closes #392.
This commit is contained in:
@@ -7428,12 +7428,20 @@ function TTableColumn.CastAsText: String;
|
||||
begin
|
||||
// Cast data types which are incompatible to string functions to text columns
|
||||
Result := FConnection.QuoteIdent(Name);
|
||||
if DataType.Index = dtUnknown then
|
||||
case FConnection.Parameters.NetTypeGroup of
|
||||
ngMySQL: Result := 'CAST('+Result+' AS CHAR)';
|
||||
ngMSSQL: Result := 'CAST('+Result+' AS NVARCHAR('+IntToStr(SIZE_MB)+'))';
|
||||
ngPgSQL: Result := Result + '::text';
|
||||
case FConnection.Parameters.NetTypeGroup of
|
||||
ngMySQL: begin
|
||||
if DataType.Index in [dtUnknown, dtDate, dtDatetime, dtTime, dtTimestamp] then
|
||||
Result := 'CAST('+Result+' AS CHAR)';
|
||||
end;
|
||||
ngMSSQL: begin
|
||||
if DataType.Index = dtUnknown then
|
||||
Result := 'CAST('+Result+' AS NVARCHAR('+IntToStr(SIZE_MB)+'))';
|
||||
end;
|
||||
ngPgSQL: begin
|
||||
if DataType.Index = dtUnknown then
|
||||
Result := Result + '::text';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user