比如必须这样用? 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)
H
封装成查询方法 就好了。每次都写难免由出错的时候
参与回复
登录后即可参与回复。登录