mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Add a second label to below the processlist, called "EXPLAIN Analyzer on MariaDB.org", which passes the EXPLAIN output to http://mariadb.org/explain_analyzer/api/1/ . Thanks to Bryan Alsdorf for support.
This commit is contained in:
@@ -932,6 +932,23 @@ object MainForm: TMainForm
|
||||
ParentFont = False
|
||||
OnClick = lblExplainProcessClick
|
||||
end
|
||||
object lblExplainProcessAnalyzer: TLabel
|
||||
Left = 142
|
||||
Top = 2
|
||||
Width = 163
|
||||
Height = 13
|
||||
Cursor = crHandPoint
|
||||
Hint = 'Pass EXPLAIN output to MariaDB'#39's analyzer webpage'
|
||||
Caption = 'EXPLAIN Analyzer on MariaDB.org'
|
||||
Enabled = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -11
|
||||
Font.Name = 'Default'
|
||||
Font.Style = [fsUnderline]
|
||||
ParentFont = False
|
||||
OnClick = lblExplainProcessAnalyzerClick
|
||||
end
|
||||
end
|
||||
object SynMemoProcessView: TSynMemo
|
||||
Left = 0
|
||||
@@ -8532,6 +8549,13 @@ object MainForm: TMainForm
|
||||
ImageIndex = 39
|
||||
OnClick = lblExplainProcessClick
|
||||
end
|
||||
object menuExplainAnalyzer: TMenuItem
|
||||
Caption = 'EXPLAIN analyzer on MariaDB.org'
|
||||
Enabled = False
|
||||
Hint = 'Pass EXPLAIN output to MariaDB'#39's analyzer webpage'
|
||||
ImageIndex = 39
|
||||
OnClick = lblExplainProcessAnalyzerClick
|
||||
end
|
||||
object N1a: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
|
||||
@@ -555,6 +555,8 @@ type
|
||||
menuGroupObjects: TMenuItem;
|
||||
actLogHorizontalScrollbar: TAction;
|
||||
actGroupObjects: TAction;
|
||||
lblExplainProcessAnalyzer: TLabel;
|
||||
menuExplainAnalyzer: TMenuItem;
|
||||
procedure actCreateDBObjectExecute(Sender: TObject);
|
||||
procedure menuConnectionsPopup(Sender: TObject);
|
||||
procedure actExitApplicationExecute(Sender: TObject);
|
||||
@@ -877,6 +879,7 @@ type
|
||||
procedure DBtreeExpanding(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||
var Allowed: Boolean);
|
||||
procedure actGroupObjectsExecute(Sender: TObject);
|
||||
procedure lblExplainProcessAnalyzerClick(Sender: TObject);
|
||||
private
|
||||
FLastHintMousepos: TPoint;
|
||||
FLastHintControlIndex: Integer;
|
||||
@@ -1409,6 +1412,7 @@ begin
|
||||
InheritFont(ParameterCompletionProposal.Font);
|
||||
// Simulated link label, has non inherited blue font color
|
||||
InheritFont(lblExplainProcess.Font);
|
||||
InheritFont(lblExplainProcessAnalyzer.Font);
|
||||
|
||||
StatusBar.Height := GetTextHeight(StatusBar.Font)+4;
|
||||
// Upscale panels in non-96-DPI mode
|
||||
@@ -6617,6 +6621,8 @@ begin
|
||||
and (UpperCase(GetFirstWord(SynMemoProcessView.Text)) <> 'SHOW')
|
||||
and (SynMemoProcessView.GetTextLen > 0);
|
||||
menuExplainProcess.Enabled := lblExplainProcess.Enabled;
|
||||
lblExplainProcessAnalyzer.Enabled := lblExplainProcess.Enabled;
|
||||
menuExplainAnalyzer.Enabled := lblExplainProcess.Enabled;
|
||||
end;
|
||||
|
||||
|
||||
@@ -10027,6 +10033,32 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.lblExplainProcessAnalyzerClick(Sender: TObject);
|
||||
var
|
||||
Results: TDBQuery;
|
||||
Raw, URL: String;
|
||||
i: Integer;
|
||||
begin
|
||||
ActiveConnection.Database := listProcesses.Text[listProcesses.FocusedNode, 3];
|
||||
Results := ActiveConnection.GetResults('EXPLAIN '+SynMemoProcessView.Text);
|
||||
Raw := '+' + CRLF + '|';
|
||||
for i:=0 to Results.ColumnCount-1 do begin
|
||||
Raw := Raw + Results.ColumnNames[i] + '|';
|
||||
end;
|
||||
Raw := Raw + CRLF + '+';
|
||||
while not Results.Eof do begin
|
||||
Raw := Raw + CRLF + '|';
|
||||
for i:=0 to Results.ColumnCount-1 do begin
|
||||
Raw := Raw + Results.Col(i) + '|';
|
||||
end;
|
||||
Results.Next;
|
||||
end;
|
||||
Raw := Raw + CRLF;
|
||||
URL := 'http://mariadb.org/explain_analyzer/api/1/?raw_explain='+EncodeURL(Raw)+'&client='+APPNAME;
|
||||
ShellExec(URL);
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.lblExplainProcessClick(Sender: TObject);
|
||||
var
|
||||
Tab: TQueryTab;
|
||||
|
||||
Reference in New Issue
Block a user