Skip to content

Commit 8283fd9

Browse files
committed
add support for queries that don't return a row description
1 parent 5084624 commit 8283fd9

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

index.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,30 @@ Cursor.prototype.submit = function(connection) {
3232
}, true)
3333

3434
con.flush()
35+
36+
con.once('noData', ifNoData)
37+
con.once('rowDescription', function () {
38+
con.removeListener('noData', ifNoData);
39+
});
40+
41+
function ifNoData () {
42+
self.state = 'idle'
43+
self._shiftQueue();
44+
}
3545
}
3646

37-
Cursor.prototype.handleRowDescription = function(msg) {
38-
this._result.addFields(msg.fields)
39-
this.state = 'idle'
47+
Cursor.prototype._shiftQueue = function () {
4048
if(this._queue.length) {
4149
this._getRows.apply(this, this._queue.shift())
4250
}
4351
}
4452

53+
Cursor.prototype.handleRowDescription = function(msg) {
54+
this._result.addFields(msg.fields)
55+
this.state = 'idle'
56+
this._shiftQueue();
57+
}
58+
4559
Cursor.prototype.handleDataRow = function(msg) {
4660
var row = this._result.parseRow(msg.fields)
4761
this._rows.push(row)

0 commit comments

Comments
 (0)