2014-10-23 10:52:21 -04:00
|
|
|
var common = require('../../common');
|
|
|
|
var connection = common.createConnection();
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var onExecuteResultError = undefined;
|
|
|
|
var onQueryResultError = undefined;
|
|
|
|
var onExecuteErrorEvent = undefined;
|
|
|
|
var onQueryErrorEvent = undefined;
|
|
|
|
var onExecuteErrorEvent1 = undefined;
|
|
|
|
var onQueryErrorEvent1 = undefined;
|
|
|
|
|
|
|
|
connection.execute('error in execute', [], function(err, _rows, _fields) {
|
|
|
|
if (err) {
|
|
|
|
onExecuteResultError = true;
|
|
|
|
}
|
|
|
|
}).on('error', function() {
|
|
|
|
onExecuteErrorEvent = true;
|
|
|
|
});
|
|
|
|
connection.query('error in query', [], function(err, _rows, _fields) {
|
|
|
|
if (err) {
|
|
|
|
onQueryResultError = true;
|
|
|
|
}
|
|
|
|
}).on('error', function() {
|
|
|
|
onQueryErrorEvent = true;
|
|
|
|
});
|
|
|
|
connection.execute('error in execute 1', []).on('error', function() {
|
|
|
|
onExecuteErrorEvent1 = true;
|
|
|
|
});
|
|
|
|
connection.query('error in query 1').on('error', function() {
|
|
|
|
onQueryErrorEvent1 = true;
|
2015-01-28 15:33:44 -05:00
|
|
|
connection.end();
|
2014-10-23 10:52:21 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
process.on('exit', function() {
|
|
|
|
assert.equal(onExecuteResultError, true);
|
|
|
|
assert.equal(onQueryResultError, true);
|
|
|
|
assert.equal(onExecuteErrorEvent, undefined);
|
|
|
|
assert.equal(onQueryErrorEvent, undefined);
|
|
|
|
assert.equal(onExecuteErrorEvent1, true);
|
|
|
|
assert.equal(onQueryErrorEvent1, true);
|
|
|
|
});
|