diff --git a/out/locale/en/LC_MESSAGES/default.po b/out/locale/en/LC_MESSAGES/default.po index c3fc4fa1..45e26434 100644 --- a/out/locale/en/LC_MESSAGES/default.po +++ b/out/locale/en/LC_MESSAGES/default.po @@ -4748,8 +4748,8 @@ msgid "Displaying objects from \"%s\" ..." msgstr "Displaying objects from \"%s\" ..." #: main.pas:4784 -msgid "Ignoring own process id #%s when trying to kill it." -msgstr "Ignoring own process id #%s when trying to kill it." +msgid "Ignoring own process id #%d when trying to kill it." +msgstr "Ignoring own process id #%d when trying to kill it." #: main.pas:5158 msgid "Uptime" diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 160e9a01..fefdb012 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -284,7 +284,7 @@ type spAddColumn, spChangeColumn, spSessionVariables, spGlobalVariables, spISTableSchemaCol, - spUSEQuery, spKillQuery, + spUSEQuery, spKillQuery, spKillProcess, spFuncLength, spFuncCeil); TDBConnection = class(TComponent) @@ -2029,6 +2029,7 @@ begin FSQLSpecifities[spISTableSchemaCol] := 'TABLE_SCHEMA'; FSQLSpecifities[spUSEQuery] := 'USE %s'; FSQLSpecifities[spKillQuery] := 'KILL %d'; + FSQLSpecifities[spKillProcess] := 'KILL %d'; FSQLSpecifities[spFuncLength] := 'LENGTH'; FSQLSpecifities[spFuncCeil] := 'CEIL'; end; @@ -2044,6 +2045,7 @@ begin FSQLSpecifities[spISTableSchemaCol] := 'TABLE_CATALOG'; FSQLSpecifities[spUSEQuery] := 'USE %s'; FSQLSpecifities[spKillQuery] := 'KILL %d'; + FSQLSpecifities[spKillProcess] := 'KILL %d'; FSQLSpecifities[spFuncLength] := 'LEN'; FSQLSpecifities[spFuncCeil] := 'CEILING'; end; @@ -2059,6 +2061,7 @@ begin FSQLSpecifities[spISTableSchemaCol] := 'table_schema'; FSQLSpecifities[spUSEQuery] := 'SET search_path TO %s'; FSQLSpecifities[spKillQuery] := 'SELECT pg_cancel_backend(%d)'; + FSQLSpecifities[spKillProcess] := 'SELECT pg_cancel_backend(%d)'; FSQLSpecifities[spFuncLength] := 'LENGTH'; FSQLSpecifities[spFuncCeil] := 'CEIL'; end; diff --git a/source/main.pas b/source/main.pas index a82421ca..90d7f799 100644 --- a/source/main.pas +++ b/source/main.pas @@ -5441,7 +5441,7 @@ end; procedure TMainForm.KillProcess(Sender: TObject); var t: Boolean; - pid: String; + pid: Int64; Node: PVirtualNode; Conn: TDBConnection; begin @@ -5452,12 +5452,12 @@ begin begin Node := GetNextNode(ListProcesses, nil, True); while Assigned(Node) do begin - pid := ListProcesses.Text[Node, ListProcesses.Header.MainColumn]; + pid := StrToInt64Def(ListProcesses.Text[Node, ListProcesses.Header.MainColumn], 0); // Don't kill own process - if pid = IntToStr(Conn.ThreadId) then - LogSQL(f_('Ignoring own process id #%s when trying to kill it.', [pid])) + if pid = Conn.ThreadId then + LogSQL(f_('Ignoring own process id #%d when trying to kill it.', [pid])) else try - Conn.Query('KILL '+pid); + Conn.Query(Format(Conn.GetSQLSpecifity(spKillProcess), [pid])); except on E:EDatabaseError do begin if Conn.LastErrorCode <> 1094 then