multi-db-orm
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ const { MultiDbORM } = require("./multidb"); | ||
db; | ||
conn; | ||
pool; | ||
dataMap = { | ||
@@ -38,4 +38,4 @@ id: "VARCHAR(50) NOT NULL PRIMARY KEY", | ||
}; | ||
this.conn = hana.createConnection(); | ||
this.db = this.conn; | ||
this.pool = hana.createPool(this.conn_params); | ||
this.db = this.pool; | ||
this.dbType = "hana"; | ||
@@ -49,20 +49,14 @@ this.reqMade = 0; | ||
return new Promise((resolve, reject) => { | ||
let onConnect = function (err) { | ||
if (err) throw err; | ||
that.conn.exec(query, (err, result) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
if (that.loglevel > 3) { | ||
console.log("Query", query, "->", result); | ||
} | ||
}); | ||
}; | ||
if (that.conn.state() == "disconnected") { | ||
that.conn.connect(that.conn_params, onConnect); | ||
} else { | ||
onConnect(); | ||
} | ||
var conn = this.pool.getConnection(); | ||
conn.exec(query, (err, result) => { | ||
conn.disconnect(); | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
if (that.loglevel > 3) { | ||
console.log("Query", query, "->", result); | ||
} | ||
}); | ||
}); | ||
@@ -236,3 +230,3 @@ } | ||
return new Promise((resolve, reject) => { | ||
this.conn.disconnect((err) => { | ||
this.pool.disconnect((err) => { | ||
if (err) { | ||
@@ -239,0 +233,0 @@ reject(err); |
{ | ||
"name": "multi-db-orm", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "CRUD , Backup , Restore and Migration library for multiple databases", | ||
@@ -50,2 +50,2 @@ "main": "index.js", | ||
"homepage": "https://github.com/shiveshnavin/multi-db-orm#readme" | ||
} | ||
} |
77446
-0.22%2101
-0.28%