A Twitch.tv viewer reward and games system.
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.
 
 
 

33 lines
792 B

var common = require('../../common');
var connection = common.createConnection();
var assert = require('assert');
common.useTestDb(connection);
var procedureName = 'singleSelectProcedure';
var input = 1;
var fieldName = 'param';
var result = undefined;
connection.query([
'CREATE DEFINER=root@localhost PROCEDURE '+procedureName+'(IN '+fieldName+' INT)',
'BEGIN',
'SELECT '+fieldName+';',
'END'
].join('\n'));
connection.query('CALL '+procedureName+'(?)', [input], function(err, _result) {
if (err) throw err;
_result.pop(); // drop metadata
result = _result;
});
connection.query('DROP PROCEDURE '+procedureName);
connection.end();
process.on('exit', function() {
var expected = {};
expected[fieldName] = input;
assert.deepEqual(result, [[expected]]);
});