Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix sloppy regular expression in TDBConnection.DetectUSEQuery which r…
…emoves too much of trailing quotes in a database name. See http://www.heidisql.com/forum.php?t=22743
  • Loading branch information
ansgarbecker committed Nov 24, 2016
1 parent 462dcba commit 50d74d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/dbconnection.pas
Expand Up @@ -3070,7 +3070,7 @@ procedure TDBConnection.DetectUSEQuery(SQL: String);
EscapeFunction := 'E'
else
EscapeFunction := '';
rx.Expression := StringReplace(rx.Expression, '%s', EscapeFunction+'['+Quotes+']?([^'+Quotes+']+)['+Quotes+']*', [rfReplaceAll]);
rx.Expression := StringReplace(rx.Expression, '%s', EscapeFunction+'['+Quotes+']?(.+)['+Quotes+']?', [rfReplaceAll]);
if rx.Exec(SQL) then begin
FDatabase := Trim(rx.Match[1]);
FDatabase := DeQuoteIdent(FDatabase);
Expand Down

0 comments on commit 50d74d9

Please sign in to comment.