[Groonga-commit] groonga/gcs [master] Add "reopen()" for wrapped nroonga

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 12:50:34 JST


SHIMODA Hiroshi	2012-08-06 12:50:34 +0900 (Mon, 06 Aug 2012)

  New Revision: cae1eb222b33321513601627f1c22e7587f635b0
  https://github.com/groonga/gcs/commit/cae1eb222b33321513601627f1c22e7587f635b0

  Log:
    Add "reopen()" for wrapped nroonga

  Modified files:
    lib/wrapped-nroonga.js

  Modified: lib/wrapped-nroonga.js (+8 -0)
===================================================================
--- lib/wrapped-nroonga.js    2012-08-06 12:43:19 +0900 (cd3ea4a)
+++ lib/wrapped-nroonga.js    2012-08-06 12:50:34 +0900 (1b17247)
@@ -33,6 +33,7 @@ var TokenBigram =
 function Context(source) {
   if (typeof source == 'string') { // path
     mkdirp.sync(path.dirname(source));
+    this._path = source;
     this._context = new nroonga.Database(source);
   } else if (source instanceof nroonga.Database)
     this._context = source;
@@ -95,6 +96,13 @@ Context.prototype = {
       return column.name.charAt(0) !== '_';
     });
     return ordinalColumns;
+  },
+
+  reopen: function() {
+    if (!this._path)
+      throw new Error('cannot reopen');
+    this._context = new nroonga.Database(this._path);
+    return this;
   }
 };
 
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Descargar 



Groonga-commit メーリングリストの案内
Back to archive index