Allow connectionLmit to be set
This commit is contained in:
parent
999825abea
commit
aac933c39d
46
lib/mysql.js
46
lib/mysql.js
|
@ -37,11 +37,12 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
|
|||
user: s.username || s.user,
|
||||
password: s.password,
|
||||
timezone: s.timezone,
|
||||
// database: s.database,
|
||||
// database: s.database, // Don't configure the DB here so that the pool can be used for multiple DBs
|
||||
debug: s.debug,
|
||||
socketPath: s.socketPath,
|
||||
charset: s.collation.toUpperCase(), // Correct by docs despite seeming odd.
|
||||
supportBigNumbers: s.supportBigNumbers
|
||||
supportBigNumbers: s.supportBigNumbers,
|
||||
connectionLimit: s.connectionLimit || 10
|
||||
});
|
||||
|
||||
dataSource.client.on('error', function (err) {
|
||||
|
@ -55,50 +56,15 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
|
|||
dataSource.connector = new MySQL(dataSource.client, s);
|
||||
dataSource.connector.dataSource = dataSource;
|
||||
|
||||
callback && callback();
|
||||
|
||||
/*
|
||||
dataSource.client.getConnection(function (err, connection) {
|
||||
if (err) {
|
||||
callback && callback(err);
|
||||
return;
|
||||
}
|
||||
connection.query('USE `' + s.database + '`', function (err) {
|
||||
if (err) {
|
||||
if (err.message.match(/(^|: )unknown database/i)) {
|
||||
var dbName = s.database;
|
||||
var charset = s.charset;
|
||||
var collation = s.collation;
|
||||
var q = 'CREATE DATABASE ' + dbName + ' CHARACTER SET ' + charset + ' COLLATE ' + collation;
|
||||
connection.query(q, function (error) {
|
||||
if (!error) {
|
||||
connection.query('USE ' + s.database, function (err, result) {
|
||||
connection.release();
|
||||
callback && callback(err, result);
|
||||
});
|
||||
} else {
|
||||
connection.release();
|
||||
callback && callback(err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
connection.release();
|
||||
callback && callback(err);
|
||||
}
|
||||
} else {
|
||||
connection.release();
|
||||
callback && callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
// MySQL specific column types
|
||||
juggler.ModelBuilder.registerType(function Point() {
|
||||
});
|
||||
|
||||
dataSource.EnumFactory = EnumFactory; // factory for Enums. Note that currently Enums can not be registered.
|
||||
|
||||
process.nextTick(function() {
|
||||
callback && callback();
|
||||
});
|
||||
};
|
||||
|
||||
exports.MySQL = MySQL;
|
||||
|
|
Loading…
Reference in New Issue