Skip to content

Commit 360748d

Browse files
committed
Fix: Passing nestTables to Connection#query
Fixes #221
1 parent 5222237 commit 360748d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/protocol/sequences/Query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Query(options, callback) {
1414
this.typeCast = (options.typeCast === undefined)
1515
? true
1616
: options.typeCast;
17-
this.nestTables = false;
17+
this.nestTables = options.nestTables || false;
1818

1919
this._resultSet = null;
2020
this._results = [];

test/integration/test-nested-tables-query.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ connection.query([
1515

1616
connection.query('INSERT INTO ' + table + ' SET ?', {title: 'test'});
1717

18+
var options = {
19+
nestTables: true,
20+
sql: 'SELECT * FROM ' + table,
21+
};
22+
1823
var rows;
19-
var query = connection.query('SELECT * FROM ' + table, function(err, _rows) {
24+
var query = connection.query(options, function(err, _rows) {
2025
if (err) throw err;
2126

2227
rows = _rows;
2328
});
2429

25-
query.nestTables = true;
26-
2730
connection.end();
2831

2932
process.on('exit', function() {

0 commit comments

Comments
 (0)