Permalink
Browse files

Pressing enter in query editor with opened proposal dropdown with an …

…underlying identifier, containing a quote char to the left, quoted that quote again, resulting in a quote mess. Change that behavior and tell HeidiSQL to force quoting if the left char is a quote. Closes #6.
  • Loading branch information...
ansgarbecker committed Dec 25, 2018
1 parent d6fb9e4 commit 39f06c849e2453f4fd755f813353f299af45a53f
Showing with 11 additions and 1 deletion.
  1. +1 −0 source/dbconnection.pas
  2. +10 −1 source/main.pas
@@ -421,6 +421,7 @@ TDBConnection = class(TComponent)
property LastErrorMsg: String read GetLastErrorMsg;
property ServerOS: String read FServerOS;
property ServerVersionUntouched: String read FServerVersionUntouched;
property QuoteChars: String read FQuoteChars;
function ServerVersionStr: String;
function ServerVersionInt: Integer;
function NdbClusterVersionInt: Integer;
@@ -5588,7 +5588,16 @@ procedure TMainForm.SynCompletionProposalCodeCompletion(Sender: TObject;
FunctionDeclaration := Copy(Value, f, Length(Value));
Delete(Value, f, Length(Value));
end;
Value := ActiveConnection.QuoteIdent(Value, False) + FunctionDeclaration;

rx.Expression := '^(['+QuoteRegExprMetaChars(ActiveConnection.QuoteChars)+'])(.*)$';
if rx.Exec(Value) then begin
// Left character of identifier is already a quote: user wants to force quoting.
// Seperate that left quote character away from what gets now quoted automatically, and force quoting
Value := ActiveConnection.QuoteIdent(rx.Match[2], True) + FunctionDeclaration;
end else begin
// Identifier without left quote - quote when required
Value := ActiveConnection.QuoteIdent(Value, False) + FunctionDeclaration;
end;
end;
end;
rx.Free;

0 comments on commit 39f06c8

Please sign in to comment.