This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/node_modules/mysql2/examples/sprocedure.js

12 lines
560 B
JavaScript
Raw Normal View History

2014-09-24 17:56:53 -04:00
var mysql = require('../test/common').createConnection();
//var create_proc = "mysql.query('DROP PROCEDURE IF EXISTS p; CREATE PROCEDURE p(IN i INT) BEGIN SELECT i as f; END;');";
var create_proc = "CREATE PROCEDURE `get_user1`(IN supplied_user_id INT) BEGIN select * from mil1 ua where ua.id = supplied_user_id; END";
mysql.query(create_proc, function(err, rows, fields) {
console.log('Error:', err, rows, fields);
});
mysql.execute('CALL get_user1(?)', [ 1 ], function (err, rows) {
console.log(JSON.stringify(err, rows, null, 2));
mysql.end();
});