[Groonga-mysql-commit] mroonga/mroonga at efaa267 [master] mysql8: add compatibility layer for Alter_info::key_list

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 9 12:17:09 JST 2018


Kouhei Sutou	2018-07-09 12:17:09 +0900 (Mon, 09 Jul 2018)

  New Revision: efaa267e85100f9d096d3e5c1093ae23c8459b22
  https://github.com/mroonga/mroonga/commit/efaa267e85100f9d096d3e5c1093ae23c8459b22

  Message:
    mysql8: add compatibility layer for Alter_info::key_list

  Modified files:
    ha_mroonga.cpp
    mrn_mysql_compat.h

  Modified: ha_mroonga.cpp (+1 -4)
===================================================================
--- ha_mroonga.cpp    2018-07-09 11:57:37 +0900 (0916976a)
+++ ha_mroonga.cpp    2018-07-09 12:17:09 +0900 (ccfce6cc)
@@ -4026,11 +4026,8 @@ bool ha_mroonga::storage_create_foreign_key(TABLE *table,
   MRN_DBUG_ENTER_METHOD();
   LEX *lex = ha_thd()->lex;
   Alter_info *alter_info = MRN_LEX_GET_ALTER_INFO(lex);
-  List_iterator<Key> key_iterator(alter_info->key_list);
-  Key *key;
   char ref_db_buff[NAME_LEN + 1], ref_table_buff[NAME_LEN + 1];
-  while ((key = key_iterator++))
-  {
+  MRN_KEY_EACH_BEGIN(alter_info->key_list, key) {
     if (key->type != MRN_KEYTYPE_FOREIGN)
     {
       continue;

  Modified: mrn_mysql_compat.h (+19 -0)
===================================================================
--- mrn_mysql_compat.h    2018-07-09 11:57:37 +0900 (fc22e987)
+++ mrn_mysql_compat.h    2018-07-09 12:17:09 +0900 (259cdbd0)
@@ -646,3 +646,22 @@
                                alias,                           \
                                lock_type)
 #endif
+
+#if MYSQL_VERSION_ID >= 80011 && !defined(MRN_MARIADB_P)
+  typedef Key_spec mrn_key;
+#  define MRN_KEY_EACH_BEGIN(key_list, key)                     \
+  for (size_t key_i; key_i < key_list.size(); ++key_i) {        \
+    const mrn_key *key = key_list[key_i];
+#  define MRN_KEY_EACH_END()                    \
+  }
+#else
+  typedef Key mrn_key;
+#  define MRN_KEY_EACH_BEGIN(key_list, key)             \
+  {                                                     \
+    List_iterator<mrn_key> key_iterator(key_list);      \
+    const mrn_key *key;                                 \
+    while ((key = key_iterator++)) {
+#  define MRN_KEY_EACH_END()                    \
+  }
+#endif
+
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-mysql-commit/attachments/20180709/83537949/attachment-0001.htm 



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