使用node-mysql 的pool 之后老是提示警告,不知为什么。
Calling conn.end() to release a pooled connection is deprecated. In next version calling conn.end() will be restored to default conn.end() behavior. Use conn.re
我的代码:
exports.query = function(sql,data,callback){
var mym = false;
var mycallback;
var mydata;
if (typeof data === 'function'){
mycallback = data;
mydata = [];
}
else{
mycallback = callback;
mydata = data;
};
mym = sql.split(';').length > 1; //有多个sql了
pool.getConnection(function(err,conn){
if(!err){
config.debug || console.log(sql);
conn.query(sql,data,function(err,rows){
conn.end();
if(!err){
if(mycallback) mycallback(null,rows);
}
else{
if(mycallback) mycallback(err,null);
}
});
}
else{
if(mycallback) mycallback(err,null);
}
});
};