Commit 35f1ee03 authored by unknown's avatar unknown
Browse files

BUG#18198

Review comments


sql/item.h:
  Added comment after review
sql/item_cmpfunc.h:
  Changed to either return TRUE or FALSE (check_partition_func_processor)
sql/item_func.h:
  Changed to either return TRUE or FALSE (check_partition_func_processor)
sql/item_strfunc.h:
  Changed to either return TRUE or FALSE (check_partition_func_processor)
sql/item_timefunc.h:
  Changed to either return TRUE or FALSE (check_partition_func_processor)
sql/item_xmlfunc.h:
  Changed to either return TRUE or FALSE (check_partition_func_processor)
parent 2c9ab3a1
Loading
Loading
Loading
Loading
+35 −18
Original line number Diff line number Diff line
@@ -846,8 +846,31 @@ class Item {
    allowed in a partition function then it is very important to consider
    whether this should be inherited to the new class. If not the function
    below should be defined in the new Item class.
  */
  virtual bool check_partition_func_processor(byte *bool_arg) { return FALSE; }

    The general behaviour is that most integer functions are allowed.
    If the partition function contains any multi-byte collations then
    the function check_part_func_fields will report an error on the
    partition function independent of what functions are used. So the
    only character sets allowed are single character collation and
    even for those only a limited set of functions are allowed. The
    problem with multi-byte collations is that almost every string
    function has the ability to change things such that two strings
    that are equal will not be equal after manipulated by a string
    function. E.g. two strings one contains a double s, there is a
    special german character that is equal to two s. Now assume a
    string function removes one character at this place, then in
    one the double s will be removed and in the other there will
    still be one s remaining and the strings are no longer equal
    and thus the partition function will not sort equal strings into
    the same partitions.

    So the check if a partition function is valid is two steps. First
    check that the field types are valid, next check that the partition
    function is valid. The current set of partition functions valid
    assumes that there are no multi-byte collations amongst the partition
    fields.
  */
  virtual bool check_partition_func_processor(byte *bool_arg) { return TRUE;}
  virtual bool subst_argument_checker(byte **arg)
  { 
    if (*arg)
@@ -1410,8 +1433,7 @@ class Item_null_result :public Item_null
  {
    save_in_field(result_field, no_conversions);
  }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};  

/* Item represents one placeholder ('?') of prepared statement */
@@ -1702,8 +1724,7 @@ class Item_static_float_func :public Item_float
  {}
  void print(String *str) { str->append(func_name); }
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};


@@ -1796,8 +1817,7 @@ class Item_static_string_func :public Item_string
  {}
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  void print(String *str) { str->append(func_name); }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};


@@ -1810,8 +1830,7 @@ class Item_datetime :public Item_string
                                                    &my_charset_bin)
  { max_length=19;}
  enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};

class Item_empty_string :public Item_string
@@ -1834,8 +1853,7 @@ class Item_return_int :public Item_int
    unsigned_flag=1;
  }
  enum_field_types field_type() const { return int_field_type; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};


@@ -2086,8 +2104,7 @@ class Item_int_with_ref :public Item_int
  }
  Item *new_item();
  virtual Item *real_item() { return ref; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};

#ifdef MYSQL_SERVER
+14 −15
Original line number Diff line number Diff line
@@ -1043,8 +1043,7 @@ class Item_is_not_null_test :public Item_func_isnull
  */
  table_map used_tables() const
    { return used_tables_cache | RAND_TABLE_BIT; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= 0; return FALSE; }
  bool check_partition_func_processor(byte *int_arg) {return TRUE;}
};


+30 −30

File changed.

Contains only whitespace changes.

+14 −14

File changed.

Contains only whitespace changes.

+30 −30

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading