Comparing version 0.5.15 to 0.5.16
@@ -453,8 +453,10 @@ !function(){ | ||
, _freeLock: function() { | ||
this._busy = false; | ||
if (this._queue.length) { | ||
var item = this._queue.shift(); | ||
this[item.fn].apply(this, Array.prototype.slice.call(item.args)); | ||
process.nextTick(function() { | ||
this._busy = false; | ||
var item = this._queue.shift(); | ||
this[item.fn].apply(this, Array.prototype.slice.call(item.args)); | ||
}.bind(this)); | ||
} | ||
else this._busy = false; | ||
} | ||
@@ -481,3 +483,2 @@ | ||
// either we get a transaction from the outside or | ||
@@ -491,3 +492,3 @@ // we have to create our own | ||
} | ||
else { | ||
else { | ||
// create a new transaction | ||
@@ -499,3 +500,3 @@ transaction = this._getDatabase().createTransaction(); | ||
if (err) { | ||
transaction.rollback(function(transactionErr){ | ||
transaction.rollback(function(transactionErr) { | ||
if (transactionErr) callback(transactionErr); | ||
@@ -511,5 +512,8 @@ else callback(err); | ||
this._changedValues = []; | ||
if (noReload) callback(null, this); | ||
if (noReload) { | ||
callback(null, this); | ||
this._freeLock(); | ||
} | ||
else { | ||
this.reload(function(err){ | ||
this.reload(function(err) { | ||
if (err) callback(err); | ||
@@ -556,2 +560,3 @@ else callback(null, this); | ||
// make sure to emit this event when the transaction was successsfull | ||
@@ -571,2 +576,4 @@ this._emitOnCommit(transaction, 'afterSaveCommit'); | ||
if (err) callback(err); | ||
@@ -576,2 +583,4 @@ else if (stopProcess) callback(); | ||
// build query, add filters | ||
@@ -592,3 +601,3 @@ query = { | ||
else if (stopProcess) callback(); | ||
else { | ||
else { | ||
this._saveDependents(transaction, noReload, function(err) { | ||
@@ -603,8 +612,4 @@ if (err) callback(err); | ||
// so, now we going either to update or save a new record | ||
if (this.isFromDatabase()) { | ||
this._update(transaction, query, afterSaveCallback); | ||
} | ||
else { | ||
this._insert(transaction, query, afterSaveCallback); | ||
} | ||
if (this.isFromDatabase()) this._update(transaction, query, afterSaveCallback); | ||
else this._insert(transaction, query, afterSaveCallback); | ||
} | ||
@@ -637,3 +642,2 @@ }.bind(this)); | ||
transaction.executeQuery('insert', query, function(err, result) { | ||
@@ -640,0 +644,0 @@ if (err) callback(err); |
@@ -105,2 +105,3 @@ !function(){ | ||
, executeQuery: {enumerable: true, value: function(mode, query, callback) { | ||
if (this._transaction) { | ||
@@ -126,5 +127,5 @@ this._queries.push(query); | ||
// work on the queue befire executing this one | ||
// work on the queue before executing this one | ||
this._queue.forEach(function(query){ | ||
this.executeQuery(query.mode, query.query); | ||
this.executeQuery(query.mode, query.query, query.callback); | ||
}.bind(this)); | ||
@@ -131,0 +132,0 @@ |
{ | ||
"name" : "ee-orm" | ||
, "description" : "An easy to use ORM for node.js. Supports eager loading, complex queries, joins, transactions, complex database clusters & connection pooling." | ||
, "version" : "0.5.15" | ||
, "version" : "0.5.16" | ||
, "homepage" : "https://github.com/eventEmitter/ee-orm" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
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
236460
4569