summaryrefslogtreecommitdiff
path: root/storage/mroonga/mrn_mysql_compat.h
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2015-06-24 07:16:08 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2015-06-24 07:16:08 +0300
commit2e4984c185ddcd2da789017cd147338846ff409a (patch)
tree0293831900c860600efbaa747ea886d9d1cbf5bd /storage/mroonga/mrn_mysql_compat.h
parent792b53e80806df893ee62c9a1c1bd117114c8c6d (diff)
parenta6087e7dc1ef3561d8189c8db15e9591d0f9b520 (diff)
downloadmariadb-git-10.0-FusionIO.tar.gz
Merge tag 'mariadb-10.0.20' into 10.0-FusionIO10.0-FusionIO
Conflicts: storage/innobase/os/os0file.cc storage/xtradb/os/os0file.cc storage/xtradb/srv/srv0start.cc
Diffstat (limited to 'storage/mroonga/mrn_mysql_compat.h')
-rw-r--r--storage/mroonga/mrn_mysql_compat.h115
1 files changed, 96 insertions, 19 deletions
diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h
index 7312dd70827..a717220a35c 100644
--- a/storage/mroonga/mrn_mysql_compat.h
+++ b/storage/mroonga/mrn_mysql_compat.h
@@ -1,6 +1,6 @@
/* -*- c-basic-offset: 2 -*- */
/*
- Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
+ Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,15 +22,6 @@
#include "mrn_mysql.h"
-#if MYSQL_VERSION_ID >= 50500
-# define my_free(PTR, FLAG) my_free(PTR)
-#endif
-
-#if MYSQL_VERSION_ID < 50500
-# define mysql_mutex_lock(mutex) pthread_mutex_lock(mutex)
-# define mysql_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
-#endif
-
#if MYSQL_VERSION_ID >= 50604
# define MRN_HAVE_MYSQL_TYPE_TIMESTAMP2
# define MRN_HAVE_MYSQL_TYPE_DATETIME2
@@ -70,26 +61,34 @@
# define KEY_N_KEY_PARTS(key) (key)->key_parts
#endif
-#if MYSQL_VERSION_ID < 100000 || !defined(MRN_MARIADB_P)
-# define init_alloc_root(PTR, SZ1, SZ2, FLAG) init_alloc_root(PTR, SZ1, SZ2)
+#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000
+# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
+ init_alloc_root(PTR, SZ1, SZ2, FLAG)
+#elif MYSQL_VERSION_ID >= 50706
+# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
+ init_alloc_root(mrn_memory_key, PTR, SZ1, SZ2)
+#else
+# define mrn_init_alloc_root(PTR, SZ1, SZ2, FLAG) \
+ init_alloc_root(PTR, SZ1, SZ2)
#endif
#if MYSQL_VERSION_ID < 100002 || !defined(MRN_MARIADB_P)
# define GTS_TABLE 0
#endif
-/* For MySQL 5.1. MySQL 5.1 doesn't have FN_LIBCHAR2. */
-#ifndef FN_LIBCHAR2
-# define FN_LIBCHAR2 FN_LIBCHAR
-#endif
-
#if MYSQL_VERSION_ID >= 50607
# if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P)
# define MRN_GET_ERROR_MESSAGE thd_get_error_message(current_thd)
# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd_get_error_row(thd)
# else
# define MRN_GET_ERROR_MESSAGE current_thd->get_stmt_da()->message()
-# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->get_stmt_da()->current_row_for_warning()
+# if MYSQL_VERSION_ID >= 50706
+# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) \
+ thd->get_stmt_da()->current_row_for_condition()
+# else
+# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) \
+ thd->get_stmt_da()->current_row_for_warning()
+# endif
# endif
#else
# if MYSQL_VERSION_ID >= 50500
@@ -105,7 +104,7 @@
# define MRN_ITEM_HAVE_ITEM_NAME
#endif
-#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50700
+#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 100000
# define MRN_HAVE_TABLE_DEF_CACHE
#endif
@@ -140,4 +139,82 @@
# define MRN_USE_MYSQL_DATA_HOME
#endif
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_SEVERITY_WARNING Sql_condition::SL_WARNING
+#else
+# define MRN_SEVERITY_WARNING Sql_condition::WARN_LEVEL_WARN
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_PSI_MEMORY_KEY
+#endif
+
+#ifdef MRN_HAVE_PSI_MEMORY_KEY
+# define mrn_my_malloc(size, flags) \
+ my_malloc(mrn_memory_key, size, flags)
+# define mrn_my_strdup(string, flags) \
+ my_strdup(mrn_memory_key, string, flags)
+# define mrn_my_strndup(string, size, flags) \
+ my_strndup(mrn_memory_key, string, size, flags)
+# define mrn_my_multi_malloc(flags, ...) \
+ my_multi_malloc(mrn_memory_key, flags, __VA_ARGS__)
+#else
+# define mrn_my_malloc(size, flags) my_malloc(size, flags)
+# define mrn_my_strdup(string, flags) my_strdup(string, flags)
+# define mrn_my_strndup(string, size, flags) \
+ my_strndup(string, size, flags)
+# define mrn_my_multi_malloc(flags, ...) \
+ my_multi_malloc(flags, __VA_ARGS__)
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_STRING_FREE(string) string.mem_free();
+#else
+# define MRN_STRING_FREE(string) string.free();
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_THD_DB_PATH(thd) ((thd)->db().str)
+#else
+# define MRN_THD_DB_PATH(thd) ((thd)->db)
+#endif
+
+#ifndef INT_MAX64
+# define INT_MAX64 LONGLONG_MAX
+#endif
+
+#ifdef UINT_MAX
+# define UINT_MAX64 UINT_MAX
+#else
+# define UINT_MAX64 LONGLONG_MAX
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define mrn_my_stpmov(dst, src) my_stpmov(dst, src)
+#else
+# define mrn_my_stpmov(dst, src) strmov(dst, src)
+#endif
+
+#if MYSQL_VERSION_ID >= 50607
+# if !defined(MRN_MARIADB_P)
+# define MRN_HAVE_SQL_OPTIMIZER_H
+# endif
+#endif
+
+#if MYSQL_VERSION_ID >= 50600 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_BINLOG_H
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_HAVE_SPATIAL
+#elif defined(HAVE_SPATIAL)
+# define MRN_HAVE_SPATIAL
+#endif
+
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+# define MRN_FORMAT_STRING_LENGTH "zu"
+#else
+# define MRN_FORMAT_STRING_LENGTH "u"
+#endif
+
#endif /* MRN_MYSQL_COMPAT_H_ */