firebird-query
Advanced tools
Comparing version
@@ -301,11 +301,13 @@ "use strict"; | ||
initTransaction(cb) { | ||
this.conn.get((err, db) => { | ||
if (err) { | ||
throw new Error("Error Establishing a Database Connection"); | ||
} | ||
db.transaction(node_firebird_1.default.ISOLATION_READ_COMMITTED, (err, tx) => { | ||
return new Promise((res, rej) => { | ||
this.conn.get((err, db) => { | ||
if (err) { | ||
throw new Error("Error initializing transaction"); | ||
rej(new Error("Error Establishing a Database Connection")); | ||
} | ||
cb(this.txHandler(tx)); | ||
db.transaction(node_firebird_1.default.ISOLATION_READ_COMMITTED, (err, tx) => { | ||
if (err) { | ||
rej(new Error("Error initializing transaction")); | ||
} | ||
res(cb(this.txHandler(tx))); | ||
}); | ||
}); | ||
@@ -312,0 +314,0 @@ }); |
@@ -123,3 +123,3 @@ import Firebird from "node-firebird"; | ||
destroy(): Promise<void>; | ||
initTransaction(cb: (tx: ReturnType<typeof this.txHandler>) => void): void; | ||
initTransaction<T>(cb: (tx: ReturnType<typeof this.txHandler>) => T): Promise<T>; | ||
private handleRawQuery; | ||
@@ -126,0 +126,0 @@ private handleInsertOne; |
@@ -123,3 +123,3 @@ import Firebird from "node-firebird"; | ||
destroy(): Promise<void>; | ||
initTransaction(cb: (tx: ReturnType<typeof this.txHandler>) => void): void; | ||
initTransaction<T>(cb: (tx: ReturnType<typeof this.txHandler>) => T): Promise<T>; | ||
private handleRawQuery; | ||
@@ -126,0 +126,0 @@ private handleInsertOne; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.5.5", | ||
"version": "0.6.0", | ||
"description": "node-firebird plugin for easy and safe query building.", | ||
@@ -8,0 +8,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55304
0.52%1137
0.35%