diff --git a/package-lock.json b/package-lock.json index e733ebf5..b7d6fb35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "marked": "~4.0.19", "moment": "~2.29.4", "mysql2": "~2.3.2", - "node-firebird": "github:Fabio286/node-firebird", + "node-firebird": "~1.1.3", "pg": "~8.7.1", "pg-connection-string": "~2.5.0", "pg-query-stream": "~4.2.3", @@ -11284,8 +11284,9 @@ } }, "node_modules/node-firebird": { - "version": "1.1.2", - "resolved": "git+ssh://git@github.com/Fabio286/node-firebird.git#28059a4aff44fc4b9ce69699bb1ad14f837de692", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/node-firebird/-/node-firebird-1.1.3.tgz", + "integrity": "sha512-3VhiP8XMqlKQo8H8nPOmrqYFseEj0uUdoacZ5xutRAOFzLWR9ImXBfVLUdg4AiH34YCshgiU8Lc37AAX3Vc6YQ==", "dependencies": { "big-integer": "^1.6.48", "long": "^4.0.0" @@ -25361,8 +25362,9 @@ } }, "node-firebird": { - "version": "git+ssh://git@github.com/Fabio286/node-firebird.git#28059a4aff44fc4b9ce69699bb1ad14f837de692", - "from": "node-firebird@https://github.com/Fabio286/node-firebird", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/node-firebird/-/node-firebird-1.1.3.tgz", + "integrity": "sha512-3VhiP8XMqlKQo8H8nPOmrqYFseEj0uUdoacZ5xutRAOFzLWR9ImXBfVLUdg4AiH34YCshgiU8Lc37AAX3Vc6YQ==", "requires": { "big-integer": "^1.6.48", "long": "^4.0.0" diff --git a/package.json b/package.json index 28061b34..d9a617a1 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "marked": "~4.0.19", "moment": "~2.29.4", "mysql2": "~2.3.2", - "node-firebird": "github:Fabio286/node-firebird", + "node-firebird": "~1.1.3", "pg": "~8.7.1", "pg-connection-string": "~2.5.0", "pg-query-stream": "~4.2.3", diff --git a/src/main/libs/clients/FirebirdSQLClient.ts b/src/main/libs/clients/FirebirdSQLClient.ts index 2d4ca2a4..2823fcfc 100644 --- a/src/main/libs/clients/FirebirdSQLClient.ts +++ b/src/main/libs/clients/FirebirdSQLClient.ts @@ -43,7 +43,10 @@ export class FirebirdSQLClient extends AntaresCore { } async connect () { - this._connection = await this.getConnection(); + if (!this._poolSize) + this._connection = await this.getConnection(); + else + this._connection = await this.getConnectionPool(); } async getConnection () { @@ -55,8 +58,18 @@ export class FirebirdSQLClient extends AntaresCore { }); } + async getConnectionPool () { + const pool = firebird.pool(this._poolSize, { ...this._params, blobAsText: true }); + return new Promise((resolve, reject) => { + pool.get((err, db) => { + if (err) reject(err); + else resolve(db); + }); + }); + } + destroy () { - return this._connection.detach(); + return (this._connection as firebird.Database).detach(); } use (): void { @@ -726,6 +739,7 @@ export class FirebirdSQLClient extends AntaresCore { } catch (err) { reject(err); + this._connection.detach(); } timeStop = new Date();