multi-db-orm 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/engines/hanadb.js +16 -22
- package/package.json +2 -2
package/engines/hanadb.js
CHANGED
|
@@ -2,7 +2,7 @@ const { MultiDbORM } = require("./multidb");
|
|
|
2
2
|
|
|
3
3
|
class HanaDB extends MultiDbORM {
|
|
4
4
|
db;
|
|
5
|
-
|
|
5
|
+
pool;
|
|
6
6
|
dataMap = {
|
|
7
7
|
id: "VARCHAR(50) NOT NULL PRIMARY KEY",
|
|
8
8
|
string: "NVARCHAR(4000)",
|
|
@@ -34,8 +34,8 @@ class HanaDB extends MultiDbORM {
|
|
|
34
34
|
idleTimeout: credentials.timeout || 60000,
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
this.
|
|
38
|
-
this.db = this.
|
|
37
|
+
this.pool = hana.createPool(this.conn_params);
|
|
38
|
+
this.db = this.pool;
|
|
39
39
|
this.dbType = "hana";
|
|
40
40
|
this.reqMade = 0;
|
|
41
41
|
}
|
|
@@ -44,24 +44,18 @@ class HanaDB extends MultiDbORM {
|
|
|
44
44
|
const that = this;
|
|
45
45
|
this.reqMade++;
|
|
46
46
|
return new Promise((resolve, reject) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
if (that.conn.state() == "disconnected") {
|
|
61
|
-
that.conn.connect(that.conn_params, onConnect);
|
|
62
|
-
} else {
|
|
63
|
-
onConnect();
|
|
64
|
-
}
|
|
47
|
+
var conn = this.pool.getConnection();
|
|
48
|
+
conn.exec(query, (err, result) => {
|
|
49
|
+
conn.disconnect();
|
|
50
|
+
if (err) {
|
|
51
|
+
reject(err);
|
|
52
|
+
} else {
|
|
53
|
+
resolve(result);
|
|
54
|
+
}
|
|
55
|
+
if (that.loglevel > 3) {
|
|
56
|
+
console.log("Query", query, "->", result);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
65
59
|
});
|
|
66
60
|
}
|
|
67
61
|
|
|
@@ -230,7 +224,7 @@ class HanaDB extends MultiDbORM {
|
|
|
230
224
|
|
|
231
225
|
closePool() {
|
|
232
226
|
return new Promise((resolve, reject) => {
|
|
233
|
-
this.
|
|
227
|
+
this.pool.disconnect((err) => {
|
|
234
228
|
if (err) {
|
|
235
229
|
reject(err);
|
|
236
230
|
if (this.loglevel > 1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "multi-db-orm",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "CRUD , Backup , Restore and Migration library for multiple databases",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"url": "https://github.com/shiveshnavin/multi-db-orm/issues"
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/shiveshnavin/multi-db-orm#readme"
|
|
50
|
-
}
|
|
50
|
+
}
|