[Groonga-commit] groonga/gcs [master] Delete tables by Domain

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 12日 (木) 18:23:10 JST


SHIMODA Hiroshi	2012-07-12 18:23:10 +0900 (Thu, 12 Jul 2012)

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

  Log:
    Delete tables by Domain

  Modified files:
    lib/api/2011-02-01/configuration.js
    lib/database/domain.js

  Modified: lib/api/2011-02-01/configuration.js (+1 -6)
===================================================================
--- lib/api/2011-02-01/configuration.js    2012-07-12 18:21:36 +0900 (3347330)
+++ lib/api/2011-02-01/configuration.js    2012-07-12 18:23:10 +0900 (6675ae8)
@@ -106,12 +106,7 @@ function createDeleteDomainResponse(options) {
 handlers.DeleteDomain = function(context, request, response) {
   var domain = new Domain(request, context);
   try {
-    context.commandSync('table_remove', {
-      name: domain.tableName
-    });
-    context.commandSync('table_remove', {
-      name: domain.termsTableName
-    });
+    domain.deleteSync();
     var host = getBaseDomain(request.headers.host);
     host = host ? '.' + host : '';
     response.contentType('application/xml');

  Modified: lib/database/domain.js (+11 -0)
===================================================================
--- lib/database/domain.js    2012-07-12 18:21:36 +0900 (13a4e04)
+++ lib/database/domain.js    2012-07-12 18:23:10 +0900 (42d682c)
@@ -149,6 +149,17 @@ Domain.prototype = {
       key_type: nroonga.ShortText,
       default_tokenizer: nroonga.TokenBigram
     });
+  },
+  deleteSync: function() {
+    if (!this.context)
+      throw new Error('no context');
+
+    this.context.commandSync('table_remove', {
+      name: this.tableName
+    });
+    this.context.commandSync('table_remove', {
+      name: this.termsTableName
+    });
   }
 };
 
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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