mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Add support for killing more than one process in one go.
This commit is contained in:
@@ -181,7 +181,7 @@ object MDIChild: TMDIChild
|
||||
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
||||
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
|
||||
TreeOptions.PaintOptions = [toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
|
||||
TreeOptions.SelectionOptions = [toFullRowSelect, toRightClickSelect]
|
||||
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect, toRightClickSelect]
|
||||
OnBeforePaint = vstBeforePaint
|
||||
OnCompareNodes = vstCompareNodes
|
||||
OnFreeNode = vstFreeNode
|
||||
@@ -1803,7 +1803,7 @@ object MDIChild: TMDIChild
|
||||
Left = 41
|
||||
Top = 48
|
||||
object Kill1: TMenuItem
|
||||
Caption = 'Kill Process...'
|
||||
Caption = 'Kill Process(es)...'
|
||||
Enabled = False
|
||||
ImageIndex = 83
|
||||
ShortCut = 46
|
||||
|
||||
@@ -2681,21 +2681,25 @@ end;
|
||||
|
||||
procedure TMDIChild.KillProcess(Sender: TObject);
|
||||
var t : Boolean;
|
||||
NodeData : PVTreeData;
|
||||
ProcessIDs : TStringList;
|
||||
i : Integer;
|
||||
begin
|
||||
NodeData := ListProcesses.GetNodeData(ListProcesses.FocusedNode);
|
||||
if NodeData.Captions[0] = IntToStr( MySQLConn.Connection.GetThreadId ) then
|
||||
MessageDlg('Fatal: Better not kill my own Process...', mtError, [mbok], 0)
|
||||
else begin
|
||||
t := TimerProcessList.Enabled;
|
||||
TimerProcessList.Enabled := false; // prevent av (ListProcesses.selected...)
|
||||
if MessageDlg('Kill Process '+NodeData.Captions[0]+'?', mtConfirmation, [mbok,mbcancel], 0) = mrok then
|
||||
t := TimerProcessList.Enabled;
|
||||
TimerProcessList.Enabled := false; // prevent av (ListProcesses.selected...)
|
||||
ProcessIDs := GetVTCaptions( ListProcesses, True );
|
||||
if MessageDlg('Kill '+inttostr(ProcessIDs.count)+' Process(es)?', mtConfirmation, [mbok,mbcancel], 0) = mrok then
|
||||
begin
|
||||
for i := 0 to ProcessIDs.Count - 1 do
|
||||
begin
|
||||
ExecUpdateQuery( 'KILL '+NodeData.Captions[0] );
|
||||
ShowVariablesAndProcesses(self);
|
||||
// Don't kill own process
|
||||
if ProcessIDs[i] = IntToStr( MySQLConn.Connection.GetThreadId ) then
|
||||
LogSQL('Ignoring own process id '+ProcessIDs[i]+' when trying to kill it.')
|
||||
else
|
||||
ExecUpdateQuery( 'KILL '+ProcessIDs[i] );
|
||||
end;
|
||||
TimerProcessList.Enabled := t; // re-enable autorefresh timer
|
||||
ShowVariablesAndProcesses(self);
|
||||
end;
|
||||
TimerProcessList.Enabled := t; // re-enable autorefresh timer
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user