test-execute-signed.js 945 B

1234567891011121314151617181920212223242526272829303132
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. var rows = undefined;
  5. var fields = undefined;
  6. connection.query([
  7. 'CREATE TEMPORARY TABLE `test_table` (',
  8. '`id` int(11) unsigned NOT NULL AUTO_INCREMENT,',
  9. '`num` int(15),',
  10. '`l` long,',
  11. 'PRIMARY KEY (`id`)',
  12. ') ENGINE=InnoDB DEFAULT CHARSET=utf8'
  13. ].join('\n'));
  14. connection.query('insert into test_table(num,l) values(?, 3)', [1]);
  15. connection.query('insert into test_table(num,l) values(3-?, -10)', [5]);
  16. connection.query('insert into test_table(num,l) values(4+?, 4000000-?)', [-5, 8000000]);
  17. connection.execute('SELECT * from test_table', [], function(err, _rows, _fields) {
  18. if (err) throw err;
  19. rows = _rows;
  20. fields = _fields;
  21. connection.end();
  22. });
  23. process.on('exit', function() {
  24. assert.deepEqual(rows, [{"id":1,"num":1,"l": 3},{"id":2,"num":-2,"l":-10},{"id":3,"num":-1,"l":-4000000}]);
  25. });