不要怂,就是干,撸起袖子干!

Commit 54ff01f4 by Po-Ying Chen

node-mysql options

1 parent 2ba78f18
Showing with 12 additions and 5 deletions
...@@ -253,17 +253,25 @@ module.exports = (function() { ...@@ -253,17 +253,25 @@ module.exports = (function() {
} }
var connect = function(done, config) { var connect = function(done, config) {
var emitter = new (require('events').EventEmitter)()
config = config || this.config config = config || this.config
var connection = mysql.createConnection({ var emitter = new (require('events').EventEmitter)()
var connectionConfig = {
host: config.host, host: config.host,
port: config.port, port: config.port,
user: config.username, user: config.username,
password: config.password, password: config.password,
database: config.database, database: config.database,
timezone: 'Z' timezone: 'Z'
}) };
if (config.nodeMysql) {
Object.keys(config.nodeMysql).forEach(function (key) {
connectionConfig[key] = config.nodeMysql[key];
});
}
var connection = mysql.createConnection(connectionConfig);
connection.connect(function(err) { connection.connect(function(err) {
if (err) { if (err) {
...@@ -386,4 +394,4 @@ module.exports = (function() { ...@@ -386,4 +394,4 @@ module.exports = (function() {
} }
return ConnectorManager return ConnectorManager
})() })()
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!