Permalink
Browse files

Fix crash when trying to run explain analyzer for an invalid SQL query.

Closes #194
  • Loading branch information...
ansgarbecker committed Dec 24, 2018
1 parent b41baac commit d6fb9e46acc3cf9104089282c64334b0b7073c3f
Showing with 12 additions and 2 deletions.
  1. +12 −2 source/main.pas
@@ -3013,7 +3013,12 @@ procedure TMainForm.actExplainAnalyzeCurrentQueryExecute(Sender: TObject);
// Send EXPLAIN output to analyzer
Conn := ActiveConnection;
SQL := GetCurrentQuery(ActiveQueryTab);
Conn.ExplainAnalyzer(SQL, Conn.Database);
try
Conn.ExplainAnalyzer(SQL, Conn.Database);
except
on E:EDatabaseError do
ErrorDialog(E.Message);
end;
end;


@@ -11399,7 +11404,12 @@ procedure TMainForm.AnyGridScroll(Sender: TBaseVirtualTree; DeltaX, DeltaY: Inte

procedure TMainForm.lblExplainProcessAnalyzerClick(Sender: TObject);
begin
ActiveConnection.ExplainAnalyzer(SynMemoProcessView.Text, listProcesses.Text[listProcesses.FocusedNode, 3]);
try
ActiveConnection.ExplainAnalyzer(SynMemoProcessView.Text, listProcesses.Text[listProcesses.FocusedNode, 3]);
except
on E:EDatabaseError do
ErrorDialog(E.Message);
end;
end;


0 comments on commit d6fb9e4

Please sign in to comment.