xardao 1.4.0 → 1.4.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/lib/driver-snowflake.js +1 -0
- package/lib/driver_mariadb.js +1 -0
- package/lib/driver_mssql.js +6 -1
- package/lib/driver_pgsql.js +1 -0
- package/lib/driver_sqlite3.js +1 -0
- package/lib/xardao.js +35 -19
- package/package.json +1 -1
package/lib/driver-snowflake.js
CHANGED
package/lib/driver_mariadb.js
CHANGED
package/lib/driver_mssql.js
CHANGED
|
@@ -44,6 +44,7 @@ class Connection {
|
|
|
44
44
|
this.commitTrans = ESNext(this.commitTransCB, this)
|
|
45
45
|
this.rollbackTrans = ESNext(this.rollbackTransCB, this)
|
|
46
46
|
this.close = ESNext(this.closeCB, this)
|
|
47
|
+
this.noCount = false
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
open() {}
|
|
@@ -57,6 +58,9 @@ class Connection {
|
|
|
57
58
|
execMultiple() {}
|
|
58
59
|
readTableStructure() {}
|
|
59
60
|
close() {}
|
|
61
|
+
setNoCount() {
|
|
62
|
+
this.noCount = true
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
debug(f,s) {
|
|
62
66
|
if (this.debugMode) console.error(f + ": " + s)
|
|
@@ -331,7 +335,8 @@ class Connection {
|
|
|
331
335
|
var ts = Date.now()
|
|
332
336
|
var realSql = this.getRealSql(params);
|
|
333
337
|
this.debug("execSingle",realSql)
|
|
334
|
-
realSql = realSql + "; select @@ROWCOUNT, @@IDENTITY"
|
|
338
|
+
if ( ! this.noCount ) realSql = realSql + "; select @@ROWCOUNT, @@IDENTITY"
|
|
339
|
+
this.noCount = false
|
|
335
340
|
let request = new mssql.Request(realSql, function(err, rowcount, rows) {
|
|
336
341
|
if (err) {
|
|
337
342
|
self.debug("execSingle",'Error: '+err.code)
|
package/lib/driver_pgsql.js
CHANGED
package/lib/driver_sqlite3.js
CHANGED
package/lib/xardao.js
CHANGED
|
@@ -102,8 +102,10 @@ exports.Connection = Connection
|
|
|
102
102
|
exports.express = {}
|
|
103
103
|
exports.express.usingDBConnection = function usingDBConnection(connSpec, page ) {
|
|
104
104
|
|
|
105
|
+
|
|
106
|
+
|
|
105
107
|
return function(req, res, next) {
|
|
106
|
-
|
|
108
|
+
|
|
107
109
|
if (typeof(connSpec) == "object") connInfo = connSpec
|
|
108
110
|
else if (typeof(connSpec) == "string" ){
|
|
109
111
|
if ( req.appconfig ) connInfo = req.appconfig[connSpec]
|
|
@@ -114,25 +116,39 @@ exports.express.usingDBConnection = function usingDBConnection(connSpec, page )
|
|
|
114
116
|
else throw "Invalid database specification"
|
|
115
117
|
|
|
116
118
|
if (typeof(connInfo) == 'string') {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
119
|
+
let db = new Connection(connInfo)
|
|
120
|
+
db.debugMode = connSpec.debugMode || false
|
|
121
|
+
db.openCB(undefined,
|
|
122
|
+
function (err) {
|
|
123
|
+
if (err) { next(err) }
|
|
124
|
+
else {
|
|
125
|
+
res.on("finish",
|
|
126
|
+
function() {
|
|
127
|
+
db.close()
|
|
128
|
+
} )
|
|
129
|
+
req.conn=db
|
|
130
|
+
page(req, res, next)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
} else if (typeof(connInfo) == "object"){
|
|
135
|
+
let db = Connection(connInfo.driver)
|
|
136
|
+
db.debugMode = connInfo.debugMode || false
|
|
137
|
+
db.openCB(connInfo.dbInfo,
|
|
138
|
+
function (err) {
|
|
139
|
+
if (err) { next(err) }
|
|
140
|
+
else {
|
|
141
|
+
res.on("finish",
|
|
142
|
+
function() {
|
|
143
|
+
db.close()
|
|
144
|
+
} )
|
|
145
|
+
req.conn=db
|
|
146
|
+
page(req, res, next)
|
|
147
|
+
}
|
|
148
|
+
} )
|
|
149
|
+
} else {
|
|
150
|
+
throw "Invalid database specification"
|
|
133
151
|
}
|
|
134
|
-
)
|
|
135
|
-
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
154
|
|