Detect column default value as text if it starts with a single quote. Applies to older MySQL versions without IS.columns. Closes #873

This commit is contained in:
Ansgar Becker
2020-02-02 16:03:39 +01:00
parent 0f38df3a1d
commit 858e8a3b4a

View File

@@ -4663,8 +4663,12 @@ begin
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