[Groonga-mysql-commit] mroonga/mroonga at 1dc9485 [master] Try to use SmartGrnObj

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Feb 24 22:46:28 JST 2014


Kouhei Sutou	2014-02-24 22:46:28 +0900 (Mon, 24 Feb 2014)

  New Revision: 1dc94850742cfb9cfcb7eba2244bbff96b82cce0
  https://github.com/mroonga/mroonga/commit/1dc94850742cfb9cfcb7eba2244bbff96b82cce0

  Message:
    Try to use SmartGrnObj

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+5 -5)
===================================================================
--- ha_mroonga.cpp    2014-02-24 22:42:47 +0900 (a4ed60e)
+++ ha_mroonga.cpp    2014-02-24 22:46:28 +0900 (43082ff)
@@ -88,6 +88,7 @@
 #include <mrn_lock.hpp>
 #include <mrn_condition_converter.hpp>
 #include <mrn_time_converter.hpp>
+#include <mrn_smart_grn_obj.hpp>
 
 #ifdef MRN_SUPPORT_FOREIGN_KEYS
 #  include <sql_table.h>
@@ -2539,10 +2540,9 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name,
     index_column_flags |= GRN_OBJ_WITH_SECTION;
   }
 
-  grn_obj *lexicon_key_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT);
+  mrn::SmartGrnObj lexicon_key_type(ctx, GRN_DB_SHORT_TEXT);
   error = mrn_change_encoding(ctx, key_info->key_part->field->charset());
   if (error) {
-    grn_obj_unlink(ctx, lexicon_key_type);
     DBUG_RETURN(error);
   }
   mrn::IndexTableName index_table_name(grn_table_name, key_info->name);
@@ -2550,15 +2550,15 @@ int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name,
                                  index_table_name.c_str(),
                                  index_table_name.length(),
                                  NULL,
-                                 index_table_flags, lexicon_key_type, 0);
+                                 index_table_flags,
+                                 lexicon_key_type.get(),
+                                 0);
   if (ctx->rc) {
     error = ER_CANT_CREATE_TABLE;
     my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0));
-    grn_obj_unlink(ctx, lexicon_key_type);
     DBUG_RETURN(error);
   }
   mrn_change_encoding(ctx, system_charset_info);
-  grn_obj_unlink(ctx, lexicon_key_type);
   index_tables[i] = index_table;
 
   grn_obj *tokenizer = find_tokenizer(tmp_share->key_parser[i],
-------------- next part --------------
HTML����������������������������...
Download 



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