Skip to content
Permalink
Browse files

Fix glitch in previous commit for #62: never escape \, and don't over…

…write text with escaped joker chars. So we just escape %, _ and ' now in Postgres mode.
  • Loading branch information...
ansgarbecker committed Oct 3, 2019
1 parent 3bcfbfd commit 56c6a1e78e18e9024688594798a3ba3d462561e8
Showing with 8 additions and 8 deletions.
  1. +8 −8 source/dbconnection.pas
@@ -3705,18 +3705,18 @@ function TDBConnection.EscapeString(Text: String; ProcessJokerChars: Boolean=fal
end;

ngPgSQL: begin
c1 := '\';
c2 := '\';
c3 := '\';
c4 := '\';
EscChar := '\';
if ProcessJokerChars then begin
c1 := '%';
c2 := '_';
c3 := '%';
c4 := '_';
c4 := '%';
EscChar := '\';
Result := escChars(Text, EscChar, c1, c2, c3, c4);
end else begin
Result := Text;
end;
Result := escChars(Text, EscChar, c1, c2, c3, c4);
// Escape single quote with a second single quote
Result := escChars(Text, '''', '''', '''', '''', '''');
Result := escChars(Result, '''', '''', '''', '''', '''');
end;

end;

0 comments on commit 56c6a1e

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