diff --git a/Readme.md b/Readme.md index 3fd0209bc..275069dc6 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,9 @@ + +NOTE ON THIS FORK + +this fork adds an event emission "endOfQueue" whenever the end of the queue is reached. + + # node-mysql [![Build Status](https://secure.travis-ci.org/felixge/node-mysql.png)](http://travis-ci.org/felixge/node-mysql) diff --git a/lib/Connection.js b/lib/Connection.js index 4308c6776..4c9aea6ab 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -31,6 +31,7 @@ Connection.prototype.connect = function(cb) { this._socket.on('error', this._handleNetworkError.bind(this)); this._protocol.on('unhandledError', this._handleProtocolError.bind(this)); this._protocol.on('end', this._handleProtocolEnd.bind(this)); + this._protocol.on('endOfQueue', this._handleProtocolEoq.bind(this)); } this._protocol.handshake(cb); @@ -130,6 +131,10 @@ Connection.prototype._handleProtocolEnd = function(err) { this.emit('end', err); }; +Connection.prototype._handleProtocolEoq = function() { + this.emit('endOfQueue'); +}; + Connection.prototype._implyConnect = function() { if (!this._connectCalled) { this.connect(); diff --git a/lib/protocol/Protocol.js b/lib/protocol/Protocol.js index f518cc6e2..c53ec3df4 100644 --- a/lib/protocol/Protocol.js +++ b/lib/protocol/Protocol.js @@ -195,6 +195,7 @@ Protocol.prototype._dequeue = function() { var sequence = this._queue[0]; if (!sequence) { + this.emit("endOfQueue"); return; }