Skip to content

Commit aa3518c

Browse files
committed
Merge pull request #689 from grncdr/patch-3
query.stream()._read without connection is a no-op
2 parents 57114d4 + 84d512e commit aa3518c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/protocol/sequences/Query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Query.prototype.stream = function(options) {
193193
stream = new Readable(options);
194194

195195
stream._read = function() {
196-
self._connection.resume();
196+
self._connection && self._connection.resume();
197197
};
198198

199199
this.on('result',function(row,i) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var common = require('../../common');
2+
var path = require('path')
3+
var createQuery = require(path.join(common.lib, 'Connection')).createQuery
4+
5+
var query = createQuery('SELECT * FROM some_table')
6+
var stream = query.stream()
7+
8+
// put the stream into flowing mode
9+
stream.on('data', function () { })

0 commit comments

Comments
 (0)