You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
744 B
31 lines
744 B
var common = require('../../common');
|
|
var connection = common.createConnection({multipleStatements: true});
|
|
var assert = require('assert');
|
|
|
|
var sql = [
|
|
'SELECT 1',
|
|
'USE ' + common.testDatabase,
|
|
'SELECT 2',
|
|
].join('; ');
|
|
|
|
var results;
|
|
var fields;
|
|
connection.query(sql, function(err, _results, _fields) {
|
|
if (err) throw err;
|
|
|
|
results = _results;
|
|
fields = _fields;
|
|
});
|
|
|
|
connection.end();
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(results.length, 3);
|
|
assert.deepEqual(results[0], [{1: 1}]);
|
|
assert.strictEqual(results[1].constructor.name, 'OkPacket');
|
|
assert.deepEqual(results[2], [{2: 2}]);
|
|
|
|
assert.equal(fields[0][0].name, '1');
|
|
assert.equal(fields[1], undefined);
|
|
assert.equal(fields[2][0].name, '2');
|
|
});
|