Permalink
Browse files

Cast date/time columns to char on MySQL when generating an all-column…

… filter. Closes #392.
  • Loading branch information...
ansgarbecker committed Nov 28, 2018
1 parent a374c7c commit 0a5406834cc16dbc8fb3ca8f685ba18aa0098b34
Showing with 13 additions and 5 deletions.
  1. +13 −5 source/dbconnection.pas
@@ -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;

0 comments on commit 0a54068

Please sign in to comment.