node-mysql的pool必须使用回调方式?
比如必须这样用? var pool = mysql.createPool(config);
pool.getConnection(function(err, connection) { // Use the connection connection.query( ‘SELECT something FROM sometable’, function(err, rows) { // And done with the connection. connection.end();
// Don't use the connection here, it has been returned to the pool.
}); });
感觉挺繁琐的。
1 回复
封装成查询方法 就好了。每次都写难免由出错的时候