[Groonga-mysql-commit] mroonga/mroonga at 6ea5245 [master] Check registered check both on create and open

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jun 9 20:34:38 JST 2013


Kouhei Sutou	2013-06-09 20:34:38 +0900 (Sun, 09 Jun 2013)

  New Revision: 6ea52451a28afedd9db8a85fbdc33f4d5fdfc10c
  https://github.com/mroonga/mroonga/commit/6ea52451a28afedd9db8a85fbdc33f4d5fdfc10c

  Message:
    Check registered check both on create and open

  Modified files:
    ha_mroonga.cpp
    ha_mroonga.hpp

  Modified: ha_mroonga.cpp (+22 -14)
===================================================================
--- ha_mroonga.cpp    2013-06-09 20:18:04 +0900 (56d9cf8)
+++ ha_mroonga.cpp    2013-06-09 20:34:38 +0900 (d49aa3c)
@@ -3874,6 +3874,26 @@ void ha_mroonga::ensure_database_directory()
   DBUG_VOID_RETURN;
 }
 
+int ha_mroonga::ensure_normalizers_register()
+{
+  MRN_DBUG_ENTER_METHOD();
+
+  int error = 0;
+#ifdef WITH_GROONGA_NORMALIZER_MYSQL
+  {
+    grn_obj *mysql_normalizer;
+    mysql_normalizer = grn_ctx_get(ctx, "NormalizerMySQLGeneralCI", -1);
+    if (mysql_normalizer) {
+      grn_obj_unlink(ctx, mysql_normalizer);
+    } else {
+      grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
+    }
+  }
+#endif
+
+  DBUG_RETURN(error);
+}
+
 int ha_mroonga::ensure_database_create(const char *name)
 {
   int error;
@@ -3919,17 +3939,7 @@ int ha_mroonga::ensure_database_create(const char *name)
   }
   pthread_mutex_unlock(&mrn_db_mutex);
   grn_ctx_use(ctx, db);
-#ifdef WITH_GROONGA_NORMALIZER_MYSQL
-  {
-    grn_obj *mysql_normalizer;
-    mysql_normalizer = grn_ctx_get(ctx, "NormalizerMySQLGeneralCI", -1);
-    if (mysql_normalizer) {
-      grn_obj_unlink(ctx, mysql_normalizer);
-    } else {
-      grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
-    }
-  }
-#endif
+  error = ensure_normalizers_register();
 
   DBUG_RETURN(error);
 }
@@ -3959,9 +3969,7 @@ int ha_mroonga::ensure_database_open(const char *name)
   }
   pthread_mutex_unlock(&mrn_db_mutex);
   grn_ctx_use(ctx, db);
-#ifdef WITH_GROONGA_NORMALIZER_MYSQL
-  grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
-#endif
+  error = ensure_normalizers_register();
 
   DBUG_RETURN(error);
 }

  Modified: ha_mroonga.hpp (+1 -0)
===================================================================
--- ha_mroonga.hpp    2013-06-09 20:18:04 +0900 (88d47a0)
+++ ha_mroonga.hpp    2013-06-09 20:34:38 +0900 (eb4893e)
@@ -715,6 +715,7 @@ private:
                              grn_obj *grn_table, MRN_SHARE *tmp_share);
   int close_databases();
   void ensure_database_directory();
+  int ensure_normalizers_register();
   int ensure_database_create(const char *name);
   int ensure_database_open(const char *name);
   int wrapper_delete_table(const char *name, MRN_SHARE *tmp_share,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index