Skip to content

Commit 4c0617d

Browse files
committed
fix: detected empty text DEFAULT value for table columns
I suspect IfThen() to be the cause, telling FPC it may execute ExtractLiteral() more than one time.
1 parent 8ea3b94 commit 4c0617d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

source/dbconnection.pas

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5261,7 +5261,7 @@ function TDBConnection.ExtractLiteral(var SQL: String; Prefix: String): String;
52615261
else if not InLiteral then
52625262
break;
52635263
end;
5264-
Result := Copy(SQL, LitStart, i-LitStart-1);
5264+
Result := Copy(SQL, LitStart, i-LitStart);
52655265
Result := UnescapeString(Result);
52665266
Delete(SQL, 1, i);
52675267
end;
@@ -5862,7 +5862,10 @@ function TDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
58625862
end
58635863
else if IsTextDefault(DefText, Col.DataType) then begin
58645864
Col.DefaultType := cdtText;
5865-
Col.DefaultText := IfThen(DefText.StartsWith(''''), ExtractLiteral(DefText, ''), DefText);
5865+
if DefText.StartsWith('''') then
5866+
Col.DefaultText := ExtractLiteral(DefText, '')
5867+
else
5868+
Col.DefaultText := DefText;
58665869
end
58675870
else begin
58685871
Col.DefaultType := cdtExpression;

0 commit comments

Comments
 (0)