any-db-transaction
Advanced tools
Comparing version 2.2.1 to 2.2.2
{ | ||
"name": "any-db-transaction", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Transaction object for Any-DB adapters", | ||
@@ -5,0 +5,0 @@ "main": "transaction.js", |
@@ -196,3 +196,3 @@ # any-db-transaction | ||
Contains the adapter name used for the transaction, e.g. `'sqlite3'`, etc. | ||
The [Adapter](https://github.com/grncdr/node-any-db-adapter-spec/#adapter) instance used by the resource (connection or parent transaction) underlying this transaction. | ||
@@ -199,0 +199,0 @@ ### Transaction.query |
33
test.js
@@ -19,21 +19,22 @@ var fs = require('fs') | ||
var backend = url.split(':').shift() | ||
if (backend == 'sqlite3') { | ||
try { | ||
fs.unlinkSync('/tmp/any_db_test.db'); | ||
} catch (err) { | ||
console.error(err); | ||
// ignore it | ||
tape(backend + ' - ' + description, function (t) { | ||
if (backend == 'sqlite3') { | ||
try { | ||
fs.unlinkSync('/tmp/any_db_test.db'); | ||
} catch (err) { | ||
console.error(err); | ||
// ignore it | ||
} | ||
} | ||
} | ||
var queryable, cleanup; | ||
if (pool) { | ||
queryable = anyDB.createPool(url, pool) | ||
cleanup = queryable.close.bind(queryable) | ||
} else { | ||
queryable = anyDB.createConnection(url) | ||
cleanup = queryable.end.bind(queryable) | ||
} | ||
var queryable, cleanup; | ||
if (pool) { | ||
queryable = anyDB.createPool(url, pool) | ||
cleanup = queryable.close.bind(queryable) | ||
} else { | ||
queryable = anyDB.createConnection(url) | ||
cleanup = queryable.end.bind(queryable) | ||
} | ||
tape(backend + ' - ' + description, function (t) { | ||
callback(queryable, t) | ||
@@ -40,0 +41,0 @@ t.on('end', cleanup) |
@@ -310,2 +310,5 @@ var inherits = require('inherits') | ||
var self = this | ||
if (self.state() == 'closed') { | ||
return | ||
} | ||
var err = self.state('closed') | ||
@@ -327,3 +330,2 @@ if (err) { | ||
}) | ||
self.emit('query', q) | ||
return self | ||
@@ -337,4 +339,4 @@ } | ||
this.name = action + ' failed' | ||
this.message = err.getMessage() | ||
this.message = err.message | ||
this.previous = null; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30264
550