diff options
Diffstat (limited to 'sql/partition_info.h')
-rw-r--r-- | sql/partition_info.h | 82 |
1 files changed, 51 insertions, 31 deletions
diff --git a/sql/partition_info.h b/sql/partition_info.h index b5a6c4a0961..0ac8dec4945 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,7 +1,7 @@ #ifndef PARTITION_INFO_INCLUDED #define PARTITION_INFO_INCLUDED -/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,10 +67,9 @@ public: /* When we have various string fields we might need some preparation before and clean-up after calling the get_part_id_func's. We need - one such method for get_partition_id and one for - get_part_partition_id and one for get_subpartition_id. + one such method for get_part_partition_id and one for + get_subpartition_id. */ - get_part_id_func get_partition_id_charset; get_part_id_func get_part_partition_id_charset; get_subpart_id_func get_subpartition_id_charset; @@ -84,7 +83,6 @@ public: without duplicates, NULL-terminated. */ Field **full_part_field_array; - Field **full_part_charset_field_array; /* Set of all fields used in partition and subpartition expression. Required for testing of partition fields in write_set when @@ -100,10 +98,8 @@ public: */ uchar **part_field_buffers; uchar **subpart_field_buffers; - uchar **full_part_field_buffers; uchar **restore_part_field_ptrs; uchar **restore_subpart_field_ptrs; - uchar **restore_full_part_field_ptrs; Item *part_expr; Item *subpart_expr; @@ -127,6 +123,8 @@ public: union { longlong *range_int_array; LIST_PART_ENTRY *list_array; + part_column_list_val *range_col_array; + part_column_list_val *list_col_array; }; /******************************************** @@ -157,6 +155,10 @@ public: partition_element *curr_part_elem; partition_element *current_partition; + part_elem_value *curr_list_val; + uint curr_list_object; + uint num_columns; + /* These key_map's are used for Partitioning to enable quick decisions on whether we can derive more information about which partition to @@ -175,17 +177,17 @@ public: uint part_func_len; uint subpart_func_len; - uint no_parts; - uint no_subparts; + uint num_parts; + uint num_subparts; uint count_curr_subparts; uint part_error_code; - uint no_list_values; + uint num_list_values; - uint no_part_fields; - uint no_subpart_fields; - uint no_full_part_fields; + uint num_part_fields; + uint num_subpart_fields; + uint num_full_part_fields; uint has_null_part_id; /* @@ -196,9 +198,9 @@ public: uint16 linear_hash_mask; bool use_default_partitions; - bool use_default_no_partitions; + bool use_default_num_partitions; bool use_default_subpartitions; - bool use_default_no_subpartitions; + bool use_default_num_subpartitions; bool default_partitions_setup; bool defined_max_value; bool list_of_part_fields; @@ -208,7 +210,7 @@ public: bool is_auto_partitioned; bool from_openfrm; bool has_null_value; - + bool column_list; partition_info() : get_partition_id(NULL), get_part_partition_id(NULL), @@ -217,11 +219,8 @@ public: part_charset_field_array(NULL), subpart_charset_field_array(NULL), full_part_field_array(NULL), - full_part_charset_field_array(NULL), part_field_buffers(NULL), subpart_field_buffers(NULL), - full_part_field_buffers(NULL), restore_part_field_ptrs(NULL), restore_subpart_field_ptrs(NULL), - restore_full_part_field_ptrs(NULL), part_expr(NULL), subpart_expr(NULL), item_free_list(NULL), first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL), list_array(NULL), err_value(0), @@ -229,22 +228,23 @@ public: part_func_string(NULL), subpart_func_string(NULL), part_state(NULL), curr_part_elem(NULL), current_partition(NULL), + curr_list_object(0), num_columns(0), default_engine_type(NULL), part_result_type(INT_RESULT), part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION), part_info_len(0), part_state_len(0), part_func_len(0), subpart_func_len(0), - no_parts(0), no_subparts(0), + num_parts(0), num_subparts(0), count_curr_subparts(0), part_error_code(0), - no_list_values(0), no_part_fields(0), no_subpart_fields(0), - no_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0), - use_default_partitions(TRUE), use_default_no_partitions(TRUE), - use_default_subpartitions(TRUE), use_default_no_subpartitions(TRUE), + num_list_values(0), num_part_fields(0), num_subpart_fields(0), + num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0), + use_default_partitions(TRUE), use_default_num_partitions(TRUE), + use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE), default_partitions_setup(FALSE), defined_max_value(FALSE), list_of_part_fields(FALSE), list_of_subpart_fields(FALSE), linear_hash_ind(FALSE), fixed(FALSE), is_auto_partitioned(FALSE), from_openfrm(FALSE), - has_null_value(FALSE) + has_null_value(FALSE), column_list(FALSE) { all_fields_in_PF.clear_all(); all_fields_in_PPF.clear_all(); @@ -267,27 +267,47 @@ public: /* Returns the total number of partitions on the leaf level */ uint get_tot_partitions() { - return no_parts * (is_sub_partitioned() ? no_subparts : 1); + return num_parts * (is_sub_partitioned() ? num_subparts : 1); } bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info, uint start_no); + char *has_unique_fields(); char *has_unique_names(); bool check_engine_mix(handlerton *engine_type, bool default_engine); - bool check_range_constants(); - bool check_list_constants(); + bool check_range_constants(THD *thd); + bool check_list_constants(THD *thd); bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, HA_CREATE_INFO *info, bool check_partition_function); void print_no_partition_found(TABLE *table); + void print_debug(const char *str, uint*); + Item* get_column_item(Item *item, Field *field); + int fix_func_partition(THD *thd, + part_elem_value *val, + partition_element *part_elem, + uint part_id); + bool fix_column_value_functions(THD *thd, + part_elem_value *val, + uint part_id); + int fix_parser_data(THD *thd); + int add_max_value(); + void init_col_val(part_column_list_val *col_val, Item *item); + int reorganize_into_single_field_col_val(); + part_column_list_val *add_column_value(); + bool set_part_expr(char *start_token, Item *item_ptr, + char *end_token, bool is_subpart); + static int compare_column_values(const void *a, const void *b); bool set_up_charset_field_preps(); + bool check_partition_field_length(); + bool init_column_part(); + bool add_column_list_value(THD *thd, Item *item); private: static int list_part_cmp(const void* a, const void* b); - static int list_part_cmp_unsigned(const void* a, const void* b); bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info, uint start_no); bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info); - char *create_default_partition_names(uint part_no, uint no_parts, + char *create_default_partition_names(uint part_no, uint num_parts, uint start_no); char *create_subpartition_name(uint subpart_no, const char *part_name); bool has_unique_name(partition_element *element); @@ -313,7 +333,7 @@ void init_all_partitions_iterator(partition_info *part_info, PARTITION_ITERATOR *part_iter) { part_iter->part_nums.start= part_iter->part_nums.cur= 0; - part_iter->part_nums.end= part_info->no_parts; + part_iter->part_nums.end= part_info->num_parts; part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; part_iter->get_next= get_next_partition_id_range; } |