Skip to content

Commit 199eead

Browse files
committed
Added test case for passing options object when streaming query rows (connection.query({sql: 'SELECT ?', values: [ 'value' ]}))
1 parent f08d07d commit 199eead

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var common = require('../../common');
2+
var connection = common.createConnection();
3+
var assert = require('assert');
4+
5+
connection.connect();
6+
7+
var rows = undefined;
8+
var fields = undefined;
9+
var query = connection.query({
10+
sql: 'SELECT ?',
11+
values: [ 1 ]
12+
});
13+
query.on('error', function (err) {
14+
throw err;
15+
});
16+
query.on('fields', function (_fields) {
17+
fields = _fields;
18+
});
19+
query.on('result', function (_rows) {
20+
rows = [ _rows ];
21+
});
22+
23+
connection.end();
24+
25+
process.on('exit', function() {
26+
assert.deepEqual(rows, [{1: 1}]);
27+
assert.equal(fields[0].name, '1');
28+
});

0 commit comments

Comments
 (0)