fix connection.release error in mysql socket

This commit is contained in:
lichengyin 2015-10-23 17:20:23 +08:00
parent 586d5002dd
commit 9a6fbdabc6

View File

@ -110,15 +110,18 @@ export default class extends think.adapter.socket {
// just call connection.release() and the connection will return to the pool,
// ready to be used again by someone else.
// https://github.com/felixge/node-mysql#pooling-connections
connection.release();
if(this.pool && connection.release){
connection.release();
}
if (this.config.log_sql) {
think.log(sql, 'SQL', startTime);
}
return rows;
}).catch(err => {
//no connection.release method when has error
//connection.release();
if(this.pool && connection.release){
connection.release();
}
if (this.config.log_sql) {
think.log(sql, 'SQL', startTime);