以下代码是运行不了的:
/**
* Created by lqq on 2016/11/16.
*/
"use strict";
var Promise=require('bluebird');
var mysql=Promise.promisifyAll(require('mysql'));
var pool=mysql.createPool({
host:'192.168.0.186',
port:5000,
user:'root',
password:'',
database:'ele'
});
var orm=module.exports={};
orm.createConn = async function () {
let conn= await pool.getConnectionAsync();
return Promise.promisifyAll(conn);
};
orm.query= async function(name,obj){
let conn=orm.createConn();
let res= await conn.createQueryAsync('select * from caseinfo',{});
pool.releaseConnection(conn);
return res;
};
请问是为什么?
认证高级PHP讲师