[Groonga-mysql-commit] mroonga/mroonga at 4ec4d6d [master] Fix wrong value is used

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Dec 24 02:21:22 JST 2017


Kouhei Sutou	2017-12-24 02:21:22 +0900 (Sun, 24 Dec 2017)

  New Revision: 4ec4d6d39e949b2ceeacbc927dcf430c4182614e
  https://github.com/mroonga/mroonga/commit/4ec4d6d39e949b2ceeacbc927dcf430c4182614e

  Message:
    Fix wrong value is used
    
    Now, all tests are passed again.

  Modified files:
    ha_mroonga.cpp
    mrn_mysql_compat.h

  Modified: ha_mroonga.cpp (+11 -4)
===================================================================
--- ha_mroonga.cpp    2017-12-24 02:10:35 +0900 (40e14414)
+++ ha_mroonga.cpp    2017-12-24 02:21:22 +0900 (a0447439)
@@ -15633,16 +15633,23 @@ bool ha_mroonga::storage_inplace_alter_table_rename_column(
       continue;
     }
 
-    Field *new_field = NULL;
+    const char *new_field_name = NULL;
+    size_t new_field_name_length = 0;
     List_iterator_fast<Create_field> create_fields(alter_info->create_list);
     while (Create_field *create_field = create_fields++) {
       if (create_field->field == field) {
-        new_field = create_field->field;
+#ifdef MRN_CREATE_FIELD_USE_LEX_STRING
+        new_field_name = create_field->field_name.str;
+        new_field_name_length = create_field->field_name.length;
+#else
+        new_field_name = create_field->field_name;
+        new_field_name_length = strlen(new_field_name);
+#endif
         break;
       }
     }
 
-    if (!new_field) {
+    if (!new_field_name) {
       continue;
     }
 
@@ -15650,7 +15657,7 @@ bool ha_mroonga::storage_inplace_alter_table_rename_column(
     grn_obj *column_obj;
     column_obj = grn_obj_column(ctx, table_obj, FIELD_NAME(old_field));
     if (column_obj) {
-      grn_column_rename(ctx, column_obj, FIELD_NAME(new_field));
+      grn_column_rename(ctx, column_obj, new_field_name, new_field_name_length);
       if (ctx->rc) {
         int error = ER_WRONG_COLUMN_NAME;
         my_message(error, ctx->errbuf, MYF(0));

  Modified: mrn_mysql_compat.h (+1 -0)
===================================================================
--- mrn_mysql_compat.h    2017-12-24 02:10:35 +0900 (8572cc7b)
+++ mrn_mysql_compat.h    2017-12-24 02:21:22 +0900 (d5e1b5d8)
@@ -79,6 +79,7 @@
 #  define MRN_KEY_NAME_IS_LEX_STRING
 #  define MRN_FIELD_FIELD_NAME_IS_LEX_STRING
 #  define MRN_FIELD_SET_USE_LEX_STRING
+#  define MRN_CREATE_FIELD_USE_LEX_STRING
 #endif
 
 #ifdef MRN_KEY_NAME_IS_LEX_STRING
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-mysql-commit/attachments/20171224/13c3346b/attachment-0001.htm 



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