Small fix for using mySQL Database backend. Switch mysql.CreateConnection to mysql.CreatePool.
This commit is contained in:
parent
9d023b8e09
commit
2ab250a10b
4
db.js
4
db.js
|
@ -665,13 +665,13 @@ module.exports.CreateDB = function (parent, func) {
|
||||||
} else if (parent.args.mysql) {
|
} else if (parent.args.mysql) {
|
||||||
// Use MySQL
|
// Use MySQL
|
||||||
obj.databaseType = 5;
|
obj.databaseType = 5;
|
||||||
var tempDatastore = require('mysql').createConnection(connectionObject);
|
var tempDatastore = require('mysql').createPool(connectionObject);
|
||||||
tempDatastore.query('CREATE DATABASE IF NOT EXISTS ' + dbname, function (error) {
|
tempDatastore.query('CREATE DATABASE IF NOT EXISTS ' + dbname, function (error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
console.log('Auto-create database failed: ' + error);
|
console.log('Auto-create database failed: ' + error);
|
||||||
}
|
}
|
||||||
connectionObject.database = dbname;
|
connectionObject.database = dbname;
|
||||||
Datastore = require('mysql').createConnection(connectionObject);
|
Datastore = require('mysql').createPool(connectionObject);
|
||||||
createTablesIfNotExist(dbname);
|
createTablesIfNotExist(dbname);
|
||||||
});
|
});
|
||||||
setTimeout(function () { tempDatastore.end(); }, 2000);
|
setTimeout(function () { tempDatastore.end(); }, 2000);
|
||||||
|
|
Loading…
Reference in New Issue