Comparing version 0.11.1 to 0.11.2
@@ -6,2 +6,6 @@ Backlog: | ||
0.11.2 | ||
- wrap callbacks in nextTick for exception safety b73ac9868804b603a0ab6df6129cf3682476d118 | ||
- domains support #73 36cba61359c83018a847ac4e7748d920b6f863c4 | ||
0.11.1 | ||
@@ -8,0 +12,0 @@ - buxfix: connection.connect callback was called more than once |
@@ -123,2 +123,3 @@ var Command = require('./command'); | ||
Execute.prototype.resultesetHeader = function(packet) { | ||
var self = this; | ||
var header = new Packets.ResultSetHeader(packet); | ||
@@ -129,3 +130,5 @@ this.resultFieldCount = header.fieldCount; | ||
if (this.onResult) | ||
this.onResult(null, header, []); | ||
process.nextTick(function() { | ||
self.onResult(null, header, []); | ||
}); | ||
return null; | ||
@@ -159,6 +162,9 @@ } | ||
{ | ||
var self = this; | ||
// TODO: refactor to share code with Query::row | ||
if (packet.isEOF()) { | ||
if (this.onResult) | ||
this.onResult(null, this.rows, this.statementInfo.fields); | ||
process.nextTick(function() { | ||
self.onResult(null, self.rows, self.statementInfo.fields); | ||
}) | ||
return null; | ||
@@ -165,0 +171,0 @@ } |
@@ -26,3 +26,3 @@ var Command = require('./command'); | ||
if (this.onResult) | ||
this.onResult(); | ||
process.nextTick(this.onResult.bind(this)); | ||
return null; | ||
@@ -29,0 +29,0 @@ }; |
@@ -11,3 +11,3 @@ var Command = require('./command'); | ||
this.query = sql; | ||
this.onResult = callback; // TODO check felixge multi-result api | ||
this.onResult = callback; | ||
this._fieldCount = 0; | ||
@@ -29,2 +29,3 @@ this._rowParser = null; | ||
Query.prototype.done = function() { | ||
var self = this; | ||
if (this.onResult) { | ||
@@ -40,5 +41,9 @@ var rows, fields; | ||
if (fields) { | ||
this.onResult(null, rows, fields); | ||
process.nextTick(function() { | ||
self.onResult(null, rows, fields); | ||
}); | ||
} else { | ||
this.onResult(null, rows); | ||
process.nextTick(function() { | ||
self.onResult(null, rows); | ||
}); | ||
} | ||
@@ -45,0 +50,0 @@ } |
@@ -294,2 +294,10 @@ var net = require('net'); | ||
function _domainify(callback) { | ||
var domain = process.domain; | ||
if (domain && callback) | ||
return process.domain.bind(callback); | ||
else | ||
return callback; | ||
} | ||
Connection.prototype.query = function(sql, values, cb) { | ||
@@ -317,3 +325,3 @@ // copy-paste from node-mysql/lib/Connection.js:createQuery | ||
var rawSql = this.format(options.sql, options.values || []); | ||
return this.addCommand(new Commands.Query(rawSql, cb)); | ||
return this.addCommand(new Commands.Query(rawSql, _domainify(cb))); | ||
}; | ||
@@ -342,7 +350,7 @@ | ||
return this.addCommand(new Commands.Execute(options.sql, options.values, cb)); | ||
return this.addCommand(new Commands.Execute(options.sql, options.values, _domainify(cb))); | ||
}; | ||
Connection.prototype.ping = function(cb) { | ||
return this.addCommand(new Commands.Ping(cb)); | ||
return this.addCommand(new Commands.Ping(_domainify(cb))); | ||
}; | ||
@@ -354,2 +362,4 @@ | ||
// TODO domainify this callback as well. Note that domain has to be captured | ||
// at the top of function due to nested callback | ||
function callbackOnce(isErrorHandler) { | ||
@@ -421,2 +431,3 @@ return function(param) { | ||
// TODO: domainify | ||
Connection.prototype.end = function(callback) { | ||
@@ -426,3 +437,5 @@ // TODO: implement COM_QUIT command | ||
var endCmd = { connection: this }; | ||
debugger | ||
endCmd.execute = function() { | ||
debugger | ||
self._closing = true; | ||
@@ -429,0 +442,0 @@ this.connection.stream.end(); |
{ | ||
"name": "mysql2", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
228810
111
5363