diff options
author | Mikael Ronstrom <mikael@mysql.com> | 2009-12-17 18:39:10 +0100 |
---|---|---|
committer | Mikael Ronstrom <mikael@mysql.com> | 2009-12-17 18:39:10 +0100 |
commit | 7548f142c39d6f7d9a995bd4478c62ef6baa5e19 (patch) | |
tree | dc87d904496dc0919e3aa3f4ea3d6896bd8f3f7a /sql | |
parent | ed02cca13ab2446140b47e8756bccc404a66fe6b (diff) | |
download | mariadb-git-7548f142c39d6f7d9a995bd4478c62ef6baa5e19.tar.gz |
BUG#49591, Fixed version string in SHOW CREATE TABLE to accomodate for column list partitioning and new function to_seconds
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.h | 9 | ||||
-rw-r--r-- | sql/item_timefunc.h | 9 | ||||
-rw-r--r-- | sql/partition_info.cc | 36 | ||||
-rw-r--r-- | sql/partition_info.h | 1 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 |
5 files changed, 56 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h index 24d800300e7..2c798123852 100644 --- a/sql/item.h +++ b/sql/item.h @@ -894,6 +894,15 @@ public: (*traverser)(this, arg); } + /* + This is used to get the most recent version of any function in + an item tree. The version is the version where a MySQL function + was introduced in. So any function which is added should use + this function and set the int_arg to maximum of the input data + and their own version info. + */ + virtual bool intro_version(uchar *int_arg) { return 0; } + virtual bool remove_dependence_processor(uchar * arg) { return 0; } virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; } virtual bool cleanup_processor(uchar *arg); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index cdd74c8c601..31726585e88 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -91,6 +91,15 @@ public: enum_monotonicity_info get_monotonicity_info() const; longlong val_int_endpoint(bool left_endp, bool *incl_endp); bool check_partition_func_processor(uchar *bool_arg) { return FALSE;} + + bool intro_version(uchar *int_arg) + { + int *input_version= (int*)int_arg; + /* This function was introduced in 5.5 */ + int output_version= (*input_version, 50500); + *input_version= output_version; + return 0; + } }; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 56d79ac0d45..65029a817de 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -116,6 +116,42 @@ char *partition_info::create_default_partition_names(uint part_no, /* + Generate a version string for partition expression + This function must be updated every time there is a possibility for + a new function of a higher version number than 5.5.0. + + SYNOPSIS + set_show_version_string() + RETURN VALUES + None +*/ +void partition_info::set_show_version_string(String *packet) +{ + int version= 0; + if (column_list) + packet->append(STRING_WITH_LEN("\n/*!50500")); + else + { + if (part_expr) + part_expr->walk(&Item::intro_version, 0, (uchar*)&version); + if (subpart_expr) + subpart_expr->walk(&Item::intro_version, 0, (uchar*)&version); + if (version == 0) + { + /* No new functions in partition function */ + packet->append(STRING_WITH_LEN("\n/*!50100")); + } + else + { + char buf[65]; + char *buf_ptr= longlong10_to_str((longlong)version, buf, 10); + packet->append(STRING_WITH_LEN("\n/*!")); + packet->append(buf, (size_t)(buf_ptr - buf)); + } + } +} + +/* Create a unique name for the subpartition as part_name'sp''subpart_no' SYNOPSIS create_subpartition_name() diff --git a/sql/partition_info.h b/sql/partition_info.h index 0ac8dec4945..479714a3928 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -302,6 +302,7 @@ public: bool check_partition_field_length(); bool init_column_part(); bool add_column_list_value(THD *thd, Item *item); + void set_show_version_string(String *packet); private: static int list_part_cmp(const void* a, const void* b); bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b9f5015f8f0..1b1545f538c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1497,7 +1497,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, show_table_options, NULL, NULL)))) { - packet->append(STRING_WITH_LEN("\n/*!50100")); + table->part_info->set_show_version_string(packet); packet->append(part_syntax, part_syntax_len); packet->append(STRING_WITH_LEN(" */")); my_free(part_syntax, MYF(0)); |