fix dbname

This commit is contained in:
AJ ONeal 2015-11-17 08:33:54 +00:00
parent efc10cab3b
commit cf5e734618
4 changed files with 6 additions and 3 deletions

View File

@ -429,6 +429,9 @@ module.exports.create = function (opts, verbs, mySocket) {
} }
}; };
if (opts.init) {
return db.init(opts);
}
return db; return db;
}); });
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "sqlite3-cluster", "name": "sqlite3-cluster",
"version": "1.1.2", "version": "2.0.0",
"description": "A wrapper to enable the use of sqlite3 with node cluster via a socket server (i.e. for Raspberry Pi 2).", "description": "A wrapper to enable the use of sqlite3 with node cluster via a socket server (i.e. for Raspberry Pi 2).",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -84,7 +84,7 @@ function createApp(servers, options) {
switch(cmd.type) { switch(cmd.type) {
case 'init': case 'init':
console.log('[S] init', cmd); //console.log('[S] init', cmd);
db[cmd.func].apply(db, cmd.args).then(function () { db[cmd.func].apply(db, cmd.args).then(function () {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
var myself; var myself;

View File

@ -20,7 +20,6 @@ function create(opts, verbs) {
var PromiseA = verbs.Promise || require('bluebird'); var PromiseA = verbs.Promise || require('bluebird');
var dbname = ""; var dbname = "";
dbname += (opts.dirname || '');
dbname += (opts.prefix || ''); dbname += (opts.prefix || '');
if (opts.subtenant) { if (opts.subtenant) {
dbname += opts.subtenant + '.'; dbname += opts.subtenant + '.';
@ -31,6 +30,7 @@ function create(opts, verbs) {
dbname += (opts.dbname || ''); dbname += (opts.dbname || '');
dbname += (opts.suffix || ''); dbname += (opts.suffix || '');
dbname += (opts.ext || ''); dbname += (opts.ext || '');
dbname = require('path').resolve(opts.dirname || '', dbname);
function initDb(newOpts) { function initDb(newOpts) {
if (dbs[dbname].initPromise) { if (dbs[dbname].initPromise) {