Skip to content
Browse files

Detect column default value as text if it starts with a single quote.…

… Applies to older MySQL versions without IS.columns. Closes #873
  • Loading branch information
ansgarbecker committed Feb 2, 2020
1 parent 0f38df3 commit 858e8a3b4afdab9b0c387d8aebdadc4e5a8db116
Showing with 6 additions and 2 deletions.
  1. +6 −2 source/dbconnection.pas
@@ -4663,8 +4663,12 @@ function TMySQLConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
Col.DefaultType := cdtAutoInc;
Col.DefaultText := 'AUTO_INCREMENT';
end else if ColQuery.IsNull('Default') then begin
Col.DefaultType := cdtNull;
end else if Col.DataType.Category in [dtcText, dtcBinary, dtcTemporal, dtcOther] then begin
Col.DefaultType := cdtNothing;
end else if DefText.StartsWith('''') then begin
Col.DefaultType := cdtText;
Col.DefaultText := ExtractLiteral(DefText, '');
end else if DefText.IsEmpty or IsInt(DefText[1]) then begin
// Inexact detection, wrong if MySQL allows 0+1 as default value at some point
Col.DefaultType := cdtText;
Col.DefaultText := DefText;
end else begin

0 comments on commit 858e8a3

Please sign in to comment.
You can’t perform that action at this time.