Skip to content

Commit

Permalink
feat: compatible with showSql
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX committed Oct 17, 2016
1 parent 4267c33 commit 84ce8a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/adapters/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ class MySQLAdapter extends Adapter {
params = undefined;
}

const self = this;
this.mysql.getConnection((err, conn) => {
if(err) return callback(err);

Expand All @@ -1045,6 +1046,9 @@ class MySQLAdapter extends Adapter {
}

debug(`executing sql 【${sql}】`);
if(self.options.showSql) {
console.log(`❤️ Toshihiko is executing SQL: 【${sql}】...`);
}
conn.query(sql, function(err, rows) {
conn.release();
callback(err, rows);
Expand Down
3 changes: 2 additions & 1 deletion test/adapters/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ describe("🐣 adapters/mysql", function() {
username: "root",
password: "",
database: "__toshihiko__",
charset: "utf8mb4_general_ci"
charset: "utf8mb4_general_ci",
showSql: true
};

before(function(done) {
Expand Down

0 comments on commit 84ce8a2

Please sign in to comment.