Yoji SHIDARA
null+****@clear*****
Tue Aug 14 13:46:38 JST 2012
Yoji SHIDARA 2012-08-14 13:46:38 +0900 (Tue, 14 Aug 2012) New Revision: addd15c0af623392195f766a4fa578bbd58b5c20 https://github.com/groonga/gcs/commit/addd15c0af623392195f766a4fa578bbd58b5c20 Log: Open a database in one place Modified files: lib/wrapped-nroonga.js Modified: lib/wrapped-nroonga.js (+8 -2) =================================================================== --- lib/wrapped-nroonga.js 2012-08-14 12:34:11 +0900 (cabc83c) +++ lib/wrapped-nroonga.js 2012-08-14 13:46:38 +0900 (b25bab3) @@ -34,7 +34,7 @@ function Context(source) { if (typeof source == 'string') { // path mkdirp.sync(path.dirname(source)); this._path = source; - this._context = new nroonga.Database(source); + this.open(); } else if (source instanceof nroonga.Database) this._context = source; else @@ -104,8 +104,14 @@ Context.prototype = { }, reopen: function() { + this.close(); + this.open(); + return this; + }, + + open: function() { if (!this._path) - throw new Error('cannot reopen'); + throw new Error('cannot open'); this._context = new nroonga.Database(this._path); return this; } -------------- next part -------------- HTML����������������������������...Download