mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
add support for queries that don't return a row description
This commit is contained in:
parent
5084624e8d
commit
8283fd9b22
20
index.js
20
index.js
@ -32,14 +32,28 @@ Cursor.prototype.submit = function(connection) {
|
||||
}, true)
|
||||
|
||||
con.flush()
|
||||
|
||||
con.once('noData', ifNoData)
|
||||
con.once('rowDescription', function () {
|
||||
con.removeListener('noData', ifNoData);
|
||||
});
|
||||
|
||||
function ifNoData () {
|
||||
self.state = 'idle'
|
||||
self._shiftQueue();
|
||||
}
|
||||
}
|
||||
|
||||
Cursor.prototype._shiftQueue = function () {
|
||||
if(this._queue.length) {
|
||||
this._getRows.apply(this, this._queue.shift())
|
||||
}
|
||||
}
|
||||
|
||||
Cursor.prototype.handleRowDescription = function(msg) {
|
||||
this._result.addFields(msg.fields)
|
||||
this.state = 'idle'
|
||||
if(this._queue.length) {
|
||||
this._getRows.apply(this, this._queue.shift())
|
||||
}
|
||||
this._shiftQueue();
|
||||
}
|
||||
|
||||
Cursor.prototype.handleDataRow = function(msg) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user