var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '123456',
port: '3306',
database: 'denglu',
//这一功能打开以后,你就可以像下面的例子一样同时使用多条查询语句:
multipleStatements: true
});
connection.query('select column1; select column2; select column3;', function(err, result){
if(err){
throw err;
}else{
console.log(result[0]); // Column1 as a result
console.log(result[1]); // Column2 as a result
console.log(result[2]); // Column3 as a result
}
});
node-mysql执行多条查询语句
最新推荐文章于 2024-08-30 11:33:05 发布