diff --git a/src/main/ipc-handlers/schema.js b/src/main/ipc-handlers/schema.js index 8087c68a..10d71447 100644 --- a/src/main/ipc-handlers/schema.js +++ b/src/main/ipc-handlers/schema.js @@ -112,6 +112,17 @@ export default connections => { } }); + ipcMain.handle('kill-process', async (event, { uid, pid }) => { + try { + const result = await connections[uid].killProcess(pid); + + return { status: 'success', response: result }; + } + catch (err) { + return { status: 'error', response: err.toString() }; + } + }); + ipcMain.handle('use-schema', async (event, { uid, schema }) => { if (!schema) return; diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 8dba44e9..2eaf2a13 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -1176,6 +1176,10 @@ export class MySQLClient extends AntaresCore { }); } + async killProcess (id) { + return await this.raw(`KILL ${id}`); + } + /** * CREATE TABLE * diff --git a/src/main/libs/clients/PostgreSQLClient.js b/src/main/libs/clients/PostgreSQLClient.js index 6de867d6..10653ab5 100644 --- a/src/main/libs/clients/PostgreSQLClient.js +++ b/src/main/libs/clients/PostgreSQLClient.js @@ -1029,6 +1029,10 @@ export class PostgreSQLClient extends AntaresCore { }); } + async killProcess (id) { + return await this.raw(`SELECT pg_terminate_backend(${id})`); + } + /** * CREATE TABLE * diff --git a/src/renderer/components/ModalProcessesList.vue b/src/renderer/components/ModalProcessesList.vue index 8de12674..9de0f6db 100644 --- a/src/renderer/components/ModalProcessesList.vue +++ b/src/renderer/components/ModalProcessesList.vue @@ -1,5 +1,15 @@