1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat(SQLite): manual commit mode

This commit is contained in:
2022-02-14 18:53:55 +01:00
parent d81e0911ab
commit 7dcd4441c4
3 changed files with 65 additions and 8 deletions

View File

@ -1147,8 +1147,10 @@ export class PostgreSQLClient extends AntaresCore {
*/
async commitTab (tabUid) {
const connection = this._connectionsToCommit.get(tabUid);
if (connection)
return await connection.query('COMMIT');
if (connection) {
await connection.query('COMMIT');
return this.destroyConnectionToCommit(tabUid);
}
}
/**
@ -1158,14 +1160,16 @@ export class PostgreSQLClient extends AntaresCore {
*/
async rollbackTab (tabUid) {
const connection = this._connectionsToCommit.get(tabUid);
if (connection)
return await connection.query('ROLLBACK');
if (connection) {
await connection.query('ROLLBACK');
return this.destroyConnectionToCommit(tabUid);
}
}
destroyConnectionToCommit (tabUid) {
const connection = this._connectionsToCommit.get(tabUid);
if (connection) {
connection.destroy();
connection.end();
this._connectionsToCommit.delete(tabUid);
}
}