Commit 604227e8 authored by unknown's avatar unknown
Browse files

BUG#18198: Less flexibility in defining partition functions

Changed test for functions if they are supported.
3 categories:
1) Fully supported
2) Supported for single character collations
3) Supported for binary collations


mysql-test/r/partition.result:
  Changed test case since no longer supported to use multicharacter collations
  in comparisons
mysql-test/t/partition.test:
  Changed test case since no longer supported to use multicharacter collations
  in comparisons
sql/item.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/item_cmpfunc.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/item_func.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/item_strfunc.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/item_timefunc.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/item_xmlfunc.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/partition_info.cc:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/partition_info.h:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/sql_partition.cc:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
sql/sql_table.cc:
  Changed test for functions if they are supported.
  3 categories:
  1) Fully supported
  2) Supported for single character collations
  3) Supported for binary collations
parent 3856cdb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -742,7 +742,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' PARTITION BY KEY (a) 
drop table t2;
create table t1 (s1 char(2) character set utf8)
partition by list (case when s1 > 'cz' then 1 else 2 end)
partition by list (cast(s1 as signed))
(partition p1 values in (1),
partition p2 values in (2));
drop table t1;
+1 −1
Original line number Diff line number Diff line
@@ -867,7 +867,7 @@ drop table t2;
# Bug#14367: Partitions: crash if utf8 column
#
create table t1 (s1 char(2) character set utf8)
partition by list (case when s1 > 'cz' then 1 else 2 end)
partition by list (cast(s1 as signed))
(partition p1 values in (1),
 partition p2 values in (2));
drop table t1;
+43 −21
Original line number Diff line number Diff line
@@ -789,7 +789,7 @@ class Item {
    Check if a partition function is allowed
    SYNOPSIS
      check_partition_func_processor()
      bool_arg                        Return argument
      int_arg                        Return argument
    RETURN VALUE
      0
    DESCRIPTION
@@ -806,8 +806,28 @@ class Item {
    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)
  { *(bool *)bool_arg= FALSE; return 0; }

#define PF_SAFE_BINARY_COLLATION 3
#define PF_SAFE_SINGLE_CHAR_COLLATION 2
#define PF_SAFE 1
#define PF_UNSAFE 0
  bool safe_for_binary_collation(byte *int_arg)
  {
    if (*(int *)int_arg != PF_UNSAFE)
      *(int*)int_arg= PF_SAFE_BINARY_COLLATION;
    return 0;
  }
  bool safe_for_single_char_collation(byte *int_arg)
  {
    if (*(int*)int_arg == PF_SAFE)
      *(int*)int_arg= PF_SAFE_SINGLE_CHAR_COLLATION;
    return 0;
  }
  virtual bool check_partition_func_processor(byte *int_arg)
  {
    *(int *)int_arg= PF_UNSAFE;
    return 0;
  }

  virtual Item *equal_fields_propagator(byte * arg) { return this; }
  virtual Item *set_no_const_sub(byte *arg) { return this; }
@@ -1106,7 +1126,8 @@ class Item_name_const : public Item
    Item::maybe_null= TRUE;
  }

  bool check_partition_func_processor(byte *bool_arg) { return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
  bool fix_fields(THD *, Item **);

  enum Type type() const;
@@ -1153,7 +1174,7 @@ class Item_num: public Item
  Item_num() {}                               /* Remove gcc warning */
  virtual Item_num *neg()= 0;
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

#define NO_CACHED_FIELD_INDEX ((uint)(-1))
@@ -1289,7 +1310,7 @@ class Item_field :public Item_ident
  bool collect_item_field_processor(byte * arg);
  bool find_item_in_field_list_processor(byte *arg);
  bool register_field_in_read_map(byte *arg);
  bool check_partition_func_processor(byte *bool_arg) { return 0; }
  bool check_partition_func_processor(byte *int_arg) { return 0; }
  void cleanup();
  bool result_as_longlong()
  {
@@ -1337,7 +1358,7 @@ class Item_null :public Item
  bool is_null() { return 1; }
  void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
  Item *safe_charset_converter(CHARSET_INFO *tocs);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_null_result :public Item_null
@@ -1350,8 +1371,8 @@ class Item_null_result :public Item_null
  {
    save_in_field(result_field, no_conversions);
  }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};  

/* Item represents one placeholder ('?') of prepared statement */
@@ -1642,8 +1663,8 @@ 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 *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};


@@ -1721,7 +1742,7 @@ class Item_string :public Item
  void print(String *str);
  // to prevent drop fixed flag (no need parent cleanup call)
  void cleanup() {}
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -1736,8 +1757,8 @@ 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 *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};


@@ -1750,8 +1771,8 @@ 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 *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};

class Item_empty_string :public Item_string
@@ -1774,8 +1795,8 @@ 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 *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};


@@ -1799,7 +1820,8 @@ class Item_hex_string: public Item
  void cleanup() {}
  bool eq(const Item *item, bool binary_cmp) const;
  virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_binary_collation(int_arg);}
};


@@ -2026,8 +2048,8 @@ class Item_int_with_ref :public Item_int
  }
  Item *new_item();
  virtual Item *real_item() { return ref; }
  bool check_partition_func_processor(byte *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};

#ifdef MYSQL_SERVER
+24 −15
Original line number Diff line number Diff line
@@ -240,7 +240,8 @@ class Item_bool_rowready_func2 :public Item_bool_func2
  }
  Item *neg_transformer(THD *thd);
  virtual Item *negated_item();
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};

class Item_func_not :public Item_bool_func
@@ -251,7 +252,8 @@ class Item_func_not :public Item_bool_func
  enum Functype functype() const { return NOT_FUNC; }
  const char *func_name() const { return "not"; }
  Item *neg_transformer(THD *thd);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};

class Item_maxmin_subselect;
@@ -466,7 +468,8 @@ class Item_func_between :public Item_func_opt_neg
  bool is_bool_func() { return 1; }
  CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
  uint decimal_precision() const { return 1; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};


@@ -478,7 +481,8 @@ class Item_func_strcmp :public Item_bool_func2
  optimize_type select_optimize() const { return OPTIMIZE_NONE; }
  const char *func_name() const { return "strcmp"; }
  void print(String *str) { Item_func::print(str); }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};


@@ -541,7 +545,7 @@ class Item_func_ifnull :public Item_func_coalesce
  const char *func_name() const { return "ifnull"; }
  Field *tmp_table_field(TABLE *table);
  uint decimal_precision() const;
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -582,7 +586,7 @@ class Item_func_nullif :public Item_bool_func2
  void print(String *str) { Item_func::print(str); }
  table_map not_null_tables() const { return 0; }
  bool is_null();
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -625,7 +629,8 @@ class Item_func_case :public Item_func
  void print(String *str);
  Item *find_item(String *str);
  CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};


@@ -976,7 +981,8 @@ class Item_func_in :public Item_func_opt_neg
  bool nulls_in_row();
  bool is_bool_func() { return 1; }
  CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};

/* Functions used by where clause */
@@ -1018,7 +1024,7 @@ class Item_func_isnull :public Item_bool_func
  optimize_type select_optimize() const { return OPTIMIZE_NULL; }
  Item *neg_transformer(THD *thd);
  CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

/* Functions used by HAVING for rewriting IN subquery */
@@ -1040,8 +1046,8 @@ 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 *bool_arg)
  { *(bool *)bool_arg= FALSE; return 0; }
  bool check_partition_func_processor(byte *int_arg)
  { *(int *)int_arg= PF_UNSAFE; return 0; }
};


@@ -1064,7 +1070,7 @@ class Item_func_isnotnull :public Item_bool_func
  void print(String *str);
  CHARSET_INFO *compare_collation() { return args[0]->collation.collation; }
  void top_level_item() { abort_on_null=1; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -1103,7 +1109,8 @@ class Item_func_like :public Item_bool_func2
  const char *func_name() const { return "like"; }
  bool fix_fields(THD *thd, Item **ref);
  void cleanup();
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};

#ifdef USE_REGEX
@@ -1126,7 +1133,8 @@ class Item_func_regex :public Item_bool_func
  const char *func_name() const { return "regexp"; }
  void print(String *str) { print_op(str); }
  CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};

#else
@@ -1183,7 +1191,8 @@ class Item_cond :public Item_bool_func
  Item *transform(Item_transformer transformer, byte *arg);
  void traverse_cond(Cond_traverser, void *arg, traverse_order order);
  void neg_arguments(THD *thd);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg); }
};


+36 −31
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ class Item_func_num1: public Item_func_numhybrid
  void fix_num_length_and_dec();
  void find_num_type();
  String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -260,7 +260,7 @@ class Item_num_op :public Item_func_numhybrid
  void print(String *str) { print_op(str); }
  void find_num_type();
  String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -311,7 +311,7 @@ class Item_func_signed :public Item_int_func
  { max_length=args[0]->max_length; unsigned_flag=0; }
  void print(String *str);
  uint decimal_precision() const { return args[0]->decimal_precision(); }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -345,7 +345,7 @@ class Item_decimal_typecast :public Item_func
  void fix_length_and_dec() {};
  const char *func_name() const { return "decimal_typecast"; }
  void print(String *);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -414,7 +414,7 @@ class Item_func_int_div :public Item_int_func
  const char *func_name() const { return "DIV"; }
  void fix_length_and_dec();
  void print(String *str) { print_op(str); }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -487,7 +487,7 @@ class Item_func_exp :public Item_dec_func
  Item_func_exp(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "exp"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -497,7 +497,7 @@ class Item_func_ln :public Item_dec_func
  Item_func_ln(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "ln"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -508,7 +508,7 @@ class Item_func_log :public Item_dec_func
  Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
  double val_real();
  const char *func_name() const { return "log"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -518,7 +518,7 @@ class Item_func_log2 :public Item_dec_func
  Item_func_log2(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "log2"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -528,7 +528,7 @@ class Item_func_log10 :public Item_dec_func
  Item_func_log10(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "log10"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -538,7 +538,7 @@ class Item_func_sqrt :public Item_dec_func
  Item_func_sqrt(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "sqrt"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -548,7 +548,7 @@ class Item_func_pow :public Item_dec_func
  Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
  double val_real();
  const char *func_name() const { return "pow"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -558,7 +558,7 @@ class Item_func_acos :public Item_dec_func
  Item_func_acos(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "acos"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_asin :public Item_dec_func
@@ -567,7 +567,7 @@ class Item_func_asin :public Item_dec_func
  Item_func_asin(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "asin"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_atan :public Item_dec_func
@@ -577,7 +577,7 @@ class Item_func_atan :public Item_dec_func
  Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
  double val_real();
  const char *func_name() const { return "atan"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_cos :public Item_dec_func
@@ -586,7 +586,7 @@ class Item_func_cos :public Item_dec_func
  Item_func_cos(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "cos"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_sin :public Item_dec_func
@@ -595,7 +595,7 @@ class Item_func_sin :public Item_dec_func
  Item_func_sin(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "sin"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_tan :public Item_dec_func
@@ -604,7 +604,7 @@ class Item_func_tan :public Item_dec_func
  Item_func_tan(Item *a) :Item_dec_func(a) {}
  double val_real();
  const char *func_name() const { return "tan"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_integer :public Item_int_func
@@ -681,7 +681,7 @@ class Item_func_sign :public Item_int_func
  Item_func_sign(Item *a) :Item_int_func(a) {}
  const char *func_name() const { return "sign"; }
  longlong val_int();
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -696,7 +696,7 @@ class Item_func_units :public Item_real_func
  const char *func_name() const { return name; }
  void fix_length_and_dec()
  { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


@@ -714,7 +714,7 @@ class Item_func_min_max :public Item_func
  my_decimal *val_decimal(my_decimal *);
  void fix_length_and_dec();
  enum Item_result result_type () const { return cmp_type; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_min :public Item_func_min_max
@@ -740,7 +740,8 @@ class Item_func_length :public Item_int_func
  longlong val_int();
  const char *func_name() const { return "length"; }
  void fix_length_and_dec() { max_length=10; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};

class Item_func_bit_length :public Item_func_length
@@ -760,7 +761,8 @@ class Item_func_char_length :public Item_int_func
  longlong val_int();
  const char *func_name() const { return "char_length"; }
  void fix_length_and_dec() { max_length=10; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};

class Item_func_coercibility :public Item_int_func
@@ -771,7 +773,6 @@ class Item_func_coercibility :public Item_int_func
  const char *func_name() const { return "coercibility"; }
  void fix_length_and_dec() { max_length=10; maybe_null= 0; }
  table_map not_null_tables() const { return 0; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
};

class Item_func_locate :public Item_int_func
@@ -785,7 +786,8 @@ class Item_func_locate :public Item_int_func
  longlong val_int();
  void fix_length_and_dec();
  void print(String *str);
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};


@@ -810,7 +812,8 @@ class Item_func_ascii :public Item_int_func
  longlong val_int();
  const char *func_name() const { return "ascii"; }
  void fix_length_and_dec() { max_length=3; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};

class Item_func_ord :public Item_int_func
@@ -820,7 +823,8 @@ class Item_func_ord :public Item_int_func
  Item_func_ord(Item *a) :Item_int_func(a) {}
  longlong val_int();
  const char *func_name() const { return "ord"; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};

class Item_func_find_in_set :public Item_int_func
@@ -834,7 +838,8 @@ class Item_func_find_in_set :public Item_int_func
  longlong val_int();
  const char *func_name() const { return "find_in_set"; }
  void fix_length_and_dec();
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg)
  { return safe_for_single_char_collation(int_arg);}
};

/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
@@ -846,7 +851,7 @@ class Item_func_bit: public Item_int_func
  Item_func_bit(Item *a) :Item_int_func(a) {}
  void fix_length_and_dec() { unsigned_flag= 1; }
  void print(String *str) { print_op(str); }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_bit_or :public Item_func_bit
@@ -872,7 +877,7 @@ class Item_func_bit_count :public Item_int_func
  longlong val_int();
  const char *func_name() const { return "bit_count"; }
  void fix_length_and_dec() { max_length=2; }
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};

class Item_func_shift_left :public Item_func_bit
@@ -1309,7 +1314,7 @@ class Item_func_inet_aton : public Item_int_func
   longlong val_int();
   const char *func_name() const { return "inet_aton"; }
   void fix_length_and_dec() { decimals = 0; max_length = 21; maybe_null=1;}
  bool check_partition_func_processor(byte *bool_arg) { return 0;}
  bool check_partition_func_processor(byte *int_arg) { return 0;}
};


Loading