1 #ifndef ITEM_CMPFUNC_INCLUDED 
    2 #define ITEM_CMPFUNC_INCLUDED 
   22 #include "thr_malloc.h"                          
   23 #include "item_func.h"              
   26 extern Item_result item_cmp_type(Item_result a,Item_result b);
 
   43   enum_field_types a_type, b_type; 
 
   44   Item *a_cache, *b_cache;         
 
   48   longlong (*get_value_a_func)(THD *thd, 
Item ***item_arg, 
Item **cache_arg,
 
   49                                Item *warn_item, 
bool *is_null);
 
   50   longlong (*get_value_b_func)(THD *thd, 
Item ***item_arg, 
Item **cache_arg,
 
   51                                Item *warn_item, 
bool *is_null);
 
   52   bool try_year_cmp_func(Item_result 
type);
 
   53   static bool get_date_from_const(
Item *date_arg, 
Item *str_arg,
 
   60   Arg_comparator(): comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE),
 
   61     get_value_a_func(0), get_value_b_func(0) {};
 
   63     a_cache(0), b_cache(0), set_null(TRUE),
 
   64     get_value_a_func(0), get_value_b_func(0) {};
 
   69     return set_compare_func(owner_arg, item_cmp_type((*a)->result_type(),
 
   70                                                      (*b)->result_type()));
 
   77                           Item **a1, 
Item **a2, 
bool set_null_arg)
 
   79     set_null= set_null_arg;
 
   80     return set_cmp_func(owner_arg, a1, a2,
 
   81                         item_cmp_type((*a1)->result_type(),
 
   82                                       (*a2)->result_type()));
 
   84   inline int compare() { 
return (this->*func)(); }
 
   89   int compare_decimal();         
 
   90   int compare_int_signed();      
 
   98   int compare_e_binary_string(); 
 
  100   int compare_e_decimal();       
 
  104   int compare_real_fixed();
 
  105   int compare_e_real_fixed();
 
  106   int compare_datetime();        
 
  108   static bool can_compare_as_dates(
Item *a, 
Item *b, ulonglong *const_val_arg);
 
  113   static arg_cmp_func comparator_matrix [5][2];
 
  114   inline bool is_owner_equal_func()
 
  116     return (owner->type() == Item::FUNC_ITEM &&
 
  117            ((
Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
 
  121     delete [] comparators;
 
  127   inline void set_cmp_context_for_datetime()
 
  129     DBUG_ASSERT(func == &Arg_comparator::compare_datetime);
 
  130     if ((*a)->is_temporal())
 
  131       (*a)->cmp_context= INT_RESULT;
 
  132     if ((*b)->is_temporal())
 
  133       (*b)->cmp_context= INT_RESULT;
 
  143     m_created_by_in2exists(
false)  {}
 
  145     m_created_by_in2exists(
false)  {}
 
  147     m_created_by_in2exists(item->m_created_by_in2exists) {}
 
  148   bool is_bool_func() { 
return 1; }
 
  149   void fix_length_and_dec() { decimals=0; max_length=1; }
 
  150   uint decimal_precision()
 const { 
return 1; }
 
  152   void set_created_by_in2exists() { m_created_by_in2exists= 
true; }
 
  158   bool m_created_by_in2exists;
 
  171   virtual longlong val_int();
 
  172   virtual void fix_length_and_dec();
 
  173   virtual void print(
String *str, enum_query_type query_type);
 
  191   const bool affirmative;
 
  204   virtual const char* func_name()
 const { 
return "istrue"; }
 
  217   virtual const char* func_name()
 const { 
return "isnottrue"; }
 
  230   virtual const char* func_name()
 const { 
return "isfalse"; }
 
  243   virtual const char* func_name()
 const { 
return "isnotfalse"; }
 
  248 #define UNKNOWN ((my_bool)-1) 
  282   my_bool result_for_null_param;
 
  286     save_cache(0), result_for_null_param(UNKNOWN)
 
  287   { with_subselect= TRUE; }
 
  288   bool fix_fields(THD *, 
Item **);
 
  289   bool fix_left(THD *thd, 
Item **ref);
 
  291                          st_select_lex *removed_select);
 
  295   const char *func_name()
 const { 
return "<in_optimizer>"; }
 
  297   void keep_top_level_cache();
 
  307   virtual const char* symbol(
bool invert) 
const = 0;
 
  308   virtual bool eqne_op() 
const = 0;
 
  309   virtual bool l_op() 
const = 0;
 
  318   virtual const char* symbol(
bool invert)
 const { 
return invert? 
"<>" : 
"="; }
 
  319   virtual bool eqne_op()
 const { 
return 1; }
 
  320   virtual bool l_op()
 const { 
return 0; }
 
  329   virtual const char* symbol(
bool invert)
 const { 
return invert? 
"=" : 
"<>"; }
 
  330   virtual bool eqne_op()
 const { 
return 1; }
 
  331   virtual bool l_op()
 const { 
return 0; }
 
  340   virtual const char* symbol(
bool invert)
 const { 
return invert? 
"<=" : 
">"; }
 
  341   virtual bool eqne_op()
 const { 
return 0; }
 
  342   virtual bool l_op()
 const { 
return 0; }
 
  351   virtual const char* symbol(
bool invert)
 const { 
return invert? 
">=" : 
"<"; }
 
  352   virtual bool eqne_op()
 const { 
return 0; }
 
  353   virtual bool l_op()
 const { 
return 1; }
 
  362   virtual const char* symbol(
bool invert)
 const { 
return invert? 
"<" : 
">="; }
 
  363   virtual bool eqne_op()
 const { 
return 0; }
 
  364   virtual bool l_op()
 const { 
return 0; }
 
  373   virtual const char* symbol(
bool invert)
 const { 
return invert? 
">" : 
"<="; }
 
  374   virtual bool eqne_op()
 const { 
return 0; }
 
  375   virtual bool l_op()
 const { 
return 1; }
 
  381   bool convert_constant_arg(THD *thd, 
Item *field, 
Item **item);
 
  388     :
Item_bool_func(a,b), cmp(tmp_arg, tmp_arg+1), abort_on_null(FALSE) {}
 
  389   void fix_length_and_dec();
 
  392     return cmp.set_cmp_func(
this, tmp_arg, tmp_arg+1, TRUE);
 
  394   optimize_type select_optimize()
 const { 
return OPTIMIZE_OP; }
 
  395   virtual enum Functype rev_functype()
 const { 
return UNKNOWN_FUNC; }
 
  396   bool have_rev_func()
 const { 
return rev_functype() != UNKNOWN_FUNC; }
 
  398   virtual inline void print(
String *str, enum_query_type query_type)
 
  400     Item_func::print_op(str, query_type);
 
  403   bool is_null() { 
return test(args[0]->is_null() || args[1]->is_null()); }
 
  405   { 
return cmp.cmp_collation.collation; }
 
  406   void top_level_item() { abort_on_null= TRUE; }
 
  409     Item_bool_func::cleanup();
 
  423   Item *neg_transformer(THD *thd);
 
  425   bool subst_argument_checker(uchar **arg) { 
return TRUE; }
 
  437   enum Functype functype()
 const { 
return XOR_FUNC; }
 
  438   const char *func_name()
 const { 
return "xor"; }
 
  440   void top_level_item() {}
 
  449   enum Functype functype()
 const { 
return NOT_FUNC; }
 
  450   const char *func_name()
 const { 
return "not"; }
 
  452   virtual void print(
String *str, enum_query_type query_type);
 
  527     : 
Item_bool_func(a), trig_var(f), trig_tab(tab), trig_type(trig_type_arg)
 
  529   longlong val_int() { 
return *trig_var ? args[0]->val_int() : 1; }
 
  530   enum Functype functype()
 const { 
return TRIG_COND_FUNC; };
 
  533   bool const_item()
 const { 
return FALSE; }
 
  534   bool *get_trig_var() { 
return trig_var; }
 
  536   table_map used_tables()
 const { 
return args[0]->used_tables(); }
 
  537   void print(
String *str, enum_query_type query_type);
 
  553     :
Item_func_not(a), test_sum_item(0), test_sub_item(0), subselect(0),
 
  554      abort_on_null(0), show(0)
 
  556   virtual void top_level_item() { abort_on_null= 1; }
 
  557   bool top_level() { 
return abort_on_null; }
 
  559   enum Functype functype()
 const { 
return NOT_ALL_FUNC; }
 
  560   const char *func_name()
 const { 
return "<not>"; }
 
  561   virtual void print(
String *str, enum_query_type query_type);
 
  565   table_map not_null_tables()
 const 
  589   bool empty_underlying_subquery();
 
  600   const char *func_name()
 const { 
return "<nop>"; }
 
  613   enum Functype functype()
 const { 
return EQ_FUNC; }
 
  614   enum Functype rev_functype()
 const { 
return EQ_FUNC; }
 
  615   cond_result eq_cmp_result()
 const { 
return COND_TRUE; }
 
  616   const char *func_name()
 const { 
return "="; }
 
  618   virtual bool equality_substitution_analyzer(uchar **arg) { 
return true; }
 
  628   table_map not_null_tables()
 const { 
return 0; }
 
  629   enum Functype functype()
 const { 
return EQUAL_FUNC; }
 
  630   enum Functype rev_functype()
 const { 
return EQUAL_FUNC; }
 
  631   cond_result eq_cmp_result()
 const { 
return COND_TRUE; }
 
  632   const char *func_name()
 const { 
return "<=>"; }
 
  633   Item *neg_transformer(THD *thd) { 
return 0; }
 
  642   enum Functype functype()
 const { 
return GE_FUNC; }
 
  643   enum Functype rev_functype()
 const { 
return LE_FUNC; }
 
  644   cond_result eq_cmp_result()
 const { 
return COND_TRUE; }
 
  645   const char *func_name()
 const { 
return ">="; }
 
  655   enum Functype functype()
 const { 
return GT_FUNC; }
 
  656   enum Functype rev_functype()
 const { 
return LT_FUNC; }
 
  657   cond_result eq_cmp_result()
 const { 
return COND_FALSE; }
 
  658   const char *func_name()
 const { 
return ">"; }
 
  668   enum Functype functype()
 const { 
return LE_FUNC; }
 
  669   enum Functype rev_functype()
 const { 
return GE_FUNC; }
 
  670   cond_result eq_cmp_result()
 const { 
return COND_TRUE; }
 
  671   const char *func_name()
 const { 
return "<="; }
 
  681   enum Functype functype()
 const { 
return LT_FUNC; }
 
  682   enum Functype rev_functype()
 const { 
return GT_FUNC; }
 
  683   cond_result eq_cmp_result()
 const { 
return COND_FALSE; }
 
  684   const char *func_name()
 const { 
return "<"; }
 
  694   enum Functype functype()
 const { 
return NE_FUNC; }
 
  695   cond_result eq_cmp_result()
 const { 
return COND_FALSE; }
 
  696   optimize_type select_optimize()
 const { 
return OPTIMIZE_KEY; } 
 
  697   const char *func_name()
 const { 
return "<>"; }
 
  722   inline void negate() { negated= !negated; }
 
  723   inline void top_level_item() { pred_level= 1; }
 
  724   Item *neg_transformer(THD *thd)
 
  729   bool eq(
const Item *item, 
bool binary_cmp) 
const;
 
  730   bool subst_argument_checker(uchar **arg) { 
return TRUE; }
 
  738   Item_result cmp_type;
 
  739   String value0,value1,value2;
 
  741   bool compare_as_dates_with_strings;
 
  742   bool compare_as_temporal_dates;
 
  743   bool compare_as_temporal_times;
 
  749     compare_as_temporal_dates(FALSE),
 
  750     compare_as_temporal_times(FALSE) {}
 
  752   optimize_type select_optimize()
 const { 
return OPTIMIZE_KEY; }
 
  753   enum Functype functype()
 const   { 
return BETWEEN; }
 
  754   const char *func_name()
 const { 
return "between"; }
 
  756   void fix_length_and_dec();
 
  757   virtual void print(
String *str, enum_query_type query_type);
 
  758   bool is_bool_func() { 
return 1; }
 
  759   const CHARSET_INFO *compare_collation() { 
return cmp_collation.collation; }
 
  760   uint decimal_precision()
 const { 
return 1; }
 
  769   optimize_type select_optimize()
 const { 
return OPTIMIZE_NONE; }
 
  770   const char *func_name()
 const { 
return "strcmp"; }
 
  772   virtual inline void print(
String *str, enum_query_type query_type)
 
  776   void fix_length_and_dec()
 
  778     Item_bool_func2::fix_length_and_dec();
 
  794   my_bool use_decimal_comparison;
 
  803   void fix_length_and_dec();
 
  804   const char *func_name()
 const { 
return "interval"; }
 
  805   uint decimal_precision()
 const { 
return 2; }
 
  812   enum_field_types cached_field_type;
 
  822   void fix_length_and_dec();
 
  823   void find_num_type() {}
 
  824   enum Item_result result_type ()
 const { 
return hybrid_type; }
 
  825   const char *func_name()
 const { 
return "coalesce"; }
 
  826   table_map not_null_tables()
 const { 
return 0; }
 
  827   enum_field_types field_type()
 const { 
return cached_field_type; }
 
  834   bool field_type_defined;
 
  843   void fix_length_and_dec();
 
  844   const char *func_name()
 const { 
return "ifnull"; }
 
  846   uint decimal_precision() 
const;
 
  852   enum Item_result cached_result_type;
 
  853   enum_field_types cached_field_type;
 
  856     :
Item_func(a,b,c), cached_result_type(INT_RESULT)
 
  862   bool get_date(
MYSQL_TIME *ltime, uint fuzzydate);
 
  864   enum Item_result result_type ()
 const { 
return cached_result_type; }
 
  865   enum_field_types field_type()
 const { 
return cached_field_type; }
 
  867   void fix_length_and_dec();
 
  868   uint decimal_precision() 
const;
 
  869   const char *func_name()
 const { 
return "if"; }
 
  871   void cache_type_info(
Item *source);
 
  877   enum Item_result cached_result_type;
 
  886   enum Item_result result_type ()
 const { 
return cached_result_type; }
 
  887   void fix_length_and_dec();
 
  888   uint decimal_precision()
 const { 
return args[0]->decimal_precision(); }
 
  889   const char *func_name()
 const { 
return "nullif"; }
 
  891   virtual inline void print(
String *str, enum_query_type query_type)
 
  896   table_map not_null_tables()
 const { 
return 0; }
 
  916   in_vector(uint elements,uint element_length,qsort2_cmp cmp_func, 
 
  918     :base((
char*) sql_calloc(elements*element_length)),
 
  919      size(element_length), compare(cmp_func), collation(cmp_coll),
 
  920      count(elements), used_count(elements) {}
 
  922   virtual void set(uint pos,
Item *item)=0;
 
  923   virtual uchar *get_value(
Item *item)=0;
 
  926     my_qsort2(base,used_count,size,compare,collation);
 
  928   int find(
Item *item);
 
  938   virtual Item* create_item() { 
return NULL; }
 
  948   virtual void value_to_item(uint pos, 
Item *item) { }
 
  951   bool compare_elems(uint pos1, uint pos2)
 
  953     return test(compare(collation, base + pos1*size, base + pos2*size));
 
  955   virtual Item_result result_type()= 0;
 
  960   char buff[STRING_BUFFER_USUAL_SIZE];
 
  965   void set(uint pos,
Item *item);
 
  966   uchar *get_value(
Item *item);
 
  971   void value_to_item(uint pos, 
Item *item)
 
  977   Item_result result_type() { 
return STRING_RESULT; }
 
  991     longlong unsigned_flag;  
 
  995   void set(uint pos,
Item *item);
 
  996   uchar *get_value(
Item *item);
 
 1006   void value_to_item(uint pos, 
Item *item)
 
 1008     ((
Item_int*) item)->value= ((packed_longlong*) base)[pos].val;
 
 1009     ((
Item_int*) item)->unsigned_flag= (my_bool)
 
 1010       ((packed_longlong*) base)[pos].unsigned_flag;
 
 1012   Item_result result_type() { 
return INT_RESULT; }
 
 1014   friend int cmp_longlong(
void *cmp_arg, packed_longlong *a,packed_longlong *b);
 
 1027   void set(uint pos, 
Item *item);
 
 1028   uchar *get_value(
Item *item);
 
 1041   void set(uint pos, 
Item *item);
 
 1042   uchar *get_value(
Item *item);
 
 1062     :
in_longlong(elements), thd(current_thd), warn_item(warn_item_arg),
 
 1064   void set(uint pos,
Item *item);
 
 1065   uchar *get_value(
Item *item);
 
 1069     return new Item_temporal(MYSQL_TYPE_DATETIME, (longlong) 0);
 
 1079   void set(uint pos,
Item *item);
 
 1080   uchar *get_value(
Item *item);
 
 1085   void value_to_item(uint pos, 
Item *item)
 
 1087     ((
Item_float*)item)->value= ((
double*) base)[pos];
 
 1089   Item_result result_type() { 
return REAL_RESULT; }
 
 1098   void set(uint pos, 
Item *item);
 
 1099   uchar *get_value(
Item *item);
 
 1104   void value_to_item(uint pos, 
Item *item)
 
 1108     item_dec->set_decimal_value(dec);
 
 1110   Item_result result_type() { 
return DECIMAL_RESULT; }
 
 1123   cmp_item() { cmp_charset= &my_charset_bin; }
 
 1125   virtual void store_value(
Item *item)= 0;
 
 1126   virtual int cmp(
Item *item)= 0;
 
 1128   virtual int compare(
cmp_item *item)= 0;
 
 1131   virtual void store_value_by_template(
cmp_item *tmpl, 
Item *item)
 
 1144   void set_charset(
const CHARSET_INFO *cs) { cmp_charset= cs; }
 
 1152   char value_buff[STRING_BUFFER_USUAL_SIZE];
 
 1159     value(value_buff, 
sizeof(value_buff), cs) {}
 
 1160   void store_value(
Item *item)
 
 1162     String *res= item->val_str(&value);
 
 1163     if(res && (res != &value))
 
 1172     char buff[STRING_BUFFER_USUAL_SIZE];
 
 1173     String tmp(buff, 
sizeof(buff), cmp_charset), *res;
 
 1174     res= arg->val_str(&tmp);
 
 1175     return (value_res ? (res ? sortcmp(value_res, res, cmp_charset) : 1) :
 
 1181     return sortcmp(value_res, l_cmp->value_res, cmp_charset);
 
 1187     value.set_quick(value_buff, 
sizeof(value_buff), cs);
 
 1196   void store_value(
Item *item)
 
 1198     value= item->val_int();
 
 1202     return value != arg->val_int();
 
 1207     return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1);
 
 1229     :thd(current_thd), warn_item(warn_item_arg), lval_cache(0) {}
 
 1230   void store_value(
Item *item);
 
 1241   void store_value(
Item *item)
 
 1243     value= item->val_real();
 
 1247     return value != arg->val_real();
 
 1252     return (value < l_cmp->value)? -1 : ((value == l_cmp->value) ? 0 : 1);
 
 1263   void store_value(
Item *item);
 
 1282   void store_value(
Item *item)
 
 1284     value_res= item->val_str(&value);
 
 1295     return sortcmp(value_res, l_cmp->value_res, cmp_charset);
 
 1324   int first_expr_num, else_expr_num;
 
 1325   enum Item_result cached_result_type, left_result_type;
 
 1328   Item_result cmp_type;
 
 1330   enum_field_types cached_field_type;
 
 1335     :
Item_func(), first_expr_num(-1), else_expr_num(-1),
 
 1336     cached_result_type(INT_RESULT), left_result_type(INT_RESULT), case_item(0)
 
 1338     ncases= list.elements;
 
 1341       first_expr_num= list.elements;
 
 1342       list.push_back(first_expr_arg);
 
 1346       else_expr_num= list.elements;
 
 1347       list.push_back(else_expr_arg);
 
 1349     set_arguments(list);
 
 1350     memset(&cmp_items, 0, 
sizeof(cmp_items));
 
 1356   bool get_date(
MYSQL_TIME *ltime, uint fuzzydate);
 
 1358   bool fix_fields(THD *thd, 
Item **ref);
 
 1359   void fix_length_and_dec();
 
 1360   uint decimal_precision() 
const;
 
 1361   table_map not_null_tables()
 const { 
return 0; }
 
 1362   enum Item_result result_type ()
 const { 
return cached_result_type; }
 
 1363   enum_field_types field_type()
 const { 
return cached_field_type; }
 
 1364   const char *func_name()
 const { 
return "case"; }
 
 1365   virtual void print(
String *str, enum_query_type query_type);
 
 1367   const CHARSET_INFO *compare_collation() { 
return cmp_collation.collation; }
 
 1369   void agg_num_lengths(
Item *arg);
 
 1399   bool arg_types_compatible;
 
 1400   Item_result left_result_type;
 
 1406     arg_types_compatible(FALSE)
 
 1408     memset(&cmp_items, 0, 
sizeof(cmp_items));
 
 1409     allowed_arg_cols= 0;  
 
 1413   void fix_length_and_dec();
 
 1414   uint decimal_precision()
 const { 
return 1; }
 
 1418     DBUG_ENTER(
"Item_func_in::cleanup");
 
 1419     Item_int_func::cleanup();
 
 1422     for (i= 0; i <= (uint)DECIMAL_RESULT + 1; i++)
 
 1424       delete cmp_items[
i];
 
 1429   optimize_type select_optimize()
 const 
 1430     { 
return OPTIMIZE_KEY; }
 
 1431   virtual void print(
String *str, enum_query_type query_type);
 
 1432   enum Functype functype()
 const { 
return IN_FUNC; }
 
 1433   const char *func_name()
 const { 
return " IN "; }
 
 1434   bool nulls_in_row();
 
 1435   bool is_bool_func() { 
return 1; }
 
 1436   const CHARSET_INFO *compare_collation() { 
return cmp_collation.collation; }
 
 1446   void store_value(
Item *item);
 
 1447   inline void alloc_comparators();
 
 1452   friend void Item_func_in::fix_length_and_dec();
 
 1462   void set(uint pos,
Item *item);
 
 1463   uchar *get_value(
Item *item);
 
 1464   friend void Item_func_in::fix_length_and_dec();
 
 1465   Item_result result_type() { 
return ROW_RESULT; }
 
 1473   longlong cached_value;
 
 1477   enum Functype functype()
 const { 
return ISNULL_FUNC; }
 
 1478   void fix_length_and_dec()
 
 1480     decimals=0; max_length=1; maybe_null=0;
 
 1481     update_used_tables();
 
 1483   const char *func_name()
 const { 
return "isnull"; }
 
 1485   virtual void update_used_tables()
 
 1487     if (!args[0]->maybe_null)
 
 1491       cached_value= (longlong) 0;
 
 1495       args[0]->update_used_tables();
 
 1497       with_stored_program= args[0]->has_stored_program();
 
 1500            !with_subselect && !with_stored_program))
 
 1503         cached_value= (longlong) args[0]->is_null();
 
 1507   table_map not_null_tables()
 const { 
return 0; }
 
 1508   optimize_type select_optimize()
 const { 
return OPTIMIZE_NULL; }
 
 1511   { 
return args[0]->collation.collation; }
 
 1530   enum Functype functype()
 const { 
return ISNOTNULLTEST_FUNC; }
 
 1532   const char *func_name()
 const { 
return "<is_not_null_test>"; }
 
 1549   enum Functype functype()
 const { 
return ISNOTNULL_FUNC; }
 
 1550   void fix_length_and_dec()
 
 1552     decimals=0; max_length=1; maybe_null=0;
 
 1554   const char *func_name()
 const { 
return "isnotnull"; }
 
 1555   optimize_type select_optimize()
 const { 
return OPTIMIZE_NULL; }
 
 1556   table_map not_null_tables()
 const 
 1559   virtual void print(
String *str, enum_query_type query_type);
 
 1561   { 
return args[0]->collation.collation; }
 
 1562   void top_level_item() { abort_on_null=1; }
 
 1570   const char* pattern;
 
 1577   void turboBM_compute_suffixes(
int* suff);
 
 1578   void turboBM_compute_good_suffix_shifts(
int* suff);
 
 1579   void turboBM_compute_bad_character_shifts();
 
 1580   bool turboBM_matches(
const char* text, 
int text_len) 
const;
 
 1581   enum { alphabet_size = 256 };
 
 1585   bool escape_used_in_parsing;
 
 1591     :
Item_bool_func2(a,b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), 
 
 1592      bmGs(0), bmBc(0), escape_item(escape_arg),
 
 1593      escape_used_in_parsing(escape_used) {}
 
 1595   enum Functype functype()
 const { 
return LIKE_FUNC; }
 
 1597   cond_result eq_cmp_result()
 const { 
return COND_TRUE; }
 
 1598   const char *func_name()
 const { 
return "like"; }
 
 1599   bool fix_fields(THD *thd, 
Item **ref);
 
 1612   bool regex_compiled;
 
 1613   bool regex_is_const;
 
 1617   int regex_lib_flags;
 
 1619   int regcomp(
bool send_error);
 
 1622     regex_compiled(0),regex_is_const(0) {}
 
 1625   bool fix_fields(THD *thd, 
Item **ref);
 
 1626   const char *func_name()
 const { 
return "regexp"; }
 
 1630     print_op(str, query_type);
 
 1633   const CHARSET_INFO *compare_collation() { 
return cmp_collation.collation; }
 
 1656   bool add(
Item *item)
 
 1659     return list.push_back(item);
 
 1661   bool add_at_head(
Item *item)
 
 1664     return list.push_front(item);
 
 1668     DBUG_ASSERT(nlist->elements);
 
 1669     list.prepand(nlist);
 
 1671   bool fix_fields(THD *, 
Item **ref);
 
 1673                          st_select_lex *removed_select);
 
 1675   enum Type type()
 const { 
return COND_ITEM; }
 
 1676   List<Item>* argument_list() { 
return &list; }
 
 1678   void update_used_tables();
 
 1679   virtual void print(
String *str, enum_query_type query_type);
 
 1684   void top_level_item() { abort_on_null=1; }
 
 1685   void copy_andor_arguments(THD *thd, 
Item_cond *item, 
bool real_items= 
false);
 
 1686   bool walk(Item_processor processor, 
bool walk_subquery, uchar *arg);
 
 1688   void traverse_cond(Cond_traverser, 
void *arg, traverse_order order);
 
 1689   void neg_arguments(THD *thd);
 
 1690   enum_field_types field_type()
 const { 
return MYSQL_TYPE_LONGLONG; }
 
 1691   bool subst_argument_checker(uchar **arg) { 
return TRUE; }
 
 1692   Item *
compile(Item_analyzer analyzer, uchar **arg_p,
 
 1693                 Item_transformer transformer, uchar *arg_t);
 
 1695   virtual bool equality_substitution_analyzer(uchar **arg) { 
return true; }
 
 1782   bool compare_as_dates;
 
 1795   inline Item* get_const() { 
return const_item; }
 
 1796   void compare_const(
Item *c);
 
 1811   enum Functype functype()
 const { 
return MULT_EQUAL_FUNC; }
 
 1813   const char *func_name()
 const { 
return "multiple equal"; }
 
 1814   optimize_type select_optimize()
 const { 
return OPTIMIZE_EQUAL; }
 
 1817   void fix_length_and_dec();
 
 1818   bool fix_fields(THD *thd, 
Item **ref);
 
 1819   void update_used_tables();
 
 1820   bool walk(Item_processor processor, 
bool walk_subquery, uchar *arg);
 
 1822   virtual void print(
String *str, enum_query_type query_type);
 
 1824   { 
return fields.head()->collation.collation; }
 
 1826   virtual bool equality_substitution_analyzer(uchar **arg) { 
return true; }
 
 1857   inline void rewind(
void) 
 
 1873   enum Functype functype()
 const { 
return COND_AND_FUNC; }
 
 1875   const char *func_name()
 const { 
return "and"; }
 
 1880       item->copy_andor_arguments(thd, 
this, real_items);
 
 1883   Item *neg_transformer(THD *thd);
 
 1886 inline bool is_cond_and(
Item *item)
 
 1888   if (item->type() != Item::COND_ITEM)
 
 1892   return (cond_item->functype() == Item_func::COND_AND_FUNC);
 
 1902   enum Functype functype()
 const { 
return COND_OR_FUNC; }
 
 1904   const char *func_name()
 const { 
return "or"; }
 
 1909       item->copy_andor_arguments(thd, 
this, real_items);
 
 1912   Item *neg_transformer(THD *thd);
 
 1915 inline bool is_cond_or(
Item *item)
 
 1917   if (item->type() != Item::COND_ITEM)
 
 1921   return (cond_item->functype() == Item_func::COND_OR_FUNC);
 
 1936 longlong get_datetime_value(THD *thd, 
Item ***item_arg, 
Item **cache_arg,
 
 1937                             Item *warn_item, 
bool *is_null);