Yoji SHIDARA
null+****@clear*****
Tue Aug 14 14:36:52 JST 2012
Yoji SHIDARA 2012-08-14 14:36:52 +0900 (Tue, 14 Aug 2012) New Revision: 74cb150270118ba9ded9b5e608f4d37ab42682b1 https://github.com/groonga/gcs/commit/74cb150270118ba9ded9b5e608f4d37ab42682b1 Log: Register table plugin after the database created Modified files: lib/wrapped-nroonga.js Modified: lib/wrapped-nroonga.js (+13 -1) =================================================================== --- lib/wrapped-nroonga.js 2012-08-14 13:46:38 +0900 (b25bab3) +++ lib/wrapped-nroonga.js 2012-08-14 14:36:52 +0900 (ae6ab06) @@ -112,8 +112,20 @@ Context.prototype = { open: function() { if (!this._path) throw new Error('cannot open'); - this._context = new nroonga.Database(this._path); + + try { + // try in open only mode + this._context = new nroonga.Database(this._path, true); + } catch (error) { + // try to create database + this._context = new nroonga.Database(this._path); + this.registerTablePlugin(); + } return this; + }, + + registerTablePlugin: function() { + this.commandSync('register "table/table"'); } }; -------------- next part -------------- HTML����������������������������...Download