Comparing version 0.5.0 to 0.5.1
@@ -65,28 +65,29 @@ var sqlite3 = null | ||
SQLite3.prototype.query = function (stmt, params, callback) { | ||
var q = stmt instanceof Query | ||
? stmt | ||
: SQLite3.createQuery(stmt, params, callback) | ||
, errored = false | ||
var query = stmt | ||
, rowError = false | ||
; | ||
if (!(query instanceof Query)) { | ||
query = SQLite3.createQuery(stmt, params, callback); | ||
} | ||
this._db.each( | ||
q.stmt, | ||
q.params, | ||
function onRow (err, row) { | ||
if (errored) return | ||
if (err) return errored = true | ||
q.handleRow(row) | ||
query.stmt, | ||
query.params, | ||
function onRow(err, row) { | ||
if (rowError) return | ||
rowError = err | ||
query.handleRow(row) | ||
}, | ||
function onComplete (err, count) { | ||
if (err) q.handleError(err) | ||
function onComplete(err, count) { | ||
if (err || rowError) query.handleError(err || rowError) | ||
else { | ||
var result = {rows: q._rows, rowCount: count} | ||
if (q._callback) q._callback(null, result) | ||
var result = {rows: query._rows, rowCount: count} | ||
if (query._callback) query._callback(null, result) | ||
} | ||
q.emit('end', result) | ||
query.emit('end', result) | ||
} | ||
) | ||
return q | ||
return query | ||
} | ||
@@ -102,3 +103,3 @@ | ||
inherits(Query, EventEmitter) | ||
function Query (stmt, params, callback) { | ||
function Query(stmt, params, callback) { | ||
EventEmitter.call(this) | ||
@@ -105,0 +106,0 @@ this._rows = [] |
{ | ||
"name": "any-db", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Database-agnostic connection pooling, querying, and result sets", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
42313
28
851
1