MySQL  8.0.17
Source Code Documentation
item_cmpfunc.h
Go to the documentation of this file.
1 #ifndef ITEM_CMPFUNC_INCLUDED
2 #define ITEM_CMPFUNC_INCLUDED
3 
4 /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License, version 2.0,
8  as published by the Free Software Foundation.
9 
10  This program is also distributed with certain software (including
11  but not limited to OpenSSL) that is licensed under separate terms,
12  as designated in a particular file or component or in included license
13  documentation. The authors of MySQL hereby grant you an additional
14  permission to link the program and your derivative works with the
15  separately licensed software that they have included with MySQL.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License, version 2.0, for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25 
26 /* compare and test functions */
27 
28 #include <string.h>
29 #include <sys/types.h>
30 
31 #include "field_types.h"
32 #include "json_dom.h" // Json_wrapper
33 //#include "extra/regex/my_regex.h" // my_regex_t
34 #include "m_ctype.h"
35 #include "my_alloc.h"
36 #include "my_compiler.h"
37 #include "my_dbug.h"
38 #include "my_inttypes.h"
39 #include "my_sys.h"
40 #include "my_table_map.h"
41 #include "my_time.h"
43 #include "mysql_time.h"
44 #include "sql/enum_query_type.h"
45 #include "sql/item.h"
46 #include "sql/item_func.h" // Item_int_func
47 #include "sql/item_row.h" // Item_row
48 #include "sql/mem_root_array.h" // Mem_root_array
49 #include "sql/my_decimal.h"
51 #include "sql/psi_memory_key.h" // key_memory_JSON
52 #include "sql/sql_const.h"
53 #include "sql/sql_list.h"
54 #include "sql/table.h"
55 #include "sql_string.h"
56 #include "template_utils.h" // down_cast
57 
58 class Arg_comparator;
59 class Field;
60 class Item_in_subselect;
61 class Item_subselect;
62 class Item_sum_hybrid;
63 class Json_scalar_holder;
64 class Json_wrapper;
65 class PT_item_list;
66 class SELECT_LEX;
67 class THD;
68 struct MY_BITMAP;
69 
71 
72 typedef int (Arg_comparator::*arg_cmp_func)();
73 
75  Item **a, **b;
78  Arg_comparator *comparators; // used only for compare_row()
80  double precision;
81  /* Fields used in DATE/DATETIME comparison. */
82  Item *a_cache, *b_cache; // Cached values of a and b items
83  bool set_null; // true <=> set owner->null_value
84  // when one of arguments is NULL.
85  longlong (*get_value_a_func)(THD *thd, Item ***item_arg, Item **cache_arg,
86  const Item *warn_item, bool *is_null);
87  longlong (*get_value_b_func)(THD *thd, Item ***item_arg, Item **cache_arg,
88  const Item *warn_item, bool *is_null);
90  static bool get_date_from_const(Item *date_arg, Item *str_arg,
91  ulonglong *const_value);
92  /**
93  Only used by compare_json() in the case where a JSON value is
94  compared to an SQL value. This member points to pre-allocated
95  memory that can be used instead of the heap when converting the
96  SQL value to a JSON value.
97  */
99 
100  /**
101  When comparing strings, compare at most these many bytes.
102  A value of zero means "no limit".
103  */
104  size_t m_max_str_length{0};
105 
106  public:
108  /* Allow owner function to use string buffers. */
110 
112  : comparators(0),
113  comparator_count(0),
114  a_cache(0),
115  b_cache(0),
116  set_null(true),
117  get_value_a_func(0),
118  get_value_b_func(0),
119  json_scalar(0) {}
121  : a(a1),
122  b(a2),
123  comparators(0),
124  comparator_count(0),
125  a_cache(0),
126  b_cache(0),
127  set_null(true),
128  get_value_a_func(0),
129  get_value_b_func(0),
130  json_scalar(0) {}
131 
133  bool set_cmp_func(Item_result_field *owner_arg, Item **a1, Item **a2,
134  Item_result type);
135 
136  bool set_cmp_func(Item_result_field *owner_arg, Item **a1, Item **a2,
137  bool set_null_arg);
138 
139  /**
140  When comparing strings, compare at most max_length bytes.
141  @param max_length how much to compare
142  */
143  void set_max_str_length(size_t max_length) { m_max_str_length = max_length; }
144  inline int compare() { return (this->*func)(); }
145 
146  int compare_string(); // compare args[0] & args[1]
147  int compare_binary_string(); // compare args[0] & args[1]
148  int compare_real(); // compare args[0] & args[1]
149  int compare_decimal(); // compare args[0] & args[1]
150  int compare_int_signed(); // compare args[0] & args[1]
153  int compare_int_unsigned();
154  int compare_time_packed();
155  int compare_row(); // compare args[0] & args[1]
156  int compare_real_fixed();
157  int compare_datetime(); // compare args[0] & args[1] as DATETIMEs
158  int compare_json();
159  bool compare_null_values();
160 
161  static bool can_compare_as_dates(Item *a, Item *b);
162 
163  Item **cache_converted_constant(THD *thd, Item **value, Item **cache,
164  Item_result type);
165  void set_datetime_cmp_func(Item_result_field *owner_arg, Item **a1,
166  Item **b1);
168  void cleanup();
169  /*
170  Set correct cmp_context if items would be compared as INTs.
171  */
174  if ((*a)->is_temporal()) (*a)->cmp_context = INT_RESULT;
175  if ((*b)->is_temporal()) (*b)->cmp_context = INT_RESULT;
176  }
177 };
178 
180  public:
182  explicit Item_bool_func(const POS &pos)
184 
188 
191  Item_bool_func(const POS &pos, Item *a, Item *b)
193 
195  : Item_int_func(thd, item),
197  bool is_bool_func() const override { return true; }
198  bool resolve_type(THD *) override {
199  max_length = 1;
200  return false;
201  }
202  uint decimal_precision() const override { return 1; }
203  bool created_by_in2exists() const override { return m_created_by_in2exists; }
205 
206  static const char *bool_transform_names[10];
207  /**
208  Array that transforms a boolean test according to another.
209  First dimension is existing value, second dimension is test to apply
210  */
211  static const Bool_test bool_transform[10][8];
212 
213  private:
214  /**
215  True <=> this item was added by IN->EXISTS subquery transformation, and
216  should thus be deleted if we switch to materialization.
217  */
219 };
220 
221 /**
222  A predicate that is "always true" or "always false". To be used as a
223  standalone condition or as part of conditions, together with other condition
224  and predicate objects.
225  Mostly used when generating conditions internally.
226 */
228  public:
230  max_length = 1;
231  used_tables_cache = 0;
233  fixed = true;
234  }
236  max_length = 1;
237  used_tables_cache = 0;
239  fixed = true;
240  }
241  bool fix_fields(THD *, Item **) override { return false; }
242  bool basic_const_item() const override { return true; }
243  void cleanup() override {}
244 };
245 
246 /// A predicate that is "always true".
247 
249  public:
252  const char *func_name() const override { return "true"; }
253  bool val_bool() override { return true; }
254  longlong val_int() override { return 1; }
255  void print(const THD *, String *str, enum_query_type) const override {
256  str->append("true");
257  }
258 };
259 
260 /// A predicate that is "always false".
261 
263  public:
266  const char *func_name() const override { return "false"; }
267  bool val_bool() override { return false; }
268  longlong val_int() override { return 0; }
269  void print(const THD *, String *str, enum_query_type) const override {
270  str->append("false");
271  }
272 };
273 
274 /**
275  Item class, to represent <code>X IS [NOT] (TRUE | FALSE)</code>
276  boolean predicates.
277 */
280 
281  public:
282  longlong val_int() override;
283  bool resolve_type(THD *) override;
284  void print(const THD *thd, String *str,
285  enum_query_type query_type) const override;
286  Item *truth_transformer(THD *, Bool_test test) override {
288  return this;
289  }
290  const char *func_name() const override {
292  }
293  virtual enum Functype functype() const override { return ISTRUTH_FUNC; }
294 
296  : super(pos, a), truth_test(truth_test) {
297  null_on_null = false;
298  switch (truth_test) {
299  case BOOL_IS_TRUE:
300  case BOOL_IS_FALSE:
301  case BOOL_NOT_TRUE:
302  case BOOL_NOT_FALSE:
303  break;
304  default:
305  DBUG_ASSERT(false);
306  }
307  }
309  : super(a), truth_test(truth_test) {
310  null_on_null = false;
311  switch (truth_test) {
312  case BOOL_IS_TRUE:
313  case BOOL_IS_FALSE:
314  case BOOL_NOT_TRUE:
315  case BOOL_NOT_FALSE:
316  break;
317  default:
318  DBUG_ASSERT(false);
319  }
320  }
321  void apply_is_true() override {
322  /*
323  This item cannot produce NULL result. But, if the upper item confuses
324  NULL and FALSE, we can do as if NULL input caused a NULL result when it
325  actually causes a FALSE result.
326  */
327  switch (truth_test) {
328  case BOOL_IS_TRUE:
329  case BOOL_IS_FALSE:
330  null_on_null = true;
331  default:
332  break;
333  }
334  }
335 
336  protected:
337  Bool_test truth_test; ///< The value we're testing for.
338 };
339 
340 static const int UNKNOWN = -1;
341 
342 /*
343  Item_in_optimizer(left_expr, Item_in_subselect(...))
344 
345  Item_in_optimizer is used to wrap an instance of Item_in_subselect. This
346  class does the following:
347  - Evaluate the left expression and store it in Item_cache_* object (to
348  avoid re-evaluating it many times during subquery execution)
349  - Shortcut the evaluation of "NULL IN (...)" to NULL in the cases where we
350  don't care if the result is NULL or FALSE.
351 
352  args[1] keeps a reference to the Item_in_subselect object.
353 
354  args[0] is a copy of Item_in_subselect's left expression and should be
355  kept equal also after resolving.
356 
357  NOTE
358  It is not quite clear why the above listed functionality should be
359  placed into a separate class called 'Item_in_optimizer'.
360 */
361 
363  private:
366  /*
367  Stores the value of "NULL IN (SELECT ...)" for uncorrelated subqueries:
368  UNKNOWN - "NULL in (SELECT ...)" has not yet been evaluated
369  FALSE - result is FALSE
370  TRUE - result is NULL
371  */
373 
374  public:
376  : Item_bool_func(a, reinterpret_cast<Item *>(b)),
377  cache(0),
378  save_cache(0),
380  set_subquery();
381  }
382  bool fix_fields(THD *, Item **) override;
383  bool fix_left(THD *thd, Item **ref);
384  void fix_after_pullout(SELECT_LEX *parent_select,
385  SELECT_LEX *removed_select) override;
386  bool is_null() override;
387  longlong val_int() override;
388  void cleanup() override;
389  const char *func_name() const override { return "<in_optimizer>"; }
390  Item_cache **get_cache() { return &cache; }
391  void keep_top_level_cache();
392  Item *transform(Item_transformer transformer, uchar *arg) override;
393  void replace_argument(THD *thd, Item **oldpp, Item *newp) override;
394 };
395 
396 /// Abstract factory interface for creating comparison predicates.
398  public:
399  virtual ~Comp_creator() {}
400  virtual Item_bool_func *create(Item *a, Item *b) const = 0;
401 
402  /// This interface is only used by Item_allany_subselect.
403  virtual const char *symbol(bool invert) const = 0;
404  virtual bool eqne_op() const = 0;
405  virtual bool l_op() const = 0;
406 };
407 
408 /// Abstract base class for the comparison operators =, <> and <=>.
410  public:
411  virtual Item_bool_func *create(Item *a, Item *b) const;
412  virtual bool eqne_op() const { return true; }
413  virtual bool l_op() const { return false; }
414 
415  protected:
416  /**
417  Creates only an item tree node, without attempting to rewrite row
418  constructors.
419  @see create()
420  */
421  virtual Item_bool_func *create_scalar_predicate(Item *a, Item *b) const = 0;
422 
423  /// Combines a list of conditions <code>exp op exp</code>.
424  virtual Item_bool_func *combine(List<Item> list) const = 0;
425 };
426 
428  public:
429  virtual const char *symbol(bool invert) const { return invert ? "<>" : "="; }
430 
431  protected:
432  virtual Item_bool_func *create_scalar_predicate(Item *a, Item *b) const;
433  virtual Item_bool_func *combine(List<Item> list) const;
434 };
435 
437  public:
438  virtual const char *symbol(bool invert MY_ATTRIBUTE((unused))) const {
439  // This will never be called with true.
440  DBUG_ASSERT(!invert);
441  return "<=>";
442  }
443 
444  protected:
445  virtual Item_bool_func *create_scalar_predicate(Item *a, Item *b) const;
446  virtual Item_bool_func *combine(List<Item> list) const;
447 };
448 
450  public:
451  virtual const char *symbol(bool invert) const { return invert ? "=" : "<>"; }
452 
453  protected:
454  virtual Item_bool_func *create_scalar_predicate(Item *a, Item *b) const;
455  virtual Item_bool_func *combine(List<Item> list) const;
456 };
457 
458 class Gt_creator : public Comp_creator {
459  public:
460  Gt_creator() {} /* Remove gcc warning */
461  virtual ~Gt_creator() {} /* Remove gcc warning */
462  virtual Item_bool_func *create(Item *a, Item *b) const;
463  virtual const char *symbol(bool invert) const { return invert ? "<=" : ">"; }
464  virtual bool eqne_op() const { return 0; }
465  virtual bool l_op() const { return 0; }
466 };
467 
468 class Lt_creator : public Comp_creator {
469  public:
470  Lt_creator() {} /* Remove gcc warning */
471  virtual ~Lt_creator() {} /* Remove gcc warning */
472  virtual Item_bool_func *create(Item *a, Item *b) const;
473  virtual const char *symbol(bool invert) const { return invert ? ">=" : "<"; }
474  virtual bool eqne_op() const { return 0; }
475  virtual bool l_op() const { return 1; }
476 };
477 
478 class Ge_creator : public Comp_creator {
479  public:
480  Ge_creator() {} /* Remove gcc warning */
481  virtual ~Ge_creator() {} /* Remove gcc warning */
482  virtual Item_bool_func *create(Item *a, Item *b) const;
483  virtual const char *symbol(bool invert) const { return invert ? "<" : ">="; }
484  virtual bool eqne_op() const { return 0; }
485  virtual bool l_op() const { return 0; }
486 };
487 
488 class Le_creator : public Comp_creator {
489  public:
490  Le_creator() {} /* Remove gcc warning */
491  virtual ~Le_creator() {} /* Remove gcc warning */
492  virtual Item_bool_func *create(Item *a, Item *b) const;
493  virtual const char *symbol(bool invert) const { return invert ? ">" : "<="; }
494  virtual bool eqne_op() const { return 0; }
495  virtual bool l_op() const { return 1; }
496 };
497 
498 class Item_bool_func2 : public Item_bool_func { /* Bool with 2 string args */
499  private:
500  bool convert_constant_arg(THD *thd, Item *field, Item **item,
501  bool *converted);
502 
503  protected:
506 
507  public:
510 
511  Item_bool_func2(const POS &pos, Item *a, Item *b)
512  : Item_bool_func(pos, a, b),
513  cmp(tmp_arg, tmp_arg + 1),
514  abort_on_null(false) {}
515 
516  bool resolve_type(THD *) override;
517  bool set_cmp_func() {
518  return cmp.set_cmp_func(this, tmp_arg, tmp_arg + 1, true);
519  }
520  /**
521  When comparing strings, compare at most max_str_length bytes.
522  @param max_str_length how much to compare
523  */
524  void set_max_str_length(size_t max_str_length) {
525  return cmp.set_max_str_length(max_str_length);
526  }
527  optimize_type select_optimize(const THD *) override { return OPTIMIZE_OP; }
528  virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
529  bool have_rev_func() const override { return rev_functype() != UNKNOWN_FUNC; }
530 
531  void print(const THD *thd, String *str,
532  enum_query_type query_type) const override {
533  Item_func::print_op(thd, str, query_type);
534  }
535 
536  bool is_null() override { return args[0]->is_null() || args[1]->is_null(); }
537  const CHARSET_INFO *compare_collation() const override {
538  return cmp.cmp_collation.collation;
539  }
540  void apply_is_true() override { abort_on_null = true; }
541  /// Treat UNKNOWN result like FALSE because callers see no difference
542  bool ignore_unknown() const { return abort_on_null; }
543  void cleanup() override {
545  cmp.cleanup();
546  }
547  friend class Arg_comparator;
548 };
549 
550 /**
551  Item_func_comparison is a class for comparison functions that take two
552  arguments and return a boolean result.
553  It is a common class for the regular comparison operators (=, <>, <, <=,
554  >, >=) as well as the special <=> equality operator.
555 */
557  public:
559  allowed_arg_cols = 0; // Fetch this value from first argument
560  }
562  : Item_bool_func2(pos, a, b) {
563  allowed_arg_cols = 0; // Fetch this value from first argument
564  }
565 
566  Item *truth_transformer(THD *, Bool_test) override;
567  virtual Item *negated_item();
568  bool subst_argument_checker(uchar **) override { return true; }
569  bool is_null() override;
570 };
571 
572 /**
573  XOR inherits from Item_bool_func2 because it is not optimized yet.
574  Later, when XOR is optimized, it needs to inherit from
575  Item_cond instead. See WL#5800.
576 */
579 
580  public:
581  Item_func_xor(Item *i1, Item *i2) : Item_bool_func2(i1, i2) {}
582  Item_func_xor(const POS &pos, Item *i1, Item *i2)
583  : Item_bool_func2(pos, i1, i2) {}
584 
585  enum Functype functype() const override { return XOR_FUNC; }
586  const char *func_name() const override { return "xor"; }
587  bool itemize(Parse_context *pc, Item **res) override;
588  longlong val_int() override;
589  void apply_is_true() override {}
590  Item *truth_transformer(THD *, Bool_test) override;
591 
592  float get_filtering_effect(THD *thd, table_map filter_for_table,
593  table_map read_tables,
594  const MY_BITMAP *fields_to_ignore,
595  double rows_in_table) override;
596 };
597 
599  public:
602 
603  longlong val_int() override;
604  enum Functype functype() const override { return NOT_FUNC; }
605  const char *func_name() const override { return "not"; }
606  Item *truth_transformer(THD *, Bool_test) override;
607  void print(const THD *thd, String *str,
608  enum_query_type query_type) const override;
609 
610  float get_filtering_effect(THD *thd, table_map filter_for_table,
611  table_map read_tables,
612  const MY_BITMAP *fields_to_ignore,
613  double rows_in_table) override;
614 };
615 
616 /**
617  Wrapper class when MATCH function is used in WHERE clause.
618  The MATCH clause can be used as a function returning a floating point value
619  in the SELECT list or in the WHERE clause. However, it may also be used as
620  a boolean function in the WHERE clause, where it has different semantics than
621  when used together with a comparison operator. With a comparison operator,
622  the match operation is performed with ranking. To preserve this behavior,
623  the Item_func_match object is wrapped inside an object of class
624  Item_func_match_predicate, which effectively transforms the function into
625  a predicate. The overridden functions implemented in this class generally
626  forward all evaluation to the underlying object.
627 */
629  public:
631 
632  longlong val_int() override { return args[0]->val_int(); }
633  enum Functype functype() const override { return MATCH_FUNC; }
634  const char *func_name() const override { return "match"; }
635  void print(const THD *thd, String *str,
636  enum_query_type query_type) const override {
637  args[0]->print(thd, str, query_type);
638  }
639 
640  float get_filtering_effect(THD *thd, table_map filter_for_table,
641  table_map read_tables,
642  const MY_BITMAP *fields_to_ignore,
643  double rows_in_table) override {
644  return args[0]->get_filtering_effect(thd, filter_for_table, read_tables,
645  fields_to_ignore, rows_in_table);
646  }
647 };
649 class JOIN;
650 
651 /*
652  trigcond<param>(arg) ::= param? arg : true
653 
654  The class Item_func_trig_cond is used for guarded predicates
655  which are employed only for internal purposes.
656  A guarded predicate is an object consisting of an a regular or
657  a guarded predicate P and a pointer to a boolean guard variable g.
658  A guarded predicate P/g is evaluated to true if the value of the
659  guard g is false, otherwise it is evaluated to the same value that
660  the predicate P: val(P/g)= g ? val(P):true.
661  Guarded predicates allow us to include predicates into a conjunction
662  conditionally. Currently they are utilized for pushed down predicates
663  in queries with outer join operations.
664 
665  In the future, probably, it makes sense to extend this class to
666  the objects consisting of three elements: a predicate P, a pointer
667  to a variable g and a firing value s with following evaluation
668  rule: val(P/g,s)= g==s? val(P) : true. It will allow us to build only
669  one item for the objects of the form P/g1/g2...
670 
671  Objects of this class are built only for query execution after
672  the execution plan has been already selected. That's why this
673  class needs only val_int out of generic methods.
674 
675  Current uses of Item_func_trig_cond objects:
676  - To wrap selection conditions when executing outer joins
677  - To wrap condition that is pushed down into subquery
678 */
679 
681  public:
683  /**
684  This trigger type deactivates join conditions when a row has been
685  NULL-complemented. For example, in t1 LEFT JOIN t2, the join condition
686  can be tested on t2's row only if that row is not NULL-complemented.
687  */
689 
690  /**
691  This trigger type deactivates predicated from WHERE condition when no
692  row satisfying the join condition has been found. For Example, in t1
693  LEFT JOIN t2, the where condition pushed to t2 can be tested only after
694  at least one t2 row has been produced, which may be a NULL-complemented
695  row.
696  */
698 
699  /**
700  In IN->EXISTS subquery transformation, new predicates are added:
701  WHERE inner_field=outer_field OR inner_field IS NULL,
702  as well as
703  HAVING inner_field IS NOT NULL,
704  are disabled if outer_field is a NULL value
705  */
707  };
708 
709  private:
710  /** Pointer to trigger variable */
711  bool *trig_var;
712  /// Optional: JOIN of table which is the source of trig_var
713  const JOIN *m_join;
714  /// Optional: if join!=NULL: index of table
716  /** Type of trig_var; for printing */
718 
719  public:
720  /**
721  @param a the item for @<condition@>
722  @param f pointer to trigger variable
723  @param join if a table's property is the source of 'f', JOIN
724  which owns this table; NULL otherwise.
725  @param idx if join!=NULL: index of this table in the
726  JOIN_TAB/QEP_TAB array. NO_PLAN_IDX otherwise.
727  @param trig_type_arg type of 'f'
728  */
730  enum_trig_type trig_type_arg)
731  : Item_bool_func(a),
732  trig_var(f),
733  m_join(join),
734  m_idx(idx),
735  trig_type(trig_type_arg) {}
736  longlong val_int() override;
737  enum Functype functype() const override { return TRIG_COND_FUNC; }
738  /// '@<if@>', to distinguish from the if() SQL function
739  const char *func_name() const override { return "<if>"; }
740  /// Get range of inner tables spanned by associated outer join operation
741  void get_table_range(TABLE_LIST **first_table, TABLE_LIST **last_table) const;
742  /// Get table_map of inner tables spanned by associated outer join operation
743  table_map get_inner_tables() const;
744  bool fix_fields(THD *thd, Item **ref) override {
745  if (Item_bool_func::fix_fields(thd, ref)) return true;
747  return false;
748  }
751  DBUG_ASSERT(m_join != nullptr);
752  // Make this function dependent on the inner tables
754  } else if (trig_type == OUTER_FIELD_IS_NOT_NULL) {
756  }
757  }
758  void update_used_tables() override {
761  }
762  enum enum_trig_type get_trig_type() const { return trig_type; }
763  bool *get_trig_var() { return trig_var; }
765  void print(const THD *thd, String *str,
766  enum_query_type query_type) const override;
767  plan_idx idx() const { return m_idx; }
768 };
769 
771  /* allow to check presence of values in max/min optimization */
776 
777  public:
778  bool show;
779 
781  : Item_func_not(a),
782  test_sum_item(0),
783  test_sub_item(0),
784  subselect(0),
785  abort_on_null(0),
786  show(0) {}
787  void apply_is_true() override { abort_on_null = true; }
788  /// Treat UNKNOWN result like FALSE because callers see no difference
789  bool ignore_unknown() const { return abort_on_null; }
790  longlong val_int() override;
791  enum Functype functype() const override { return NOT_ALL_FUNC; }
792  const char *func_name() const override { return "<not>"; }
793  void print(const THD *thd, String *str,
794  enum_query_type query_type) const override;
797  void set_subselect(Item_subselect *item) { subselect = item; }
798  table_map not_null_tables() const override {
799  /*
800  See handling of not_null_tables_cache in
801  Item_in_optimizer::fix_fields().
802 
803  This item is the result of a transformation from an ALL clause
804  such as
805  left-expr < ALL(subquery)
806  into
807  <not>(left-expr >= ANY(subquery)
808 
809  An inequality usually rejects NULLs from both operands, so the
810  not_null_tables() of the inequality is the union of the
811  null-rejecting tables of both operands. However, since this is a
812  transformed ALL clause that should return true if the subquery
813  is empty (even if left-expr is NULL), it is not null rejecting
814  for left-expr. The not null tables mask for left-expr should be
815  removed, leaving only the null-rejecting tables of the
816  subquery. Item_subselect::not_null_tables() always returns 0 (no
817  null-rejecting tables). Therefore, always return 0.
818  */
819  return 0;
820  }
822  Item *truth_transformer(THD *, Bool_test) override;
823 };
824 
826  public:
828  longlong val_int() override;
829  const char *func_name() const override { return "<nop>"; }
830  table_map not_null_tables() const override { return not_null_tables_cache; }
831  Item *truth_transformer(THD *, Bool_test) override;
832 };
833 
834 /**
835  Implements the comparison operator equals (=)
836 */
838  public:
840  Item_func_eq(const POS &pos, Item *a, Item *b)
841  : Item_func_comparison(pos, a, b) {}
842  longlong val_int() override;
843  enum Functype functype() const override { return EQ_FUNC; }
844  enum Functype rev_functype() const override { return EQ_FUNC; }
845  cond_result eq_cmp_result() const override { return COND_TRUE; }
846  const char *func_name() const override { return "="; }
847  Item *negated_item() override;
848  bool equality_substitution_analyzer(uchar **) override { return true; }
850  bool gc_subst_analyzer(uchar **) override { return true; }
851 
852  float get_filtering_effect(THD *thd, table_map filter_for_table,
853  table_map read_tables,
854  const MY_BITMAP *fields_to_ignore,
855  double rows_in_table) override;
856 };
857 
858 /**
859  The <=> operator evaluates the same as
860 
861  a IS NULL || b IS NULL ? a IS NULL == b IS NULL : a = b
862 
863  a <=> b is equivalent to the standard operation a IS NOT DISTINCT FROM b.
864 
865  Notice that the result is TRUE or FALSE, and never UNKNOWN.
866 */
868  public:
870  null_on_null = false;
871  }
872  Item_func_equal(const POS &pos, Item *a, Item *b)
873  : Item_func_comparison(pos, a, b) {
874  null_on_null = false;
875  }
876  longlong val_int() override;
877  bool resolve_type(THD *thd) override;
878  enum Functype functype() const override { return EQUAL_FUNC; }
879  enum Functype rev_functype() const override { return EQUAL_FUNC; }
880  cond_result eq_cmp_result() const override { return COND_TRUE; }
881  const char *func_name() const override { return "<=>"; }
882  Item *truth_transformer(THD *, Bool_test) override { return nullptr; }
883 
884  float get_filtering_effect(THD *thd, table_map filter_for_table,
885  table_map read_tables,
886  const MY_BITMAP *fields_to_ignore,
887  double rows_in_table) override;
888 };
889 
890 /**
891  Implements the comparison operator greater than or equals (>=)
892 */
894  public:
896  longlong val_int() override;
897  enum Functype functype() const override { return GE_FUNC; }
898  enum Functype rev_functype() const override { return LE_FUNC; }
899  cond_result eq_cmp_result() const override { return COND_TRUE; }
900  const char *func_name() const override { return ">="; }
901  Item *negated_item() override;
902  bool gc_subst_analyzer(uchar **) override { return true; }
903 
904  float get_filtering_effect(THD *thd, table_map filter_for_table,
905  table_map read_tables,
906  const MY_BITMAP *fields_to_ignore,
907  double rows_in_table) override;
908 };
909 
910 /**
911  Implements the comparison operator greater than (>)
912 */
914  public:
916  longlong val_int() override;
917  enum Functype functype() const override { return GT_FUNC; }
918  enum Functype rev_functype() const override { return LT_FUNC; }
919  cond_result eq_cmp_result() const override { return COND_FALSE; }
920  const char *func_name() const override { return ">"; }
921  Item *negated_item() override;
922  bool gc_subst_analyzer(uchar **) override { return true; }
923 
924  float get_filtering_effect(THD *thd, table_map filter_for_table,
925  table_map read_tables,
926  const MY_BITMAP *fields_to_ignore,
927  double rows_in_table) override;
928 };
929 
930 /**
931  Implements the comparison operator less than or equals (<=)
932 */
934  public:
936  longlong val_int() override;
937  enum Functype functype() const override { return LE_FUNC; }
938  enum Functype rev_functype() const override { return GE_FUNC; }
939  cond_result eq_cmp_result() const override { return COND_TRUE; }
940  const char *func_name() const override { return "<="; }
941  Item *negated_item() override;
942  bool gc_subst_analyzer(uchar **) override { return true; }
943 
944  float get_filtering_effect(THD *thd, table_map filter_for_table,
945  table_map read_tables,
946  const MY_BITMAP *fields_to_ignore,
947  double rows_in_table) override;
948 };
949 
950 /**
951  Implements the comparison operator less than (<)
952 */
954  public:
956  longlong val_int() override;
957  enum Functype functype() const override { return LT_FUNC; }
958  enum Functype rev_functype() const override { return GT_FUNC; }
959  cond_result eq_cmp_result() const override { return COND_FALSE; }
960  const char *func_name() const override { return "<"; }
961  Item *negated_item() override;
962  bool gc_subst_analyzer(uchar **) override { return true; }
963 
964  float get_filtering_effect(THD *thd, table_map filter_for_table,
965  table_map read_tables,
966  const MY_BITMAP *fields_to_ignore,
967  double rows_in_table) override;
968 };
969 
970 /**
971  Implements the comparison operator not equals (<>)
972 */
974  public:
976  longlong val_int() override;
977  enum Functype functype() const override { return NE_FUNC; }
978  cond_result eq_cmp_result() const override { return COND_FALSE; }
979  optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
980  const char *func_name() const override { return "<>"; }
981  Item *negated_item() override;
982 
983  float get_filtering_effect(THD *thd, table_map filter_for_table,
984  table_map read_tables,
985  const MY_BITMAP *fields_to_ignore,
986  double rows_in_table) override;
987 };
988 
989 /*
990  The class Item_func_opt_neg is defined to factor out the functionality
991  common for the classes Item_func_between and Item_func_in. The objects
992  of these classes can express predicates or their negations.
993  The alternative approach would be to create pairs Item_func_between,
994  Item_func_notbetween and Item_func_in, Item_func_notin.
995 
996 */
997 
999  public:
1000  bool negated; /* <=> the item represents NOT <func> */
1001  bool pred_level; /* <=> [NOT] <func> is used on a predicate level */
1002  public:
1003  Item_func_opt_neg(const POS &pos, Item *a, Item *b, Item *c, bool is_negation)
1004  : Item_int_func(pos, a, b, c), negated(0), pred_level(0) {
1005  if (is_negation) negate();
1006  }
1007  Item_func_opt_neg(const POS &pos, PT_item_list *list, bool is_negation)
1008  : Item_int_func(pos, list), negated(0), pred_level(0) {
1009  if (is_negation) negate();
1010  }
1011 
1012  public:
1013  inline void negate() { negated = !negated; }
1014  inline void apply_is_true() override { pred_level = 1; }
1015  bool ignore_unknown() const { return pred_level; }
1016  Item *truth_transformer(THD *, Bool_test test) override {
1017  if (test != BOOL_NEGATED) return nullptr;
1018  negated = !negated;
1019  return this;
1020  }
1021  bool eq(const Item *item, bool binary_cmp) const override;
1022  bool subst_argument_checker(uchar **) override { return true; }
1023 };
1024 
1027 
1028  public:
1031  /* true <=> arguments will be compared as dates. */
1035 
1036  /* Comparators used for DATE/DATETIME comparison. */
1038  Item_func_between(const POS &pos, Item *a, Item *b, Item *c, bool is_negation)
1039  : Item_func_opt_neg(pos, a, b, c, is_negation),
1043  longlong val_int() override;
1044  optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
1045  enum Functype functype() const override { return BETWEEN; }
1046  const char *func_name() const override { return "between"; }
1047  bool fix_fields(THD *, Item **) override;
1048  void fix_after_pullout(SELECT_LEX *parent_select,
1049  SELECT_LEX *removed_select) override;
1050  bool resolve_type(THD *) override;
1051  void print(const THD *thd, String *str,
1052  enum_query_type query_type) const override;
1053  bool is_bool_func() const override { return true; }
1054  const CHARSET_INFO *compare_collation() const override {
1055  return cmp_collation.collation;
1056  }
1057  uint decimal_precision() const override { return 1; }
1058  bool gc_subst_analyzer(uchar **) override { return true; }
1059 
1060  float get_filtering_effect(THD *thd, table_map filter_for_table,
1061  table_map read_tables,
1062  const MY_BITMAP *fields_to_ignore,
1063  double rows_in_table) override;
1064 };
1065 
1067  public:
1069  : Item_bool_func2(pos, a, b) {}
1070  longlong val_int() override;
1071  optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1072  const char *func_name() const override { return "strcmp"; }
1073 
1074  void print(const THD *thd, String *str,
1075  enum_query_type query_type) const override {
1076  Item_func::print(thd, str, query_type);
1077  }
1078  bool resolve_type(THD *thd) override {
1079  if (Item_bool_func2::resolve_type(thd)) return true;
1080  fix_char_length(2); // returns "1" or "0" or "-1"
1081  return false;
1082  }
1083 };
1084 
1087  double dbl;
1089 };
1090 
1093 
1097 
1098  public:
1100  Item *expr2, class PT_item_list *opt_expr_list = NULL)
1101  : super(pos, alloc_row(pos, mem_root, expr1, expr2, opt_expr_list)),
1102  row(down_cast<Item_row *>(args[0])),
1103  intervals(0) {
1104  allowed_arg_cols = 0; // Fetch this value from first argument
1105  }
1106 
1107  bool itemize(Parse_context *pc, Item **res) override;
1108  longlong val_int() override;
1109  bool resolve_type(THD *) override;
1110  const char *func_name() const override { return "interval"; }
1111  uint decimal_precision() const override { return 2; }
1112  void print(const THD *thd, String *str,
1113  enum_query_type query_type) const override;
1114 
1115  private:
1116  // Runs in CTOR init list, cannot access *this as Item_func_interval
1117  static Item_row *alloc_row(const POS &pos, MEM_ROOT *mem_root, Item *expr1,
1118  Item *expr2, class PT_item_list *opt_expr_list);
1119 };
1120 
1122  protected:
1124  : Item_func_numhybrid(pos, a, b) {
1125  null_on_null = false;
1126  }
1128  null_on_null = false;
1129  }
1130 
1131  public:
1134  null_on_null = false;
1135  }
1136  double real_op() override;
1137  longlong int_op() override;
1138  String *str_op(String *) override;
1139  /**
1140  Get the result of COALESCE as a JSON value.
1141  @param[in,out] wr the result value holder
1142  */
1143  bool val_json(Json_wrapper *wr) override;
1144  bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1145  bool time_op(MYSQL_TIME *ltime) override;
1146  my_decimal *decimal_op(my_decimal *) override;
1147  bool resolve_type(THD *) override;
1148  void set_numeric_type() override {}
1149  enum Item_result result_type() const override { return hybrid_type; }
1150  const char *func_name() const override { return "coalesce"; }
1151 };
1152 
1154  protected:
1156 
1157  public:
1159  : Item_func_coalesce(pos, a, b) {}
1160  double real_op() override;
1161  longlong int_op() override;
1162  String *str_op(String *str) override;
1163  bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1164  bool time_op(MYSQL_TIME *ltime) override;
1165  my_decimal *decimal_op(my_decimal *) override;
1166  bool val_json(Json_wrapper *result) override;
1167  bool resolve_type(THD *) override;
1168  const char *func_name() const override { return "ifnull"; }
1169  Field *tmp_table_field(TABLE *table) override;
1170  uint decimal_precision() const override;
1171 };
1172 
1173 /**
1174  ANY_VALUE(expr) is like expr except that it is not checked by
1175  aggregate_check logic. It serves as a solution for users who want to
1176  bypass this logic.
1177 */
1179  public:
1181  const char *func_name() const override { return "any_value"; }
1182  bool aggregate_check_group(uchar *arg) override;
1183  bool aggregate_check_distinct(uchar *arg) override;
1184 };
1185 
1186 class Item_func_if final : public Item_func {
1188 
1189  public:
1191  : Item_func(a, b, c), cached_result_type(INT_RESULT) {
1192  null_on_null = false;
1193  }
1194  Item_func_if(const POS &pos, Item *a, Item *b, Item *c)
1195  : Item_func(pos, a, b, c), cached_result_type(INT_RESULT) {
1196  null_on_null = false;
1197  }
1198 
1199  double val_real() override;
1200  longlong val_int() override;
1201  String *val_str(String *str) override;
1202  my_decimal *val_decimal(my_decimal *) override;
1203  bool val_json(Json_wrapper *wr) override;
1204  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1205  bool get_time(MYSQL_TIME *ltime) override;
1206  enum Item_result result_type() const override { return cached_result_type; }
1207  bool fix_fields(THD *, Item **) override;
1208  bool resolve_type(THD *) override;
1209  void fix_after_pullout(SELECT_LEX *parent_select,
1210  SELECT_LEX *removed_select) override;
1211  uint decimal_precision() const override;
1212  const char *func_name() const override { return "if"; }
1213  enum Functype functype() const override { return IF_FUNC; }
1214 };
1215 
1218 
1219  public:
1222  null_on_null = false;
1223  }
1224  double val_real() override;
1225  longlong val_int() override;
1226  String *val_str(String *str) override;
1227  my_decimal *val_decimal(my_decimal *) override;
1228  bool val_json(Json_wrapper *wr) override;
1229  Item_result result_type() const override { return cached_result_type; }
1230  bool resolve_type(THD *thd) override;
1231  uint decimal_precision() const override {
1232  return args[0]->decimal_precision();
1233  }
1234  const char *func_name() const override { return "nullif"; }
1235 
1236  void print(const THD *thd, String *str,
1237  enum_query_type query_type) const override {
1238  Item_func::print(thd, str, query_type);
1239  }
1240 
1241  bool is_null() override;
1242  /**
1243  This is a workaround for the broken inheritance hierarchy: this should
1244  inherit from Item_func instead of Item_bool_func2
1245  */
1246  bool is_bool_func() const override { return false; }
1247 };
1248 
1249 /* Functions to handle the optimized IN */
1250 
1251 /* A vector of values of some type */
1252 
1253 class in_vector {
1254  private:
1255  const uint count; ///< Original size of the vector
1256  public:
1257  uint used_count; ///< The actual size of the vector (NULL may be ignored)
1258 
1259  /**
1260  See Item_func_in::resolve_type() for why we need both
1261  count and used_count.
1262  */
1263  explicit in_vector(uint elements) : count(elements), used_count(elements) {}
1264 
1265  virtual ~in_vector() {}
1266 
1267  /**
1268  Calls item->val_int() or item->val_str() etc.
1269  and then does binary_search if the value is non-null.
1270  @param item to evaluate, and lookup in the IN-list.
1271  @return true if evaluated value of the item was found.
1272  */
1273  virtual bool find_item(Item *item) = 0;
1274 
1275  /**
1276  Create an instance of Item_{type} (e.g. Item_decimal) constant object
1277  which type allows it to hold an element of this vector without any
1278  conversions.
1279  The purpose of this function is to be able to get elements of this
1280  vector in form of Item_xxx constants without creating Item_xxx object
1281  for every array element you get (i.e. this implements "FlyWeight" pattern)
1282 
1283  @param mem_root Where to allocate the Item.
1284  */
1285  virtual Item_basic_constant *create_item(MEM_ROOT *mem_root) const = 0;
1286 
1287  /**
1288  Store the value at position #pos into provided item object
1289 
1290  @param pos Index of value to store
1291  @param item Constant item to store value into. The item must be of the same
1292  type that create_item() returns.
1293  */
1294  virtual void value_to_item(uint pos, Item_basic_constant *item) const = 0;
1295 
1296  /** Compare values number pos1 and pos2 for equality */
1297  virtual bool compare_elems(uint pos1, uint pos2) const = 0;
1298 
1299  virtual bool is_row_result() const { return false; }
1300 
1301  /**
1302  Fill the vector by evaluating the items passed as arguments.
1303  Note that null values are skipped so the vector may end up containing
1304  fewer elements than the number of items.
1305  The vector is sorted so that it can be used for binary search.
1306 
1307  @param items Items to evaluate
1308  @param item_count Number of items
1309 
1310  @return true if any null values was found, false otherwise.
1311  */
1312  bool fill(Item **items, uint item_count);
1313 
1314  private:
1315  virtual void set(uint pos, Item *item) = 0;
1316 
1317  /**
1318  Resize and then sort the IN-list array, so we can do efficient lookup with
1319  binary_search.
1320  */
1321  virtual void resize_and_sort() = 0;
1322 };
1323 
1324 class in_string final : public in_vector {
1328  // String objects are not sortable, sort pointers instead.
1331 
1332  public:
1333  in_string(MEM_ROOT *mem_root, uint elements, const CHARSET_INFO *cs);
1335  return new (mem_root) Item_string(collation);
1336  }
1337  void value_to_item(uint pos, Item_basic_constant *item) const override {
1339  }
1340  bool find_item(Item *item) override;
1341  bool compare_elems(uint pos1, uint pos2) const override;
1342 
1343  private:
1344  void set(uint pos, Item *item) override;
1345  void resize_and_sort() override;
1346 };
1347 
1348 class in_longlong : public in_vector {
1349  public:
1353  };
1354 
1355  protected:
1357 
1358  public:
1360  : in_vector(elements), base(mem_root, elements) {}
1362  /*
1363  We've created a signed INT, this may not be correct in the
1364  general case (see BUG#19342).
1365  */
1366  return new (mem_root) Item_int(0LL);
1367  }
1368  void value_to_item(uint pos, Item_basic_constant *item) const override {
1369  down_cast<Item_int *>(item)->value = base[pos].val;
1370  item->unsigned_flag = base[pos].unsigned_flag;
1371  }
1372  bool find_item(Item *item) override;
1373  bool compare_elems(uint pos1, uint pos2) const override;
1374 
1375  private:
1376  void set(uint pos, Item *item) override { val_item(item, &base[pos]); }
1377  void resize_and_sort() override;
1378  virtual void val_item(Item *item, packed_longlong *result);
1379 };
1380 
1382  public:
1384  : in_longlong(mem_root, elements) {}
1386  return new (mem_root) Item_temporal(MYSQL_TYPE_DATETIME, 0LL);
1387  }
1388 
1389  private:
1390  void val_item(Item *item, packed_longlong *result) override;
1391 };
1392 
1394  public:
1396  : in_longlong(mem_root, elements) {}
1398  return new (mem_root) Item_temporal(MYSQL_TYPE_TIME, 0LL);
1399  }
1400 
1401  private:
1402  void val_item(Item *item, packed_longlong *result) override;
1403 };
1404 
1405 /*
1406  Class to represent a vector of constant DATE/DATETIME values.
1407  Values are obtained with help of the get_datetime_value() function.
1408  If the left item is a constant one then its value is cached in the
1409  lval_cache variable.
1410 */
1412  /* An item used to issue warnings. */
1414  /* Cache for the left item. */
1416 
1417  public:
1418  in_datetime(MEM_ROOT *mem_root, Item *warn_item_arg, uint elements)
1419  : in_longlong(mem_root, elements),
1420  warn_item(warn_item_arg),
1421  lval_cache(nullptr) {}
1423  return new (mem_root) Item_temporal(MYSQL_TYPE_DATETIME, 0LL);
1424  }
1425 
1426  private:
1427  void set(uint pos, Item *item) override;
1428  void val_item(Item *item, packed_longlong *result) override;
1429 };
1430 
1431 class in_double final : public in_vector {
1433 
1434  public:
1436  : in_vector(elements), base(mem_root, elements) {}
1438  return new (mem_root) Item_float(0.0, 0);
1439  }
1440  void value_to_item(uint pos, Item_basic_constant *item) const override {
1441  down_cast<Item_float *>(item)->value = base[pos];
1442  }
1443  bool find_item(Item *item) override;
1444  bool compare_elems(uint pos1, uint pos2) const override;
1445 
1446  private:
1447  void set(uint pos, Item *item) override;
1448  void resize_and_sort() override;
1449 };
1450 
1451 class in_decimal final : public in_vector {
1453 
1454  public:
1456  : in_vector(elements), base(mem_root, elements) {}
1458  return new (mem_root) Item_decimal(0, false);
1459  }
1460  void value_to_item(uint pos, Item_basic_constant *item) const override {
1461  down_cast<Item_decimal *>(item)->set_decimal_value(&base[pos]);
1462  }
1463  bool find_item(Item *item) override;
1464  bool compare_elems(uint pos1, uint pos2) const override;
1465 
1466  private:
1467  void set(uint pos, Item *item) override;
1468  void resize_and_sort() override;
1469 };
1470 
1471 /*
1472 ** Classes for easy comparing of non const items
1473 */
1474 
1475 class cmp_item {
1476  public:
1478  virtual ~cmp_item() {}
1479  virtual void store_value(Item *item) = 0;
1480  /**
1481  @returns result (true, false or UNKNOWN) of
1482  "stored argument's value <> item's value"
1483  */
1484  virtual int cmp(Item *item) = 0;
1485  // for optimized IN with row
1486  virtual int compare(const cmp_item *item) const = 0;
1487 
1488  /**
1489  Find the appropriate comparator for the given type.
1490 
1491  @param result_type Used to find the appropriate comparator.
1492  @param item Item object used to distinguish temporal types.
1493  @param cs Charset
1494 
1495  @return
1496  New cmp_item_xxx object.
1497  */
1498  static cmp_item *get_comparator(Item_result result_type, const Item *item,
1499  const CHARSET_INFO *cs);
1500  virtual cmp_item *make_same() = 0;
1501  virtual void store_value_by_template(cmp_item *, Item *item) {
1502  store_value(item);
1503  }
1504 };
1505 
1506 /// cmp_item which stores a scalar (i.e. non-ROW).
1507 class cmp_item_scalar : public cmp_item {
1508  protected:
1509  bool m_null_value; ///< If stored value is NULL
1510  void set_null_value(bool nv) { m_null_value = nv; }
1511 };
1512 
1514  private:
1519 
1520  public:
1522  : value(value_buff, sizeof(value_buff), cs), cmp_charset(cs) {}
1523 
1524  virtual int compare(const cmp_item *ci) const {
1525  const cmp_item_string *l_cmp = down_cast<const cmp_item_string *>(ci);
1526  return sortcmp(value_res, l_cmp->value_res, cmp_charset);
1527  }
1528 
1529  virtual void store_value(Item *item) {
1530  String *res = item->val_str(&value);
1531  if (res && (res != &value || !res->is_alloced())) {
1532  // 'res' may point in item's transient internal data, so make a copy
1533  value.copy(*res);
1534  }
1535  value_res = &value;
1536  set_null_value(item->null_value);
1537  }
1538 
1539  virtual int cmp(Item *arg) {
1540  char buff[STRING_BUFFER_USUAL_SIZE];
1541  String tmp(buff, sizeof(buff), cmp_charset);
1542  String *res = arg->val_str(&tmp);
1543  if (m_null_value || arg->null_value) return UNKNOWN;
1544  if (value_res && res)
1545  return sortcmp(value_res, res, cmp_charset) != 0;
1546  else if (!value_res && !res)
1547  return false;
1548  else
1549  return true;
1550  }
1551  virtual cmp_item *make_same();
1552 };
1553 
1555  private:
1556  /// Cached JSON value to look up
1558  /// Cache for the value above
1560  /// String buffer
1562  /// Scalar holder for the RHS value
1564 
1565  public:
1567 
1568  virtual int compare(const cmp_item *ci) const;
1569  virtual void store_value(Item *item);
1570  virtual int cmp(Item *arg);
1571  virtual cmp_item *make_same();
1572 };
1573 
1576 
1577  public:
1578  cmp_item_int() {} /* Remove gcc warning */
1579  void store_value(Item *item) override {
1580  value = item->val_int();
1581  set_null_value(item->null_value);
1582  }
1583  int cmp(Item *arg) override {
1584  const bool rc = value != arg->val_int();
1585  return (m_null_value || arg->null_value) ? UNKNOWN : rc;
1586  }
1587  int compare(const cmp_item *ci) const override {
1588  const cmp_item_int *l_cmp = down_cast<const cmp_item_int *>(ci);
1589  return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1);
1590  }
1591  cmp_item *make_same() override;
1592 };
1593 
1594 /*
1595  Compare items of temporal type.
1596  Values are obtained with: get_datetime_value() (DATE/DATETIME/TIMESTAMP) and
1597  get_time_value() (TIME).
1598  If the left item is a constant one then its value is cached in the
1599  lval_cache variable.
1600 */
1603 
1604  public:
1605  /* Item used for issuing warnings. */
1606  const Item *warn_item;
1607  /* Cache for the left item. */
1609  /// Distinguish between DATE/DATETIME/TIMESTAMP and TIME
1610  bool has_date;
1611 
1612  cmp_item_datetime(const Item *warn_item_arg);
1613  void store_value(Item *item) override;
1614  int cmp(Item *arg) override;
1615  int compare(const cmp_item *ci) const override;
1616  cmp_item *make_same() override;
1617 };
1618 
1620  double value;
1621 
1622  public:
1623  cmp_item_real() {} /* Remove gcc warning */
1624  void store_value(Item *item) override {
1625  value = item->val_real();
1626  set_null_value(item->null_value);
1627  }
1628  int cmp(Item *arg) override {
1629  const bool rc = value != arg->val_real();
1630  return (m_null_value || arg->null_value) ? UNKNOWN : rc;
1631  }
1632  int compare(const cmp_item *ci) const override {
1633  const cmp_item_real *l_cmp = down_cast<const cmp_item_real *>(ci);
1634  return (value < l_cmp->value) ? -1 : ((value == l_cmp->value) ? 0 : 1);
1635  }
1636  cmp_item *make_same() override;
1637 };
1638 
1641 
1642  public:
1643  cmp_item_decimal() {} /* Remove gcc warning */
1644  void store_value(Item *item);
1645  int cmp(Item *arg);
1646  int compare(const cmp_item *c) const;
1647  cmp_item *make_same();
1648 };
1649 
1650 /**
1651  CASE ... WHEN ... THEN ... END function implementation.
1652 
1653  When there is no expression between CASE and the first WHEN
1654  (the CASE expression) then this function simple checks all WHEN expressions
1655  one after another. When some WHEN expression evaluated to TRUE then the
1656  value of the corresponding THEN expression is returned.
1657 
1658  When the CASE expression is specified then it is compared to each WHEN
1659  expression individually. When an equal WHEN expression is found
1660  corresponding THEN expression is returned.
1661  In order to do correct comparisons several comparators are used. One for
1662  each result type. Different result types that are used in particular
1663  CASE ... END expression are collected in the resolve_type() member
1664  function and only comparators for there result types are used.
1665 */
1666 
1668  typedef Item_func super;
1669 
1671  enum Item_result cached_result_type, left_result_type;
1676  cmp_item *cmp_items[5]; /* For all result types */
1678 
1679  public:
1680  Item_func_case(const POS &pos, List<Item> &list, Item *first_expr_arg,
1681  Item *else_expr_arg)
1682  : super(pos),
1683  first_expr_num(-1),
1684  else_expr_num(-1),
1685  cached_result_type(INT_RESULT),
1687  case_item(0) {
1688  null_on_null = false;
1689  ncases = list.elements;
1690  if (first_expr_arg) {
1691  first_expr_num = list.elements;
1692  list.push_back(first_expr_arg);
1693  }
1694  if (else_expr_arg) {
1695  else_expr_num = list.elements;
1696  list.push_back(else_expr_arg);
1697  }
1698  set_arguments(list, true);
1699  memset(&cmp_items, 0, sizeof(cmp_items));
1700  }
1701  int get_first_expr_num() const { return first_expr_num; }
1702  int get_else_expr_num() const { return else_expr_num; }
1703  double val_real() override;
1704  longlong val_int() override;
1705  String *val_str(String *) override;
1706  my_decimal *val_decimal(my_decimal *) override;
1707  bool val_json(Json_wrapper *wr) override;
1708  bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1709  bool get_time(MYSQL_TIME *ltime) override;
1710  bool fix_fields(THD *thd, Item **ref) override;
1711  bool resolve_type(THD *) override;
1712  uint decimal_precision() const override;
1713  enum Item_result result_type() const override { return cached_result_type; }
1714  const char *func_name() const override { return "case"; }
1715  void print(const THD *thd, String *str,
1716  enum_query_type query_type) const override;
1717  Item *find_item(String *str);
1718  const CHARSET_INFO *compare_collation() const override {
1719  return cmp_collation.collation;
1720  }
1721  void cleanup() override;
1722  enum Functype functype() const override { return CASE_FUNC; }
1723 };
1724 
1725 /**
1726  in_expr [NOT] IN (in_value_list).
1727 
1728  The current implementation distinguishes 2 cases:
1729  1) all items in in_value_list are constants and have the same
1730  result type. This case is handled by in_vector class.
1731  2) otherwise Item_func_in employs several cmp_item objects to perform
1732  comparisons of in_expr and an item from in_value_list. One cmp_item
1733  object for each result type. Different result types are collected in the
1734  resolve_type() member function by means of collect_cmp_types() function.
1735 */
1737  public:
1738  /// An array of values, created when the bisection lookup method is used
1740  /**
1741  If there is some NULL among @<in value list@>, during a val_int() call; for
1742  example
1743  IN ( (1,(3,'col')), ... ), where 'col' is a column which evaluates to
1744  NULL.
1745  */
1747  /**
1748  Set to true by resolve_type() if the IN list contains a
1749  dependent subquery, in which case condition filtering will not be
1750  calculated for this item.
1751  */
1754  cmp_item *cmp_items[6]; /* One cmp_item for each result type */
1756 
1757  Item_func_in(const POS &pos, PT_item_list *list, bool is_negation)
1758  : Item_func_opt_neg(pos, list, is_negation),
1759  array(NULL),
1760  have_null(false),
1762  memset(&cmp_items, 0, sizeof(cmp_items));
1763  allowed_arg_cols = 0; // Fetch this value from first argument
1764  }
1765  longlong val_int() override;
1766  bool fix_fields(THD *, Item **) override;
1767  void fix_after_pullout(SELECT_LEX *parent_select,
1768  SELECT_LEX *removed_select) override;
1769  bool resolve_type(THD *) override;
1770  uint decimal_precision() const override { return 1; }
1771 
1772  /**
1773  Cleanup data and comparator arrays.
1774 
1775  @note Used during regular cleanup and to free arrays after GC substitution.
1776  @see substitute_gc().
1777  */
1779  uint i;
1780  destroy(array);
1781  array = 0;
1782  for (i = 0; i <= (uint)DECIMAL_RESULT + 1; i++) {
1783  destroy(cmp_items[i]);
1784  cmp_items[i] = 0;
1785  }
1786  }
1787 
1788  void cleanup() override {
1789  DBUG_ENTER("Item_func_in::cleanup");
1791  cleanup_arrays();
1793  }
1794  optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
1795  void print(const THD *thd, String *str,
1796  enum_query_type query_type) const override;
1797  enum Functype functype() const override { return IN_FUNC; }
1798  const char *func_name() const override { return " IN "; }
1799  bool is_bool_func() const override { return true; }
1800  const CHARSET_INFO *compare_collation() const override {
1801  return cmp_collation.collation;
1802  }
1803  bool gc_subst_analyzer(uchar **) override { return true; }
1804 
1805  float get_filtering_effect(THD *thd, table_map filter_for_table,
1806  table_map read_tables,
1807  const MY_BITMAP *fields_to_ignore,
1808  double rows_in_table) override;
1809 
1810  private:
1811  /**
1812  Usable if @<in value list@> is made only of constants. Returns true if one
1813  of these constants contains a NULL. Example:
1814  IN ( (-5, (12,NULL)), ... ).
1815  */
1816  bool list_contains_null();
1817  /**
1818  Utility function to help calculate the total filtering effect of
1819  IN predicates. This function calculates the filtering effect from
1820  a single field (or field reference) on the left hand side of the
1821  expression.
1822 
1823  @param fieldref Field (or field reference) on left hand side of
1824  IN, i.e., this function should be called for
1825  each fi in "(f1,...,fn) IN (values)"
1826  @param filter_for_table The table we are calculating filter effect for
1827  @param fields_to_ignore Fields in 'filter_for_table' that should not
1828  be part of the filter calculation. The filtering
1829  effect of these fields are already part of the
1830  calculation somehow (e.g. because there is a
1831  predicate "col = <const>", and the optimizer
1832  has decided to do ref access on 'col').
1833  @param rows_in_table The number of rows in table 'filter_for_table'
1834 
1835  @return the filtering effect (between 0 and 1) 'the_field'
1836  participates with in this IN predicate.
1837  */
1839  table_map filter_for_table,
1840  const MY_BITMAP *fields_to_ignore,
1841  double rows_in_table);
1842 };
1843 
1844 class cmp_item_row : public cmp_item {
1847 
1848  public:
1849  cmp_item_row() : comparators(nullptr), n(0) {}
1850  cmp_item_row(THD *thd, Item *item) : comparators(nullptr), n(item->cols()) {
1851  alloc_comparators(thd, item);
1852  }
1853  ~cmp_item_row();
1854 
1856  : comparators(other.comparators), n(other.n) {
1857  other.comparators = nullptr;
1858  other.n = 0;
1859  }
1860 
1861  void store_value(Item *item);
1862  int cmp(Item *arg);
1863  int compare(const cmp_item *arg) const;
1864  cmp_item *make_same();
1865  void store_value_by_template(cmp_item *tmpl, Item *);
1866  void set_comparator(uint col, cmp_item *comparator) {
1867  comparators[col] = comparator;
1868  }
1869 
1870  private:
1871  bool alloc_comparators(THD *thd, Item *item);
1872 };
1873 
1874 class in_row final : public in_vector {
1877  // Sort pointers, rather than objects.
1879 
1880  public:
1881  in_row(MEM_ROOT *mem_root, uint elements, cmp_item_row *cmp);
1882  bool is_row_result() const override { return true; }
1883  bool find_item(Item *item) override;
1884  bool compare_elems(uint pos1, uint pos2) const override;
1885  void set_comparator(uint col, cmp_item *comparator) {
1886  tmp->set_comparator(col, comparator);
1887  }
1889  DBUG_ASSERT(false);
1890  return nullptr;
1891  }
1892  void value_to_item(uint, Item_basic_constant *) const override {
1893  DBUG_ASSERT(false);
1894  }
1895 
1896  private:
1897  void set(uint pos, Item *item) override;
1898  void resize_and_sort() override;
1899 };
1900 
1901 /* Functions used by where clause */
1902 
1905 
1906  protected:
1908 
1909  public:
1910  Item_func_isnull(Item *a) : super(a) { null_on_null = false; }
1911  Item_func_isnull(const POS &pos, Item *a) : super(pos, a) {
1912  null_on_null = false;
1913  }
1914  longlong val_int() override;
1915  enum Functype functype() const override { return ISNULL_FUNC; }
1916  bool resolve_type(THD *thd) override;
1917  const char *func_name() const override { return "isnull"; }
1918  /* Optimize case of not_null_column IS NULL */
1919  void update_used_tables() override;
1920 
1921  float get_filtering_effect(THD *thd, table_map filter_for_table,
1922  table_map read_tables,
1923  const MY_BITMAP *fields_to_ignore,
1924  double rows_in_table) override;
1925  optimize_type select_optimize(const THD *) override { return OPTIMIZE_NULL; }
1926  Item *truth_transformer(THD *, Bool_test test) override;
1927  void print(const THD *thd, String *str,
1928  enum_query_type query_type) const override;
1929  const CHARSET_INFO *compare_collation() const override {
1930  return args[0]->collation.collation;
1931  }
1932  bool fix_fields(THD *thd, Item **ref) override;
1933 };
1934 
1935 /* Functions used by HAVING for rewriting IN subquery */
1936 
1937 /*
1938  This is like IS NOT NULL but it also remembers if it ever has
1939  encountered a NULL; it remembers this in the "was_null" property of the
1940  "owner" item.
1941 */
1944 
1945  public:
1947  : Item_func_isnull(a), owner(ow) {}
1948  enum Functype functype() const override { return ISNOTNULLTEST_FUNC; }
1949  longlong val_int() override;
1950  const char *func_name() const override { return "<is_not_null_test>"; }
1951  void update_used_tables() override;
1952  /**
1953  We add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE.
1954 
1955  @retval Always RAND_TABLE_BIT
1956  */
1958  return RAND_TABLE_BIT;
1959  }
1960  void print(const THD *thd, String *str,
1961  enum_query_type query_type) const override {
1962  Item_bool_func::print(thd, str, query_type);
1963  }
1964 };
1965 
1967  public:
1970  null_on_null = false;
1971  }
1972 
1973  longlong val_int() override;
1974  enum Functype functype() const override { return ISNOTNULL_FUNC; }
1975  bool resolve_type(THD *) override {
1976  max_length = 1;
1977  maybe_null = false;
1978  return false;
1979  }
1980  const char *func_name() const override { return "isnotnull"; }
1981  optimize_type select_optimize(const THD *) override { return OPTIMIZE_NULL; }
1982  Item *truth_transformer(THD *, Bool_test test) override;
1983  void print(const THD *thd, String *str,
1984  enum_query_type query_type) const override;
1985  const CHARSET_INFO *compare_collation() const override {
1986  return args[0]->collation.collation;
1987  }
1988  void apply_is_true() override {
1989  null_on_null = true;
1990  } // Same logic as for Item_func_truth's function
1991  float get_filtering_effect(THD *thd, table_map filter_for_table,
1992  table_map read_tables,
1993  const MY_BITMAP *fields_to_ignore,
1994  double rows_in_table) override;
1995 };
1996 
1999 
2001 
2003 
2004  bool escape_evaluated; ///< Tells if the escape clause has been evaluated.
2005  bool eval_escape_clause(THD *thd);
2006 
2007  public:
2008  int escape;
2009 
2010  Item_func_like(Item *a, Item *b, Item *escape_arg, bool escape_used)
2011  : Item_bool_func2(a, b),
2012  escape_item(escape_arg),
2013  escape_used_in_parsing(escape_used),
2015  Item_func_like(const POS &pos, Item *a, Item *b, Item *opt_escape_arg)
2016  : super(pos, a, b),
2017  escape_item(opt_escape_arg),
2018  escape_used_in_parsing(opt_escape_arg != NULL),
2020 
2021  bool itemize(Parse_context *pc, Item **res) override;
2022 
2023  longlong val_int() override;
2024  enum Functype functype() const override { return LIKE_FUNC; }
2025  optimize_type select_optimize(const THD *thd) override;
2026  cond_result eq_cmp_result() const override { return COND_TRUE; }
2027  const char *func_name() const override { return "like"; }
2028  bool fix_fields(THD *thd, Item **ref) override;
2029  bool resolve_type(THD *) override;
2030  void cleanup() override;
2031  /**
2032  @retval true non default escape char specified
2033  using "expr LIKE pat ESCAPE 'escape_char'" syntax
2034  */
2036 
2037  /**
2038  Has the escape clause been evaluated? It only needs to be evaluated
2039  once per execution, since we require it to be constant during execution.
2040  The escape member has a valid value if and only if this function returns
2041  true.
2042  */
2043  bool escape_is_evaluated() const { return escape_evaluated; }
2044 
2045  float get_filtering_effect(THD *thd, table_map filter_for_table,
2046  table_map read_tables,
2047  const MY_BITMAP *fields_to_ignore,
2048  double rows_in_table) override;
2049 
2050  private:
2051  /**
2052  The method updates covering keys depending on the
2053  length of wild string prefix.
2054 
2055  @param thd Pointer to THD object.
2056 
2057  @retval true if error happens during wild string prefix claculation,
2058  false otherwise.
2059  */
2060  bool check_covering_prefix_keys(THD *thd);
2061 };
2062 
2063 class Item_cond : public Item_bool_func {
2065 
2066  protected:
2069 
2070  public:
2071  /* Item_cond() is only used to create top level items */
2074  list.push_back(i1);
2075  list.push_back(i2);
2076  }
2077  Item_cond(const POS &pos, Item *i1, Item *i2)
2079  list.push_back(i1);
2080  list.push_back(i2);
2081  }
2082 
2083  Item_cond(THD *thd, Item_cond *item);
2085  : Item_bool_func(), list(nlist), abort_on_null(0) {}
2086  bool add(Item *item) {
2087  DBUG_ASSERT(item);
2088  return list.push_back(item);
2089  }
2090  bool add_at_head(Item *item) {
2091  DBUG_ASSERT(item);
2092  return list.push_front(item);
2093  }
2094  void add_at_head(List<Item> *nlist) {
2095  DBUG_ASSERT(nlist->elements);
2096  list.prepend(nlist);
2097  }
2098 
2099  bool itemize(Parse_context *pc, Item **res) override;
2100 
2101  bool fix_fields(THD *, Item **ref) override;
2102  void fix_after_pullout(SELECT_LEX *parent_select,
2103  SELECT_LEX *removed_select) override;
2104 
2105  Type type() const override { return COND_ITEM; }
2107  bool eq(const Item *item, bool binary_cmp) const override;
2108  table_map used_tables() const override { return used_tables_cache; }
2109  void update_used_tables() override;
2110  void print(const THD *thd, String *str,
2111  enum_query_type query_type) const override;
2112  void split_sum_func(THD *thd, Ref_item_array ref_item_array,
2113  List<Item> &fields) override;
2114  void apply_is_true() override { abort_on_null = true; }
2115  void copy_andor_arguments(THD *thd, Item_cond *item);
2116  bool walk(Item_processor processor, enum_walk walk, uchar *arg) override;
2117  Item *transform(Item_transformer transformer, uchar *arg) override;
2118  void traverse_cond(Cond_traverser, void *arg, traverse_order order) override;
2119  bool truth_transform_arguments(THD *thd, Bool_test test);
2120  bool subst_argument_checker(uchar **) override { return true; }
2121  Item *compile(Item_analyzer analyzer, uchar **arg_p,
2122  Item_transformer transformer, uchar *arg_t) override;
2123  bool remove_const_conds(THD *thd, Item *item, Item **new_item);
2124  /// Treat UNKNOWN result like FALSE because callers see no difference
2125  bool ignore_unknown() const { return abort_on_null; }
2126  bool equality_substitution_analyzer(uchar **) override { return true; }
2127 };
2128 
2129 /*
2130  The class Item_equal is used to represent conjunctions of equality
2131  predicates of the form field1 = field2, and field=const in where
2132  conditions and on expressions.
2133 
2134  All equality predicates of the form field1=field2 contained in a
2135  conjunction are substituted for a sequence of items of this class.
2136  An item of this class Item_equal(f1,f2,...fk) represents a
2137  multiple equality f1=f2=...=fk.
2138 
2139  If a conjunction contains predicates f1=f2 and f2=f3, a new item of
2140  this class is created Item_equal(f1,f2,f3) representing the multiple
2141  equality f1=f2=f3 that substitutes the above equality predicates in
2142  the conjunction.
2143  A conjunction of the predicates f2=f1 and f3=f1 and f3=f2 will be
2144  substituted for the item representing the same multiple equality
2145  f1=f2=f3.
2146  An item Item_equal(f1,f2) can appear instead of a conjunction of
2147  f2=f1 and f1=f2, or instead of just the predicate f1=f2.
2148 
2149  An item of the class Item_equal inherits equalities from outer
2150  conjunctive levels.
2151 
2152  Suppose we have a where condition of the following form:
2153  WHERE f1=f2 AND f3=f4 AND f3=f5 AND ... AND (...OR (f1=f3 AND ...)).
2154  In this case:
2155  f1=f2 will be substituted for Item_equal(f1,f2);
2156  f3=f4 and f3=f5 will be substituted for Item_equal(f3,f4,f5);
2157  f1=f3 will be substituted for Item_equal(f1,f2,f3,f4,f5);
2158 
2159  An object of the class Item_equal can contain an optional constant
2160  item c. Then it represents a multiple equality of the form
2161  c=f1=...=fk.
2162 
2163  Objects of the class Item_equal are used for the following:
2164 
2165  1. An object Item_equal(t1.f1,...,tk.fk) allows us to consider any
2166  pair of tables ti and tj as joined by an equi-condition.
2167  Thus it provide us with additional access paths from table to table.
2168 
2169  2. An object Item_equal(t1.f1,...,tk.fk) is applied to deduce new
2170  SARGable predicates:
2171  f1=...=fk AND P(fi) => f1=...=fk AND P(fi) AND P(fj).
2172  It also can give us additional index scans and can allow us to
2173  improve selectivity estimates.
2174 
2175  3. An object Item_equal(t1.f1,...,tk.fk) is used to optimize the
2176  selected execution plan for the query: if table ti is accessed
2177  before the table tj then in any predicate P in the where condition
2178  the occurrence of tj.fj is substituted for ti.fi. This can allow
2179  an evaluation of the predicate at an earlier step.
2180 
2181  When feature 1 is supported they say that join transitive closure
2182  is employed.
2183  When feature 2 is supported they say that search argument transitive
2184  closure is employed.
2185  Both features are usually supported by preprocessing original query and
2186  adding additional predicates.
2187  We do not just add predicates, we rather dynamically replace some
2188  predicates that can not be used to access tables in the investigated
2189  plan for those, obtained by substitution of some fields for equal fields,
2190  that can be used.
2191 
2192  Prepared Statements/Stored Procedures note: instances of class
2193  Item_equal are created only at the time a PS/SP is executed and
2194  are deleted in the end of execution. All changes made to these
2195  objects need not be registered in the list of changes of the parse
2196  tree and do not harm PS/SP re-execution.
2197 
2198  Item equal objects are employed only at the optimize phase. Usually they are
2199  not supposed to be evaluated. Yet in some cases we call the method val_int()
2200  for them. We have to take care of restricting the predicate such an
2201  object represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.
2202 */
2204  List<Item_field> fields; /* list of equal field items */
2205  Item *const_item; /* optional constant item equal to fields items */
2210 
2211  public:
2212  inline Item_equal()
2213  : Item_bool_func(), const_item(0), eval_item(0), cond_false(0) {}
2214  Item_equal(Item_field *f1, Item_field *f2);
2215  Item_equal(Item *c, Item_field *f);
2216  Item_equal(Item_equal *item_equal);
2217  ~Item_equal() override { destroy(eval_item); }
2218 
2219  inline Item *get_const() { return const_item; }
2220  void set_const(Item *c) { const_item = c; }
2221  bool compare_const(THD *thd, Item *c);
2222  bool add(THD *thd, Item *c, Item_field *f);
2223  bool add(THD *thd, Item *c);
2224  void add(Item_field *f);
2225  uint members();
2226  bool contains(Field *field);
2227  /**
2228  Get the first field of multiple equality, use for semantic checking.
2229 
2230  @retval First field in the multiple equality.
2231  */
2232  Item_field *get_first() { return fields.head(); }
2233  Item_field *get_subst_item(const Item_field *field);
2234  bool merge(THD *thd, Item_equal *item);
2235  bool update_const(THD *thd);
2236  enum Functype functype() const override { return MULT_EQUAL_FUNC; }
2237  longlong val_int() override;
2238  const char *func_name() const override { return "multiple equal"; }
2239  optimize_type select_optimize(const THD *) override { return OPTIMIZE_EQUAL; }
2240  /**
2241  Order field items in multiple equality according to a sorting criteria.
2242 
2243  The function perform ordering of the field items in the Item_equal
2244  object according to the criteria determined by the cmp callback parameter.
2245  If cmp(item_field1,item_field2,arg)<0 than item_field1 must be
2246  placed after item_field2.
2247 
2248  The function sorts field items by the exchange sort algorithm.
2249  The list of field items is looked through and whenever two neighboring
2250  members follow in a wrong order they are swapped. This is performed
2251  again and again until we get all members in a right order.
2252 
2253  @param compare function to compare field item
2254  */
2255  template <typename Node_cmp_func>
2256  void sort(Node_cmp_func compare) {
2257  fields.sort(compare);
2258  }
2259  friend class Item_equal_iterator;
2260  bool resolve_type(THD *) override;
2261  bool fix_fields(THD *thd, Item **ref) override;
2262  void update_used_tables() override;
2263  bool walk(Item_processor processor, enum_walk walk, uchar *arg) override;
2264  Item *transform(Item_transformer transformer, uchar *arg) override;
2265  void print(const THD *thd, String *str,
2266  enum_query_type query_type) const override;
2267  const CHARSET_INFO *compare_collation() const override {
2268  return fields.head()->collation.collation;
2269  }
2270 
2271  bool equality_substitution_analyzer(uchar **) override { return true; }
2272 
2274 
2275  float get_filtering_effect(THD *thd, table_map filter_for_table,
2276  table_map read_tables,
2277  const MY_BITMAP *fields_to_ignore,
2278  double rows_in_table) override;
2279  Item *m_const_folding[2]; ///< temporary area used for constant folding
2280  private:
2282 };
2283 
2284 class COND_EQUAL {
2285  public:
2286  uint max_members; /* max number of members the current level
2287  list and all lower level lists */
2288  COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */
2289  List<Item_equal> current_level; /* list of multiple equalities of
2290  the current and level */
2292 };
2293 
2294 class Item_equal_iterator : public List_iterator_fast<Item_field> {
2295  public:
2296  inline Item_equal_iterator(Item_equal &item_equal)
2297  : List_iterator_fast<Item_field>(item_equal.fields) {}
2298  inline Item_field *operator++(int) {
2299  Item_field *item = (*(List_iterator_fast<Item_field> *)this)++;
2300  return item;
2301  }
2303 };
2304 
2306  public:
2307  COND_EQUAL cond_equal; /* contains list of Item_equal objects for
2308  the current and level and reference
2309  to multiple equalities of upper and levels */
2311 
2312  Item_cond_and(Item *i1, Item *i2) : Item_cond(i1, i2) {}
2313  Item_cond_and(const POS &pos, Item *i1, Item *i2) : Item_cond(pos, i1, i2) {}
2314 
2315  Item_cond_and(THD *thd, Item_cond_and *item) : Item_cond(thd, item) {}
2316  Item_cond_and(List<Item> &list_arg) : Item_cond(list_arg) {}
2317  enum Functype functype() const override { return COND_AND_FUNC; }
2318  longlong val_int() override;
2319  const char *func_name() const override { return "and"; }
2320  Item *copy_andor_structure(THD *thd) override {
2321  Item_cond_and *item;
2322  if ((item = new Item_cond_and(thd, this)))
2323  item->copy_andor_arguments(thd, this);
2324  return item;
2325  }
2326  Item *truth_transformer(THD *, Bool_test) override;
2327  bool gc_subst_analyzer(uchar **) override { return true; }
2328 
2329  float get_filtering_effect(THD *thd, table_map filter_for_table,
2330  table_map read_tables,
2331  const MY_BITMAP *fields_to_ignore,
2332  double rows_in_table) override;
2333 };
2334 
2335 class Item_cond_or final : public Item_cond {
2336  public:
2338 
2339  Item_cond_or(Item *i1, Item *i2) : Item_cond(i1, i2) {}
2340  Item_cond_or(const POS &pos, Item *i1, Item *i2) : Item_cond(pos, i1, i2) {}
2341 
2342  Item_cond_or(THD *thd, Item_cond_or *item) : Item_cond(thd, item) {}
2343  Item_cond_or(List<Item> &list_arg) : Item_cond(list_arg) {}
2344  enum Functype functype() const override { return COND_OR_FUNC; }
2345  longlong val_int() override;
2346  const char *func_name() const override { return "or"; }
2347  Item *copy_andor_structure(THD *thd) override {
2348  Item_cond_or *item;
2349  if ((item = new Item_cond_or(thd, this)))
2350  item->copy_andor_arguments(thd, this);
2351  return item;
2352  }
2353  Item *truth_transformer(THD *, Bool_test) override;
2354  bool gc_subst_analyzer(uchar **) override { return true; }
2355 
2356  float get_filtering_effect(THD *thd, table_map filter_for_table,
2357  table_map read_tables,
2358  const MY_BITMAP *fields_to_ignore,
2359  double rows_in_table) override;
2360 };
2361 
2362 /// Builds condition: (a AND b) IS TRUE
2363 inline Item *and_conds(Item *a, Item *b) {
2364  if (!b) return a;
2365  if (!a) return b;
2366 
2367  Item *item = new Item_cond_and(a, b);
2368  if (item == nullptr) return nullptr;
2369  item->apply_is_true();
2370  return item;
2371 }
2372 
2373 longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
2374  const Item *warn_item, bool *is_null);
2375 
2376 // TODO: the next two functions should be moved to sql_time.{h,cc}
2377 bool get_mysql_time_from_str_no_warn(THD *thd, String *str, MYSQL_TIME *l_time,
2379 
2380 bool get_mysql_time_from_str(THD *thd, String *str,
2381  enum_mysql_timestamp_type warn_type,
2382  const char *warn_name, MYSQL_TIME *l_time);
2383 /*
2384  These need definitions from this file but the variables are defined
2385  in mysqld.h. The variables really belong in this component, but for
2386  the time being we leave them in mysqld.cc to avoid merge problems.
2387 */
2388 extern Eq_creator eq_creator;
2390 extern Ne_creator ne_creator;
2391 extern Gt_creator gt_creator;
2392 extern Lt_creator lt_creator;
2393 extern Ge_creator ge_creator;
2394 extern Le_creator le_creator;
2395 
2396 #endif /* ITEM_CMPFUNC_INCLUDED */
Definition: item.h:735
bool list_contains_null()
Usable if <in value list> is made only of constants.
Definition: item_cmpfunc.cc:4460
bool contains(Field *field)
Check whether a field is referred in the multiple equality.
Definition: item_cmpfunc.cc:6205
enum Item_result result_type() const override
Definition: item_cmpfunc.h:1206
virtual int cmp(Item *arg)
Definition: item_cmpfunc.h:1539
optimize_type select_optimize(const THD *thd) override
We can optimize a where if first character isn&#39;t a wildcard.
Definition: item_cmpfunc.cc:5748
Definition: item_func.h:159
bool val_json(Json_wrapper *wr) override
Get the result of COALESCE as a JSON value.
Definition: item_cmpfunc.cc:3675
int compare_time_packed()
Compare arguments using numeric packed temporal representation.
Definition: item_cmpfunc.cc:1646
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1141
Item *(Item::* Item_transformer)(uchar *arg)
Definition: item.h:663
Definition: item_cmpfunc.h:2335
const CHARSET_INFO * cmp_charset
Definition: item_cmpfunc.h:1518
Item_result result_type() const override
Definition: item_cmpfunc.h:1229
Definition: item.h:3349
unsigned long long int ulonglong
Definition: my_inttypes.h:74
cmp_item_string(const CHARSET_INFO *cs)
Definition: item_cmpfunc.h:1521
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:5597
not valid for UDFs
Definition: udf_registration_types.h:44
Item_result left_result_type
Definition: item_cmpfunc.h:1753
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:1985
DTCollation cmp_collation
Definition: item_cmpfunc.h:1675
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:1929
enum Functype functype() const override
Definition: item_cmpfunc.h:1722
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:2026
const Item * warn_item
Definition: item_cmpfunc.h:1606
This file contains the field type.
Item_cond(const POS &pos, Item *i1, Item *i2)
Definition: item_cmpfunc.h:2077
in_expr [NOT] IN (in_value_list).
Definition: item_cmpfunc.h:1736
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:531
int compare_row()
Definition: item_cmpfunc.cc:1736
bool equality_substitution_analyzer(uchar **) override
Definition: item_cmpfunc.h:2126
virtual double val_real()=0
int compare(const cmp_item *ci) const override
Definition: item_cmpfunc.cc:4312
Definition: item_func.h:125
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6091
Item_cond(List< Item > &nlist)
Definition: item_cmpfunc.h:2084
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:438
void val_item(Item *item, packed_longlong *result) override
Definition: item_cmpfunc.cc:4004
void update_used_tables() override
Definition: item_cmpfunc.cc:5319
unsigned char uchar
Definition: my_inttypes.h:51
static Item_row * alloc_row(const POS &pos, MEM_ROOT *mem_root, Item *expr1, Item *expr2, class PT_item_list *opt_expr_list)
Definition: item_cmpfunc.cc:2429
enum Functype functype() const override
Definition: item_cmpfunc.h:1948
Item_func_coalesce(const POS &pos, PT_item_list *list)
Definition: item_cmpfunc.h:1132
List< Item_field > fields
Definition: item_cmpfunc.h:2204
static const Bool_test bool_transform[10][8]
Array that transforms a boolean test according to another.
Definition: item_cmpfunc.h:211
Definition: item.h:3134
Definition: sql_optimizer.h:177
Definition: item.h:4057
Our own string classes, used pervasively throughout the executor.
bool fix_fields(THD *, Item **) override
Definition: item_cmpfunc.cc:1944
const char * func_name() const override
Definition: item_cmpfunc.h:252
void print(const THD *thd, String *str, enum_query_type query_type) const override
Appends function name and arguments list to the String str.
Definition: item_cmpfunc.cc:2510
Definition: item_cmpfunc.h:770
optimize_type
Definition: item_func.h:213
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_cmpfunc.cc:3710
longlong val_int() override
Definition: item_cmpfunc.cc:2858
A predicate that is "always true" or "always false".
Definition: item_cmpfunc.h:227
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:321
Item_func super
Definition: item_cmpfunc.h:1668
longlong value
Definition: item_cmpfunc.h:1575
t pos
Definition: dbug_analyze.cc:148
const char * func_name() const override
Definition: item_cmpfunc.h:389
Item_result
Type of the user defined function return slot and arguments
Definition: udf_registration_types.h:38
Definition: item_cmpfunc.h:478
const char * func_name() const override
Definition: item_cmpfunc.h:829
uint decimal_precision() const override
Definition: item_cmpfunc.h:1111
Item_in_optimizer(Item *a, Item_in_subselect *b)
Definition: item_cmpfunc.h:375
const uint count
Original size of the vector.
Definition: item_cmpfunc.h:1255
Item_cond_or(List< Item > &list_arg)
Definition: item_cmpfunc.h:2343
ulonglong table_map
Definition: my_table_map.h:32
Definition: item.h:754
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:328
Item_func_false(const POS &pos)
Definition: item_cmpfunc.h:265
uint decimal_precision() const override
Definition: item_cmpfunc.h:1057
Item_bool_func2 super
Definition: item_cmpfunc.h:578
enum Functype functype() const override
Definition: item_cmpfunc.h:1797
Item_func_between(const POS &pos, Item *a, Item *b, Item *c, bool is_negation)
Definition: item_cmpfunc.h:1038
Item_func_false()
Definition: item_cmpfunc.h:264
uint used_count
The actual size of the vector (NULL may be ignored)
Definition: item_cmpfunc.h:1257
virtual Item_basic_constant * create_item(MEM_ROOT *mem_root) const =0
Create an instance of Item_{type} (e.g.
longlong val_int() override
Definition: item_cmpfunc.h:268
Item * equality_substitution_transformer(uchar *arg) override
Transform an Item_equal object after having added a table that represents a materialized semi-join...
Definition: item_cmpfunc.cc:6705
Definition: item_func.h:161
Item * truth_transformer(THD *, Bool_test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.cc:6031
longlong val_int() override
Definition: item_cmpfunc.cc:4828
cmp_item_datetime(const Item *warn_item_arg)
Definition: item_cmpfunc.cc:4282
bool basic_const_item() const override
Definition: item_cmpfunc.h:242
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:850
void value_to_item(uint pos, Item_basic_constant *item) const override
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:1440
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:2354
bool try_year_cmp_func(Item_result type)
Definition: item_cmpfunc.cc:1195
bool get_mysql_time_from_str(THD *thd, String *str, enum_mysql_timestamp_type warn_type, const char *warn_name, MYSQL_TIME *l_time)
Parse date provided in a string to a MYSQL_TIME.
Definition: item_cmpfunc.cc:838
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:902
void check_covering_prefix_keys()
Item_result cmp_type
Definition: item_cmpfunc.h:1029
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2762
Arg_comparator(Item **a1, Item **a2)
Definition: item_cmpfunc.h:120
Definition: item_func.h:192
cmp_item_row()
Definition: item_cmpfunc.h:1849
Definition: item_func.h:137
virtual bool find_item(Item *item)=0
Calls item->val_int() or item->val_str() etc.
virtual Item_bool_func * create_scalar_predicate(Item *a, Item *b) const =0
Creates only an item tree node, without attempting to rewrite row constructors.
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2296
enum Item_result cached_result_type left_result_type
Definition: item_cmpfunc.h:1671
bool merge(THD *thd, Item_equal *item)
Join members of another Item_equal object.
Definition: item_cmpfunc.cc:6229
Item_cond_and(Item *i1, Item *i2)
Definition: item_cmpfunc.h:2312
int cmp
Definition: dbug_analyze.cc:237
void replace_argument(THD *thd, Item **oldpp, Item *newp) override
Does essentially the same as THD::change_item_tree, plus maintains any necessary any invariants...
Definition: item_cmpfunc.cc:2219
virtual Item_bool_func * create_scalar_predicate(Item *a, Item *b) const
Creates only an item tree node, without attempting to rewrite row constructors.
Definition: item_cmpfunc.cc:294
bool is_null() override
Definition: item_cmpfunc.cc:6109
bool check_covering_prefix_keys(THD *thd)
The method updates covering keys depending on the length of wild string prefix.
Definition: item_cmpfunc.cc:5763
Item_func_in(const POS &pos, PT_item_list *list, bool is_negation)
Definition: item_cmpfunc.h:1757
Item_func_comparison is a class for comparison functions that take two arguments and return a boolean...
Definition: item_cmpfunc.h:556
Item_func_isnull(const POS &pos, Item *a)
Definition: item_cmpfunc.h:1911
my_decimal * val_decimal(my_decimal *) override
Definition: item_cmpfunc.cc:3273
Arg_comparator le_cmp
Definition: item_cmpfunc.h:1037
Item_bool_func super
Definition: item_cmpfunc.h:279
Json_scalar_holder m_holder
Cache for the value above.
Definition: item_cmpfunc.h:1559
Definition: item_cmpfunc.h:1216
Definition: item.h:3988
bool subst_argument_checker(uchar **) override
Definition: item_cmpfunc.h:2120
void fix_char_length(uint32 max_char_length_arg)
Definition: item.h:2489
longlong val_int() override
Definition: item_cmpfunc.cc:3149
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:418
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_cmpfunc.cc:3425
int compare_real()
Definition: item_cmpfunc.cc:1571
Item_func_gt(Item *a, Item *b)
Definition: item_cmpfunc.h:915
Item_func_comparison(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:561
Definition: item_func.h:129
File containing constants that can be used throughout the server.
virtual int compare(const cmp_item *ci) const
Definition: item_cmpfunc.cc:4118
bool compare_null_values()
Compare NULL values for two arguments.
Definition: item_cmpfunc.cc:1827
const char * func_name() const override
Definition: item_cmpfunc.h:1980
bool unsigned_flag
Definition: item.h:2737
Item_func_if(Item *a, Item *b, Item *c)
Definition: item_cmpfunc.h:1190
Some integer typedefs for easier portability.
Definition: item_cmpfunc.h:1475
Item * m_const_folding[2]
temporary area used for constant folding
Definition: item_cmpfunc.h:2279
virtual Item_bool_func * create(Item *a, Item *b) const
Definition: item_cmpfunc.cc:316
bool val_json(Json_wrapper *result) override
Get the result of COALESCE as a JSON value.
Definition: item_cmpfunc.cc:3037
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:899
char value_buff[STRING_BUFFER_USUAL_SIZE]
Definition: item_cmpfunc.h:1516
longlong val_int() override
Evaluation of AND(expr, expr, expr ...).
Definition: item_cmpfunc.cc:5404
bool ignore_unknown() const
Definition: item_cmpfunc.h:1015
longlong val_int() override
Definition: item_cmpfunc.cc:2375
bool is_bool_func() const override
Definition: item_cmpfunc.h:197
Item_func_nop_all(Item *a)
Definition: item_cmpfunc.h:827
void rewind(void)
Definition: sql_list.h:594
longlong val_int() override
Definition: item_cmpfunc.cc:5717
bool set_compare_func(Item_result_field *owner, Item_result type)
Definition: item_cmpfunc.cc:708
A wrapper class which provides array bounds checking.
Definition: sql_array.h:41
bool val_bool() override
Definition: item_cmpfunc.h:267
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_cmpfunc.cc:3285
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:844
const char * func_name() const override
Definition: item_cmpfunc.h:1168
Definition: item_func.h:126
double value
Definition: item_cmpfunc.h:1620
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:787
Gt_creator gt_creator
Definition: mysqld.cc:1304
void fix_after_pullout(SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion.
Definition: item_cmpfunc.cc:1982
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6096
Definition: item_func.h:141
bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Definition: item_cmpfunc.cc:3049
Implements the comparison operator less than or equals (<=)
Definition: item_cmpfunc.h:933
XOR inherits from Item_bool_func2 because it is not optimized yet.
Definition: item_cmpfunc.h:577
Item_row * row
Definition: item_cmpfunc.h:1094
virtual void apply_is_true()
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item.h:1920
in_vector(uint elements)
See Item_func_in::resolve_type() for why we need both count and used_count.
Definition: item_cmpfunc.h:1263
Item_field * get_first()
Get the first field of multiple equality, use for semantic checking.
Definition: item_cmpfunc.h:2232
uint ncases
Definition: item_cmpfunc.h:1673
bool copy()
Definition: sql_string.cc:191
A class that is capable of holding objects of any sub-type of Json_scalar.
Definition: json_dom.h:1856
int compare_string()
Definition: item_cmpfunc.cc:1510
Definition: item_func.h:136
bool compare_as_dates_with_strings
Definition: item_cmpfunc.h:1032
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_cmpfunc.cc:3190
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5477
virtual Item_bool_func * combine(List< Item > list) const
Combines a list of conditions exp op exp.
Definition: item_cmpfunc.cc:299
Le_creator()
Definition: item_cmpfunc.h:490
Eq_creator eq_creator
Definition: mysqld.cc:1301
virtual ~Gt_creator()
Definition: item_cmpfunc.h:461
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.h:1078
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:1981
Item_cond_or(THD *thd, Item_cond_or *item)
Definition: item_cmpfunc.h:2342
virtual float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table)
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item.h:1579
bool time_op(MYSQL_TIME *ltime) override
Definition: item_cmpfunc.cc:3729
Definition: item_cmpfunc.h:488
int compare(const cmp_item *arg) const
Definition: item_cmpfunc.cc:4251
virtual Item_bool_func * create(Item *a, Item *b) const
Definition: item_cmpfunc.cc:324
Item_cond_and(const POS &pos, Item *i1, Item *i2)
Definition: item_cmpfunc.h:2313
bool(Item::* Item_analyzer)(uchar **argp)
Definition: item.h:662
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.h:640
void fix_after_pullout(SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion.
Definition: item_cmpfunc.cc:3113
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:1058
bool escape_used_in_parsing
Definition: item_cmpfunc.h:2002
longlong val_int() override
Special NOP (No OPeration) for ALL subquery.
Definition: item_cmpfunc.cc:435
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:847
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1361
String value2
Definition: item_cmpfunc.h:1030
enum Item_result result_type() const override
Definition: item_cmpfunc.h:1713
virtual cmp_item * make_same()
Definition: item_cmpfunc.cc:4114
Implements the comparison operator greater than (>)
Definition: item_cmpfunc.h:913
Definition: field.h:709
Definition: item_func.h:123
in_longlong(MEM_ROOT *mem_root, uint elements)
Definition: item_cmpfunc.h:1359
const char * func_name() const override
Definition: item_cmpfunc.h:1917
Item * transform(Item_transformer transformer, uchar *arg) override
Transform an Item_cond object with a transformer callback function.
Definition: item_cmpfunc.cc:5220
Item_equal()
Definition: item_cmpfunc.h:2212
Definition: item_func.h:81
int compare(const cmp_item *ci) const override
Definition: item_cmpfunc.h:1587
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:1960
Definition: item.h:5685
Definition: field_types.h:68
virtual bool l_op() const
Definition: item_cmpfunc.h:465
in_double(MEM_ROOT *mem_root, uint elements)
Definition: item_cmpfunc.h:1435
Gt_creator()
Definition: item_cmpfunc.h:460
Definition: item.h:4200
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:845
Implements the comparison operator equals (=)
Definition: item_cmpfunc.h:837
Json_wrapper m_value
Cached JSON value to look up.
Definition: item_cmpfunc.h:1557
bool eval_escape_clause(THD *thd)
Evaluate the expression in the escape clause.
Definition: item_cmpfunc.cc:5839
Definition: item_cmpfunc.h:1186
const char * func_name() const override
Definition: item_cmpfunc.h:980
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:1925
String * value_res
Definition: item_cmpfunc.h:1515
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5645
Definition: item_cmpfunc.h:498
Item_equal_iterator(Item_equal &item_equal)
Definition: item_cmpfunc.h:2296
Definition: item_cmpfunc.h:362
const char * func_name() const override
Definition: item_cmpfunc.h:2027
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_cmpfunc.cc:5180
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:978
virtual longlong val_int()=0
Definition: item_cmpfunc.h:2063
int escape
Definition: item_cmpfunc.h:2008
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352
int result_for_null_param
Definition: item_cmpfunc.h:372
Item_bool_func(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:191
virtual bool l_op() const
Definition: item_cmpfunc.h:495
COND_EQUAL * upper_levels
Definition: item_cmpfunc.h:2288
const char * func_name() const override
Definition: item_cmpfunc.h:2346
Item_func_le(Item *a, Item *b)
Definition: item_cmpfunc.h:935
uint decimal_precision() const override
Definition: item_cmpfunc.cc:3134
const char * func_name() const override
Definition: item_cmpfunc.h:900
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:469
Item * truth_transformer(THD *, Bool_test test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.h:286
bool is_bool_func() const override
Definition: item_cmpfunc.h:1053
void set_sub_test(Item_maxmin_subselect *item)
Definition: item_cmpfunc.h:796
A predicate that is "always false".
Definition: item_cmpfunc.h:262
bool add(Item *item)
Definition: item_cmpfunc.h:2086
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:1866
bool get_time(MYSQL_TIME *ltime) override
Definition: item_cmpfunc.cc:3452
const char * func_name() const override
Definition: item_cmpfunc.h:881
Item_func_isnull(Item *a)
Definition: item_cmpfunc.h:1910
Item_result type
Definition: item_cmpfunc.h:1086
const char * func_name() const override
Definition: item_cmpfunc.h:2319
Lt_creator lt_creator
Definition: mysqld.cc:1305
Item_subselect * subselect
Definition: item_cmpfunc.h:774
Item_func_like(Item *a, Item *b, Item *escape_arg, bool escape_used)
Definition: item_cmpfunc.h:2010
Definition: item_cmpfunc.h:1601
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5674
Item * lval_cache
Definition: item_cmpfunc.h:1415
bool cond_false
Definition: item_cmpfunc.h:2208
void value_to_item(uint pos, Item_basic_constant *item) const override
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:1337
virtual bool l_op() const
Definition: item_cmpfunc.h:413
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:5667
String * str_op(String *) override
Coalesce - return first not NULL argument.
Definition: item_cmpfunc.cc:3664
std::string join(Container cont, const std::string &delim)
join elements of an container into a string seperated by a delimiter.
Definition: string.h:144
virtual Item_bool_func * create(Item *a, Item *b) const =0
virtual ~Comp_creator()
Definition: item_cmpfunc.h:399
void val_item(Item *item, packed_longlong *result) override
Definition: item_cmpfunc.cc:4024
int get_else_expr_num() const
Definition: item_cmpfunc.h:1702
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:2938
bool add_at_head(Item *item)
Definition: item_cmpfunc.h:2090
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1422
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:942
cmp_item_decimal()
Definition: item_cmpfunc.h:1643
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:2327
List< Item > * argument_list()
Definition: item_cmpfunc.h:2106
bool escape_was_used_in_parsing() const
Definition: item_cmpfunc.h:2035
virtual uint decimal_precision() const
Definition: item.cc:605
class udf_list * list
void set_str_value(String *str)
Definition: item.h:2863
void update_used_tables() override
Optimize case of not_null_column IS NULL.
Definition: item_cmpfunc.cc:5629
const CHARSET_INFO * collation
Definition: item_cmpfunc.h:1330
longlong val_int() override
Definition: item_cmpfunc.h:254
int else_expr_num
Definition: item_cmpfunc.h:1670
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2315
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5364
DBUG_VOID_RETURN
Definition: dbug_analyze.cc:151
in_vector * array
An array of values, created when the bisection lookup method is used.
Definition: item_cmpfunc.h:1739
This trigger type deactivates join conditions when a row has been NULL-complemented.
Definition: item_cmpfunc.h:688
virtual int compare(const cmp_item *item) const =0
bool get_time(MYSQL_TIME *ltime) override
Definition: item_cmpfunc.cc:3205
#define RAND_TABLE_BIT
Definition: sql_const.h:114
enum_walk
Enumeration for {Item,SELECT_LEX[_UNIT],Table_function}walk.
Definition: sql_const.h:434
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2260
bool itemize(Parse_context *pc, Item **res) override
Contextualization for Item_cond functional items.
Definition: item_cmpfunc.cc:4916
Definition: item_func.h:214
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:463
void set_numeric_type() override
Definition: item_cmpfunc.h:1148
const char * func_name() const override
Definition: item_cmpfunc.h:1181
DTCollation cmp_collation
Definition: item_cmpfunc.h:107
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Get filtering effect for multiple equalities, i.e.
Definition: item_cmpfunc.cc:6316
void value_to_item(uint, Item_basic_constant *) const override
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:1892
Item_bool_func(Item *a)
Definition: item_cmpfunc.h:185
arg_cmp_func func
Definition: item_cmpfunc.h:76
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_cmpfunc.cc:3688
cmp_item_real()
Definition: item_cmpfunc.h:1623
cmp_item_row(cmp_item_row &&other)
Definition: item_cmpfunc.h:1855
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:96
double val_real() override
Definition: item_cmpfunc.cc:3141
const char * func_name() const override
Definition: item_cmpfunc.h:1234
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:979
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:1800
int compare_int_signed_unsigned()
Compare signed (*a) with unsigned (*B)
Definition: item_cmpfunc.cc:1701
bool compare_elems(uint pos1, uint pos2) const override
Compare values number pos1 and pos2 for equality.
Definition: item_cmpfunc.cc:3912
Definition: item_subselect.h:73
void add_trig_func_tables()
Definition: item_cmpfunc.h:749
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:30
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:919
int compare()
Definition: item_cmpfunc.h:144
Definition: item_cmpfunc.h:1324
enum Functype functype() const override
Definition: item_cmpfunc.h:1974
void split_sum_func(THD *thd, Ref_item_array ref_item_array, List< Item > &fields) override
Move SUM items out from item tree and replace with reference.
Definition: item_cmpfunc.cc:5311
virtual cmp_item * make_same()
Definition: item_cmpfunc.cc:4102
bool m_created_by_in2exists
True <=> this item was added by IN->EXISTS subquery transformation, and should thus be deleted if we ...
Definition: item_cmpfunc.h:218
void store_value(Item *item) override
Definition: item_cmpfunc.h:1624
enum Functype functype() const override
Definition: item_cmpfunc.h:843
longlong val_int() override
Definition: item_cmpfunc.cc:5447
const char * func_name() const override
Definition: item_cmpfunc.h:2238
void set_null_value(bool nv)
Definition: item_cmpfunc.h:1510
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:159
~cmp_item_row()
Definition: item_cmpfunc.cc:4151
bool fix_left(THD *thd, Item **ref)
Definition: item_cmpfunc.cc:1916
bool escape_evaluated
Tells if the escape clause has been evaluated.
Definition: item_cmpfunc.h:2004
Definition: item.h:716
enum_trig_type get_trig_type()
Definition: item_cmpfunc.h:764
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:2114
const char * func_name() const override
Definition: item_cmpfunc.h:940
in_datetime(MEM_ROOT *mem_root, Item *warn_item_arg, uint elements)
Definition: item_cmpfunc.h:1418
const char * func_name() const override
Definition: item_cmpfunc.h:920
const char * func_name() const override
Definition: item_cmpfunc.h:960
longlong val_int() override
Execute Item_func_interval().
Definition: item_cmpfunc.cc:2530
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6076
enum Functype functype() const override
Definition: item_cmpfunc.h:897
void update_used_tables() override
Definition: item_cmpfunc.cc:5462
int get_first_expr_num() const
Definition: item_cmpfunc.h:1701
Definition: item_cmpfunc.h:1619
bool resolve_type(THD *thd) override
Same as Item_func_eq, but NULL = NULL.
Definition: item_cmpfunc.cc:2242
Item_field ** ref(void)
Definition: sql_list.h:587
DTCollation cmp_collation
Definition: item_cmpfunc.h:1026
interval_range * intervals
Definition: item_cmpfunc.h:1096
Definition: table.h:1294
cmp_item * cmp_items[5]
Definition: item_cmpfunc.h:1676
void cleanup() override
Definition: item_cmpfunc.cc:5828
longlong val_int() override
Definition: item_cmpfunc.cc:1883
String value0
Definition: item_cmpfunc.h:1030
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:1014
Item * truth_transformer(THD *, Bool_test test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.h:1016
table_map used_tables() const override
Definition: item_cmpfunc.h:2108
Field * tmp_table_field()
Definition: item_func.h:394
enum_trig_type
Definition: item_cmpfunc.h:682
Json_scalar_holder m_itm_holder
Scalar holder for the RHS value.
Definition: item_cmpfunc.h:1563
void value_to_item(uint pos, Item_basic_constant *item) const override
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:1368
bool find_item(Item *item) override
Calls item->val_int() or item->val_str() etc.
Definition: item_cmpfunc.cc:3904
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:2671
int compare_binary_string()
Compare strings byte by byte.
Definition: item_cmpfunc.cc:1544
Definition: item_cmpfunc.h:1874
String value2
Definition: item_cmpfunc.h:109
Structure to return status from str_to_datetime(), str_to_time(), number_to_datetime(), number_to_time()
Definition: my_time.h:143
cond_result
Definition: item.h:735
longlong val_int() override
special NOT for ALL subquery.
Definition: item_cmpfunc.cc:386
Item * const_item
Definition: item_cmpfunc.h:2205
Definition: item_func.h:120
enum Item_result result_type() const override
Definition: item_cmpfunc.h:1149
void resize_and_sort() override
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
Definition: item_cmpfunc.cc:3874
virtual void val_item(Item *item, packed_longlong *result)
Definition: item_cmpfunc.cc:3999
Definition: item_func.h:138
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:375
in_row(MEM_ROOT *mem_root, uint elements, cmp_item_row *cmp)
Definition: item_cmpfunc.cc:3982
bool subst_argument_checker(uchar **) override
Definition: item_cmpfunc.h:568
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:429
Mem_root_array< cmp_item_row > base_objects
Definition: item_cmpfunc.h:1876
Item_func_match_predicate(Item *a)
Definition: item_cmpfunc.h:630
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:939
In IN->EXISTS subquery transformation, new predicates are added: WHERE inner_field=outer_field OR inn...
Definition: item_cmpfunc.h:706
Definition: item_cmpfunc.h:436
void fix_after_pullout(SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion.
Definition: item_cmpfunc.cc:2637
Item_func_xor(Item *i1, Item *i2)
Definition: item_cmpfunc.h:581
virtual ~cmp_item()
Definition: item_cmpfunc.h:1478
Ge_creator ge_creator
Definition: mysqld.cc:1306
String value
Definition: item_cmpfunc.h:1517
virtual void store_value(Item *item)
Definition: item_cmpfunc.h:1529
Item_func_ne(Item *a, Item *b)
Definition: item_cmpfunc.h:975
virtual Item_bool_func * create_scalar_predicate(Item *a, Item *b) const
Creates only an item tree node, without attempting to rewrite row constructors.
Definition: item_cmpfunc.cc:303
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6081
cmp_item * case_item
Definition: item_cmpfunc.h:1677
cmp_item * make_same()
Definition: item_cmpfunc.cc:4112
bool is_null() override
Definition: item_cmpfunc.cc:2164
int8 plan_idx
This represents the index of a JOIN_TAB/QEP_TAB in an array.
Definition: sql_opt_exec_shared.h:39
Item * lval_cache
Definition: item_cmpfunc.h:1608
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:3211
Item_func_equal(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:872
A predicate that is "always true".
Definition: item_cmpfunc.h:248
uint members()
Definition: item_cmpfunc.cc:6190
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:958
enum Functype functype() const override
Definition: item_cmpfunc.h:878
void set_datetime_cmp_func(Item_result_field *owner_arg, Item **a1, Item **b1)
Definition: item_cmpfunc.cc:1253
String value1
Definition: item_cmpfunc.h:1030
bool find_item(Item *item) override
Calls item->val_int() or item->val_str() etc.
Definition: item_cmpfunc.cc:3970
bool fix_fields(THD *, Item **ref) override
Definition: item_func.cc:258
virtual bool l_op() const
Definition: item_cmpfunc.h:485
virtual int cmp(Item *arg)
Definition: item_cmpfunc.cc:4135
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:898
bool fix_fields(THD *, Item **) override
Perform context analysis of an IN item tree.
Definition: item_cmpfunc.cc:4496
cmp_item_json()
Definition: item_cmpfunc.h:1566
virtual void value_to_item(uint pos, Item_basic_constant *item) const =0
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:179
Item_func_like(const POS &pos, Item *a, Item *b, Item *opt_escape_arg)
Definition: item_cmpfunc.h:2015
longlong val_int() override
Definition: item_cmpfunc.h:632
Item * b_cache
Definition: item_cmpfunc.h:82
longlong(* get_value_a_func)(THD *thd, Item ***item_arg, Item **cache_arg, const Item *warn_item, bool *is_null)
Definition: item_cmpfunc.h:85
enum_trig_type trig_type
Type of trig_var; for printing.
Definition: item_cmpfunc.h:717
Definition: item_func.h:216
#define DBUG_ASSERT(A)
Definition: my_dbug.h:183
in_decimal(MEM_ROOT *mem_root, uint elements)
Definition: item_cmpfunc.h:1455
void store_value_by_template(cmp_item *tmpl, Item *)
Definition: item_cmpfunc.cc:4206
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:4342
Arg_comparator * comparators
Definition: item_cmpfunc.h:78
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.h:1975
bool is_alloced() const
Definition: sql_string.h:397
Item_bool_func(const POS &pos, Item *a)
Definition: item_cmpfunc.h:186
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:2239
Definition: item_cmpfunc.h:74
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:2650
enum Functype functype() const override
Definition: item_cmpfunc.h:957
void keep_top_level_cache()
Definition: item_cmpfunc.cc:2152
Definition: item_cmpfunc.h:2203
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:879
Item_cache ** get_cache()
Definition: item_cmpfunc.h:390
Item_func_truth(const POS &pos, Item *a, Bool_test truth_test)
Definition: item_cmpfunc.h:295
longlong val_int() override
Definition: item_cmpfunc.cc:354
plan_idx idx() const
Definition: item_cmpfunc.h:767
Item_func_any_value(const POS &pos, Item *a)
Definition: item_cmpfunc.h:1180
bool truth_transform_arguments(THD *thd, Bool_test test)
Definition: item_cmpfunc.cc:5349
int compare_int_signed()
Definition: item_cmpfunc.cc:1628
virtual bool eqne_op() const
Definition: item_cmpfunc.h:484
bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Definition: item_cmpfunc.cc:3721
bool fix_fields(THD *, Item **) override
Perform context analysis of a BETWEEN item tree.
Definition: item_cmpfunc.cc:2621
Definition: item.h:2840
Mem_root_array< String > base_objects
Definition: item_cmpfunc.h:1327
bool set_cmp_func()
Definition: item_cmpfunc.h:517
longlong val_int() override
Definition: item_cmpfunc.cc:3376
bool append(const String &s)
Definition: sql_string.cc:449
Definition: item_cmpfunc.h:1350
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:6558
void print(const THD *, String *str, enum_query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:255
void val_item(Item *item, packed_longlong *result) override
Definition: item_cmpfunc.cc:4009
virtual ~Ge_creator()
Definition: item_cmpfunc.h:481
void store_value(Item *item)
Definition: item_cmpfunc.cc:4260
Mem_root_array< double > base
Definition: item_cmpfunc.h:1432
void set_arguments(List< Item > &list, bool context_free)
Copy arguments from list to args array.
Definition: item_func.cc:168
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6086
#define DBUG_ENTER(a)
Definition: my_dbug.h:135
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:667
Definition: item.h:4103
enum enum_trig_type get_trig_type() const
Definition: item_cmpfunc.h:762
Definition: item_func.h:131
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:451
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:3737
virtual ~Lt_creator()
Definition: item_cmpfunc.h:471
int cmp(Item *arg)
Definition: item_cmpfunc.cc:4227
const char * func_name() const override
Definition: item_cmpfunc.h:634
bool equality_substitution_analyzer(uchar **) override
Definition: item_cmpfunc.h:848
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:483
void store_value(Item *item)
Definition: item_cmpfunc.cc:4192
Implements the comparison operator not equals (<>)
Definition: item_cmpfunc.h:973
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_cmpfunc.cc:2406
Item_bool_func()
Definition: item_cmpfunc.h:181
int compare(const cmp_item *ci) const override
Definition: item_cmpfunc.h:1632
Bison "location" class.
Definition: parse_location.h:43
bool set_cmp_func(Item_result_field *owner_arg, Item **a1, Item **a2, Item_result type)
Sets compare functions for various datatypes.
Definition: item_cmpfunc.cc:1073
Definition: item_func.h:218
Item_func_eq(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:840
Bool_test truth_test
The value we&#39;re testing for.
Definition: item_cmpfunc.h:337
Item * truth_transformer(THD *, Bool_test test) override
a IS NOT NULL -> a IS NULL.
Definition: item_cmpfunc.cc:6027
Item_func_opt_neg(const POS &pos, PT_item_list *list, bool is_negation)
Definition: item_cmpfunc.h:1007
Item * warn_item
Definition: item_cmpfunc.h:1413
const char * func_name() const override
Definition: item_cmpfunc.h:1110
Definition: item_cmpfunc.h:1513
enum Functype functype() const override
Definition: item_cmpfunc.h:633
bool fix_fields(THD *thd, Item **ref) override
Definition: item_cmpfunc.cc:6286
Item_func_opt_neg(const POS &pos, Item *a, Item *b, Item *c, bool is_negation)
Definition: item_cmpfunc.h:1003
Item * truth_transformer(THD *, Bool_test) override
Apply NOT transformation to the item and return a new one.
Definition: item_cmpfunc.cc:5982
longlong val_int() override
Definition: item_cmpfunc.cc:2393
cmp_item_int()
Definition: item_cmpfunc.h:1578
bool add(THD *thd, Item *c, Item_field *f)
Definition: item_cmpfunc.cc:6168
Item_func_comparison(Item *a, Item *b)
Definition: item_cmpfunc.h:558
Item_result hybrid_type
Definition: item_func.h:672
Item * get_const()
Definition: item_cmpfunc.h:2219
Item * make_condition(Parse_context *pc, Item *item)
Ensure that all expressions involved in conditions are boolean functions.
Definition: item_cmpfunc.cc:4892
bool is_null() override
Definition: item_cmpfunc.h:536
Item * truth_transformer(THD *, Bool_test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.cc:5988
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:623
Item_bool_func2(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:511
bool compare_const(THD *thd, Item *c)
Definition: item_cmpfunc.cc:6151
virtual int compare(const cmp_item *ci) const
Definition: item_cmpfunc.h:1524
Definition: item.h:751
Item class, to represent X IS [NOT] (TRUE | FALSE) boolean predicates.
Definition: item_cmpfunc.h:278
Definition: item_cmpfunc.h:998
virtual bool eqne_op() const
Definition: item_cmpfunc.h:494
Definition: my_bitmap.h:42
Item_cond_or(Item *i1, Item *i2)
Definition: item_cmpfunc.h:2339
cmp_item()
Definition: item_cmpfunc.h:1477
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:3496
void set_max_str_length(size_t max_str_length)
When comparing strings, compare at most max_str_length bytes.
Definition: item_cmpfunc.h:524
Definition: item_func.h:133
Item_func_strcmp(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:1068
Item_field * operator++(int)
Definition: item_cmpfunc.h:2298
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:2440
virtual cmp_item * make_same()=0
bool find_item(Item *item) override
Calls item->val_int() or item->val_str() etc.
Definition: item_cmpfunc.cc:4039
uint n
Definition: item_cmpfunc.h:1846
my_decimal class limits &#39;decimal_t&#39; type to what we need in MySQL.
Definition: my_decimal.h:100
int compare_json()
Compare two Item objects as JSON.
Definition: item_cmpfunc.cc:1481
bool equality_substitution_analyzer(uchar **) override
Definition: item_cmpfunc.h:2271
Item_func_coalesce(const POS &pos, Item *a)
Definition: item_cmpfunc.h:1127
Definition: item_cmpfunc.h:1997
Functype
Definition: item_func.h:119
void resize_and_sort() override
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
Definition: item_cmpfunc.cc:3965
Definition: item_cmpfunc.h:1942
Item * tmp_arg[2]
Definition: item_func.h:85
Definition: item.h:750
cmp_item_row(THD *thd, Item *item)
Definition: item_cmpfunc.h:1850
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2284
double
Definition: udf_registration_types.h:42
bool subst_argument_checker(uchar **) override
Definition: item_cmpfunc.h:1022
String value1
Definition: item_cmpfunc.h:109
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:880
uint decimal_precision() const override
Definition: item_cmpfunc.cc:3612
longlong val_int() override
Definition: item_cmpfunc.cc:5604
Definition: item_func.h:215
bool unsigned_flag
Definition: item_cmpfunc.h:1352
bool compare_elems(uint pos1, uint pos2) const override
Compare values number pos1 and pos2 for equality.
Definition: item_cmpfunc.cc:3978
enum Functype functype() const override
Definition: item_cmpfunc.h:604
List< Item_equal > current_level
Definition: item_cmpfunc.h:2289
longlong val_int() override
Definition: item_cmpfunc.cc:5587
virtual void resize_and_sort()=0
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
virtual void store_value(Item *item)
Definition: item_cmpfunc.cc:4123
Item * truth_transformer(THD *, Bool_test) override
Apply NOT transformation to the item and return a new one.
Definition: item_cmpfunc.cc:6060
Implements the comparison operator greater than or equals (>=)
Definition: item_cmpfunc.h:893
Definition: item_cmpfunc.h:1431
longlong(* get_value_b_func)(THD *thd, Item ***item_arg, Item **cache_arg, const Item *warn_item, bool *is_null)
Definition: item_cmpfunc.h:87
cmp_item * cmp_items[6]
Definition: item_cmpfunc.h:1754
void set_created_by_in2exists()
Definition: item_cmpfunc.h:204
Header for compiler-dependent features.
Abstract factory interface for creating comparison predicates.
Definition: item_cmpfunc.h:397
JSON DOM.
enum Item_result cached_result_type
Definition: item_cmpfunc.h:1217
Definition: item_cmpfunc.h:1153
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:1803
int cmp(Item *arg)
Definition: item_cmpfunc.cc:4267
static const int UNKNOWN
Definition: item_cmpfunc.h:340
my_decimal * val_decimal(my_decimal *) override
Definition: item_cmpfunc.cc:3408
virtual enum Functype functype() const override
Definition: item_cmpfunc.h:293
Json_scalar_holder * json_scalar
Only used by compare_json() in the case where a JSON value is compared to an SQL value.
Definition: item_cmpfunc.h:98
Item_is_not_null_test(Item_in_subselect *ow, Item *a)
Definition: item_cmpfunc.h:1946
Definition: item_cmpfunc.h:1091
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:4793
longlong val_int() override
Make a logical XOR of the arguments.
Definition: item_cmpfunc.cc:5942
enum Functype functype() const override
Definition: item_cmpfunc.h:2236
Arg_comparator ge_cmp
Definition: item_cmpfunc.h:1037
longlong val_int() override
Definition: item_cmpfunc.cc:2381
virtual bool eqne_op() const =0
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:5580
uint16_t uint16
Definition: my_inttypes.h:60
Item_bool_func(THD *thd, Item_bool_func *item)
Definition: item_cmpfunc.h:194
Definition: item.h:666
bool compare_elems(uint pos1, uint pos2) const override
Compare values number pos1 and pos2 for equality.
Definition: item_cmpfunc.cc:3887
unsigned int uint
Definition: uca-dump.cc:29
#define final(a, b, c)
Definition: hash.c:109
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_cmpfunc.cc:3443
Item_cond_or()
Definition: item_cmpfunc.h:2337
virtual Item_bool_func * combine(List< Item > list) const
Combines a list of conditions exp op exp.
Definition: item_cmpfunc.cc:308
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:111
virtual bool is_row_result() const
Definition: item_cmpfunc.h:1299
Definition: item_cmpfunc.h:680
my_decimal * val_decimal(my_decimal *) override
Definition: item_cmpfunc.cc:3182
bool null_value
True if item is null.
Definition: item.h:2736
plan_idx m_idx
Optional: if join!=NULL: index of table.
Definition: item_cmpfunc.h:715
#define true
Definition: config_static.h:44
void(* Cond_traverser)(const Item *item, void *arg)
Definition: item.h:664
void copy_andor_arguments(THD *thd, Item_cond *item)
Definition: item_cmpfunc.cc:4933
bool field_type_defined
Definition: item_cmpfunc.h:1155
long long int longlong
Definition: my_inttypes.h:73
virtual ~in_vector()
Definition: item_cmpfunc.h:1265
bool const_item() const
Returns true if item is constant, regardless of query evaluation state.
Definition: item.h:1822
Definition: item_cmpfunc.h:598
COND_EQUAL()
Definition: item_cmpfunc.h:2291
void traverse_cond(Cond_traverser, void *arg, traverse_order order) override
Definition: item_cmpfunc.cc:5273
void cleanup() override
Definition: item.cc:9450
const char * func_name() const override
Definition: item_cmpfunc.h:1950
int first_expr_num
Definition: item_cmpfunc.h:1670
longlong val_int() override
Definition: item_cmpfunc.cc:2387
virtual Item_bool_func * create(Item *a, Item *b) const
This implementation of the factory method also implements flattening of row constructors.
Definition: item_cmpfunc.cc:266
Type
Definition: item.h:702
Definition: item.h:168
const CHARSET_INFO * collation
Definition: item.h:170
bool is_null() override
Definition: item_cmpfunc.cc:3296
Definition: item_func.h:158
void sort(Node_cmp_func cmp)
Sort the list.
Definition: sql_list.h:524
List< Item > list
Definition: item_cmpfunc.h:2067
Item_bool_func2 super
Definition: item_cmpfunc.h:1998
void set_comparator(uint col, cmp_item *comparator)
Definition: item_cmpfunc.h:1885
Item_func_ifnull(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:1158
const char * func_name() const override
Definition: item_cmpfunc.h:605
COND_EQUAL cond_equal
Definition: item_cmpfunc.h:2307
enum Functype functype() const override
Definition: item_cmpfunc.h:791
const char * func_name() const override
Definition: item_cmpfunc.h:1150
virtual void store_value(Item *item)=0
Item_int_func super
Definition: item_cmpfunc.h:1092
table_map not_null_tables() const override
Definition: item_cmpfunc.h:830
Bool_test
< Modifier for result transformation
Definition: item.h:749
Le_creator le_creator
Definition: mysqld.cc:1307
virtual Item_bool_func * combine(List< Item > list) const
Combines a list of conditions exp op exp.
Definition: item_cmpfunc.cc:290
longlong val_int() override
Definition: item_cmpfunc.cc:2278
longlong val_int() override
Definition: item_cmpfunc.cc:2234
bool find_item(Item *item) override
Calls item->val_int() or item->val_str() etc.
Definition: item_cmpfunc.cc:3879
virtual Item_bool_func * create_scalar_predicate(Item *a, Item *b) const
Creates only an item tree node, without attempting to rewrite row constructors.
Definition: item_cmpfunc.cc:285
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:527
const char * func_name() const override
Definition: item_cmpfunc.h:1714
Item * find_item(String *str)
Find and return matching items for CASE or ELSE item if all compares are failed or NULL if ELSE item ...
Definition: item_cmpfunc.cc:3321
bool remove_const_conds(THD *thd, Item *item, Item **new_item)
Remove constant conditions over literals.
Definition: item_cmpfunc.cc:5119
It is interface module to fixed precision decimals library.
void set_subquery()
Set the "has subquery" property.
Definition: item.h:2523
double precision
Definition: item_cmpfunc.h:80
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:1044
virtual ~Le_creator()
Definition: item_cmpfunc.h:491
Definition: item_func.h:820
bool get_mysql_time_from_str_no_warn(THD *thd, String *str, MYSQL_TIME *l_time, MYSQL_TIME_STATUS *status)
A minion of get_mysql_time_from_str, see its description.
Definition: item_cmpfunc.cc:807
Item_func_ge(Item *a, Item *b)
Definition: item_cmpfunc.h:895
Item_func_eq(Item *a, Item *b)
Definition: item_cmpfunc.h:839
Definition: m_ctype.h:359
Item_func_isnotnull(Item *a)
Definition: item_cmpfunc.h:1968
virtual String * val_str(String *str)=0
Definition: item_cmpfunc.h:2294
bool empty_underlying_subquery()
Definition: item_cmpfunc.cc:400
Item which stores (x,y,...) and ROW(x,y,...).
Definition: item_row.h:50
bool time_op(MYSQL_TIME *ltime) override
Definition: item_cmpfunc.cc:3055
Item_func_case(const POS &pos, List< Item > &list, Item *first_expr_arg, Item *else_expr_arg)
Definition: item_cmpfunc.h:1680
int sortcmp(const String *a, const String *b, const CHARSET_INFO *cs)
Definition: sql_string.cc:743
bool fix_fields(THD *thd, Item **ref) override
Definition: item_cmpfunc.h:744
int compare_datetime()
Compare item values as dates.
Definition: item_cmpfunc.cc:1391
in_string(MEM_ROOT *mem_root, uint elements, const CHARSET_INFO *cs)
Definition: item_cmpfunc.cc:3916
void update_used_tables() override
Definition: item_cmpfunc.h:758
Item ** args
Definition: item_func.h:85
Item_basic_constant * create_item(MEM_ROOT *) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1888
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:1718
String * val_str(String *str) override
Definition: item_cmpfunc.cc:3157
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:99
size_t m_max_str_length
When comparing strings, compare at most these many bytes.
Definition: item_cmpfunc.h:104
void resize_and_sort() override
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
Definition: item_cmpfunc.cc:4034
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_cmpfunc.cc:3013
Definition: item_cmpfunc.h:449
Common header for many mysys elements.
longlong val_int() override
The implementation of optimized <outer expression> [NOT] IN <subquery> predicates.
Definition: item_cmpfunc.cc:2073
#define OUTER_REF_TABLE_BIT
Definition: sql_const.h:113
virtual bool l_op() const
Definition: item_cmpfunc.h:475
bool show
Definition: item_cmpfunc.h:778
Item * transform(Item_transformer transformer, uchar *arg) override
Transform an Item_in_optimizer and its arguments with a callback function.
Definition: item_cmpfunc.cc:2183
bool ignore_unknown() const
Treat UNKNOWN result like FALSE because callers see no difference.
Definition: item_cmpfunc.h:542
Arg_comparator cmp
Definition: item_cmpfunc.h:2207
longlong val_int() override
Definition: item_cmpfunc.cc:2369
bool is_bool_func() const override
This is a workaround for the broken inheritance hierarchy: this should inherit from Item_func instead...
Definition: item_cmpfunc.h:1246
void cleanup() override
Definition: item_cmpfunc.h:543
Item * copy_andor_structure(THD *thd) override
Definition: item_cmpfunc.h:2347
void sort(Node_cmp_func compare)
Order field items in multiple equality according to a sorting criteria.
Definition: item_cmpfunc.h:2256
longlong val_int() override
Definition: item_cmpfunc.cc:6499
table_map not_null_tables_cache
Value used in calculation of result of not_null_tables()
Definition: item_func.h:106
enum Functype functype() const override
Definition: item_cmpfunc.h:937
Definition: item_cmpfunc.h:1253
Definition: item_func.h:670
Item_func_coalesce(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:1123
enum Functype functype() const override
Definition: item_cmpfunc.h:1213
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5418
virtual bool eqne_op() const
Definition: item_cmpfunc.h:464
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:473
CASE ...
Definition: item_cmpfunc.h:1667
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_cmpfunc.cc:3199
Item_func_not(const POS &pos, Item *a)
Definition: item_cmpfunc.h:601
table_map get_initial_pseudo_tables() const override
We add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE.
Definition: item_cmpfunc.h:1957
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_cmpfunc.cc:5701
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:1071
char buff[STRING_BUFFER_USUAL_SIZE]
Definition: item_cmpfunc.h:1325
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:589
Item_func_true()
Definition: item_cmpfunc.h:250
Item ** cache_converted_constant(THD *thd, Item **value, Item **cache, Item_result type)
Convert and cache a constant.
Definition: item_cmpfunc.cc:1239
Item_func_not(Item *a)
Definition: item_cmpfunc.h:600
static MEM_ROOT mem_root
Definition: client_plugin.cc:107
Definition: item_cmpfunc.h:468
String tmp_value
Definition: item_cmpfunc.h:1672
optimize_type select_optimize(const THD *) override
Definition: item_cmpfunc.h:1794
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:918
cmp_item which stores a scalar (i.e. non-ROW).
Definition: item_cmpfunc.h:1507
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:922
Definition: item_cmpfunc.h:1966
Type type() const override
Definition: item_cmpfunc.h:2105
void cleanup() override
Definition: item_cmpfunc.cc:3649
Item_cache * cache
Definition: item_cmpfunc.h:364
Item_func_xor(const POS &pos, Item *i1, Item *i2)
Definition: item_cmpfunc.h:582
bool(Item::* Item_processor)(uchar *arg)
Processor type for {Item,SELECT_LEX[_UNIT],Table_function}walk.
Definition: sql_const.h:452
Item_cond()
Definition: item_cmpfunc.h:2072
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:82
String * val_str(String *) override
Definition: item_cmpfunc.cc:3350
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1385
bool compare_elems(uint pos1, uint pos2) const override
Compare values number pos1 and pos2 for equality.
Definition: item_cmpfunc.cc:4071
const JOIN * m_join
Optional: JOIN of table which is the source of trig_var.
Definition: item_cmpfunc.h:713
Definition: item_cmpfunc.h:1085
Mem_root_array< packed_longlong > base
Definition: item_cmpfunc.h:1356
Item_maxmin_subselect * test_sub_item
Definition: item_cmpfunc.h:773
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2351
void store_value(Item *item) override
Definition: item_cmpfunc.h:1579
bool fix_fields(THD *, Item **ref) override
Definition: item_cmpfunc.cc:4941
Definition: item_cmpfunc.h:1554
Abstract base class for the comparison operators =, <> and <=>.
Definition: item_cmpfunc.h:409
bool use_decimal_comparison
Definition: item_cmpfunc.h:1095
Item_result_field * owner
Definition: item_cmpfunc.h:77
bool escape_is_evaluated() const
Has the escape clause been evaluated? It only needs to be evaluated once per execution, since we require it to be constant during execution.
Definition: item_cmpfunc.h:2043
virtual bool eqne_op() const
Definition: item_cmpfunc.h:474
traverse_order
Definition: item.h:737
Definition: item_cmpfunc.h:1381
Item_bool_func(Item *a, Item *b)
Definition: item_cmpfunc.h:189
Definition: item_cmpfunc.h:1411
Item * equality_substitution_transformer(uchar *arg) override
Replace arg of Item_func_eq object after having added a table that represents a materialized semi-joi...
Definition: item_cmpfunc.cc:6742
Item_func_isnotnull(const POS &pos, Item *a)
Definition: item_cmpfunc.h:1969
bool save_cache
Definition: item_cmpfunc.h:365
Arg_comparator cmp
Definition: item_cmpfunc.h:504
virtual bool is_null()
Definition: item.h:1906
double val_real() override
Definition: item_cmpfunc.cc:3392
const char * func_name() const override
Definition: item_cmpfunc.h:1072
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_cmpfunc.cc:2420
ANY_VALUE(expr) is like expr except that it is not checked by aggregate_check logic.
Definition: item_cmpfunc.h:1178
Definition: item_cmpfunc.h:1451
bool fix_fields(THD *, Item **) override
Definition: item_cmpfunc.h:241
Definition: mysql_time.h:64
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:635
enum Functype rev_functype() const override
Definition: item_cmpfunc.h:938
Definition: item.h:753
Definition: item.h:757
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:6445
void print(const THD *, String *str, enum_query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:269
int cmp(Item *arg) override
Definition: item_cmpfunc.cc:4299
Item * transform(Item_transformer transformer, uchar *arg) override
Perform a generic transformation of the Item tree, by adding zero or more additional Item objects to ...
Definition: item_cmpfunc.cc:6464
virtual bool eqne_op() const
Definition: item_cmpfunc.h:412
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1397
void value_to_item(uint pos, Item_basic_constant *item) const override
Store the value at position pos into provided item object.
Definition: item_cmpfunc.h:1460
const char * func_name() const override
Definition: item_cmpfunc.h:266
Item ** b
Definition: item_cmpfunc.h:75
bool maybe_null
True if this item may be null.
Definition: item.h:2735
enum_mysql_timestamp_type
Definition: mysql_time.h:44
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_cmpfunc.cc:3025
Mem_root_array< my_decimal > base
Definition: item_cmpfunc.h:1452
cmp_item * make_same() override
Definition: item_cmpfunc.cc:4317
void cleanup() override
Definition: item_cmpfunc.h:243
Definition: item_func.h:217
Item ** a
Definition: item_cmpfunc.h:75
table_map used_tables_cache
Value used in calculation of result of used_tables()
Definition: item_func.h:104
Definition: item_func.h:193
uint decimal_precision() const override
Definition: item_cmpfunc.h:1231
Wrapper class when MATCH function is used in WHERE clause.
Definition: item_cmpfunc.h:628
const char * func_name() const override
Definition: item_cmpfunc.h:846
enum Functype functype() const override
Definition: item_cmpfunc.h:1915
int type
Definition: http_common.h:411
Equal_creator equal_creator
Definition: mysqld.cc:1303
enum Functype functype() const override
Definition: item_cmpfunc.h:977
Item * truth_transformer(THD *, Bool_test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.cc:6040
int(Arg_comparator::* arg_cmp_func)()
Definition: item_cmpfunc.h:72
virtual Item_bool_func * combine(List< Item > list) const =0
Combines a list of conditions exp op exp.
bool compare_elems(uint pos1, uint pos2) const override
Compare values number pos1 and pos2 for equality.
Definition: item_cmpfunc.cc:4046
void update_used_tables() override
Definition: item_func.cc:450
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:2653
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:540
in_time_as_longlong(MEM_ROOT *mem_root, uint elements)
Definition: item_cmpfunc.h:1395
String * str_op(String *str) override
Coalesce - return first not NULL argument.
Definition: item_cmpfunc.cc:3061
Mem_root_array< cmp_item_row * > base_pointers
Definition: item_cmpfunc.h:1878
Definition: item_cmpfunc.h:1574
uint elements
Definition: sql_list.h:135
bool alloc_comparators(THD *thd, Item *item)
Allocate comparator objects.
Definition: item_cmpfunc.cc:4171
void store_value(Item *item) override
Definition: item_cmpfunc.cc:4287
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:6759
virtual const char * symbol(bool invert) const =0
This interface is only used by Item_allany_subselect.
Item_func_if(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_cmpfunc.h:1194
table_map not_null_tables() const override
Definition: item_cmpfunc.h:798
my_decimal dec
Definition: item_cmpfunc.h:1088
bool is_row_result() const override
Definition: item_cmpfunc.h:1882
bool walk(Item_processor processor, enum_walk walk, uchar *arg) override
Traverses a tree of Items in prefix and/or postfix order.
Definition: item_cmpfunc.cc:5198
bool compare_as_temporal_times
Definition: item_cmpfunc.h:1034
longlong val
Definition: item_cmpfunc.h:1351
cmp_item_row * tmp
Definition: item_cmpfunc.h:1875
static bool can_compare_as_dates(Item *a, Item *b)
Checks whether compare_datetime() can be used to compare items.
Definition: item_cmpfunc.cc:994
cmp_item * make_same() override
Definition: item_cmpfunc.cc:4106
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:3121
Item * copy_andor_structure(THD *thd) override
Definition: item_cmpfunc.h:2320
Definition: item_cmpfunc.h:2284
Item * and_conds(Item *a, Item *b)
Builds condition: (a AND b) IS TRUE.
Definition: item_cmpfunc.h:2363
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_cmpfunc.cc:3699
DTCollation cmp_collation
Definition: item_cmpfunc.h:1755
Item * negated_item() override
just fake method, should never be called.
Definition: item_cmpfunc.cc:6071
Item * truth_transformer(THD *, Bool_test) override
XOR can be negated by negating one of the operands:
Definition: item_cmpfunc.cc:6000
bool abort_on_null
Definition: item_cmpfunc.h:505
Item_func_bool_const(const POS &pos)
Definition: item_cmpfunc.h:235
table_map get_inner_tables() const
Get table_map of inner tables spanned by associated outer join operation.
Definition: item_cmpfunc.cc:6538
Definition: sql_list.h:581
uint max_members
Definition: item_cmpfunc.h:2286
longlong val_int() override
Definition: item_cmpfunc.cc:3249
Item_func_true(const POS &pos)
Definition: item_cmpfunc.h:251
void prepend(List< T > *list)
Definition: sql_list.h:458
Item_bool_func super
Definition: item_cmpfunc.h:1904
void print_op(const THD *thd, String *str, enum_query_type query_type) const
Definition: item_func.cc:485
uint decimal_precision() const override
Definition: item_cmpfunc.cc:2989
void fix_after_pullout(SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion.
Definition: item_cmpfunc.cc:5158
Item_bool_func(const POS &pos)
Definition: item_cmpfunc.h:182
enum Functype functype() const override
Definition: item_cmpfunc.h:917
int compare_int_unsigned_signed()
Compare unsigned (*a) with signed (*B)
Definition: item_cmpfunc.cc:1720
Ne_creator ne_creator
Definition: mysqld.cc:1302
void destroy(T *ptr)
Definition: my_alloc.h:377
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1437
cond_result eq_cmp_result() const override
Definition: item_cmpfunc.h:959
Definition: item.h:3866
Definition: item.h:735
Definition: field_types.h:69
bool fixed
True if item has been resolved.
Definition: item.h:2715
Definition: item_func.h:121
Item * compile(Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) override
Compile Item_cond object with a processor and a transformer callback functions.
Definition: item_cmpfunc.cc:5252
void set_max_str_length(size_t max_length)
When comparing strings, compare at most max_length bytes.
Definition: item_cmpfunc.h:143
longlong cached_value
Definition: item_cmpfunc.h:1907
Definition: item_cmpfunc.h:1393
bool created_by_in2exists() const override
Whether this Item was created by the IN->EXISTS subquery transformation.
Definition: item_cmpfunc.h:203
virtual Item_bool_func * create(Item *a, Item *b) const
Definition: item_cmpfunc.cc:312
Time declarations shared between the server and client API: you should not add anything to this heade...
Item with result field.
Definition: item.h:4566
const char * func_name() const override
Definition: item_cmpfunc.h:290
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:1054
Definition: item_func.h:132
uint allowed_arg_cols
Definition: item_func.h:102
Item_func_equal(Item *a, Item *b)
Definition: item_cmpfunc.h:869
bool fill(Item **items, uint item_count)
Fill the vector by evaluating the items passed as arguments.
Definition: item_cmpfunc.cc:3759
virtual int cmp(Item *item)=0
Mem_root_array< String * > base_pointers
Definition: item_cmpfunc.h:1329
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_cmpfunc.h:1988
enum Functype functype() const override
Definition: item_cmpfunc.h:585
double dbl
Definition: item_cmpfunc.h:1087
bool ignore_unknown() const
Treat UNKNOWN result like FALSE because callers see no difference.
Definition: item_cmpfunc.h:2125
void get_table_range(TABLE_LIST **first_table, TABLE_LIST **last_table) const
Get range of inner tables spanned by associated outer join operation.
Definition: item_cmpfunc.cc:6517
void set_cmp_context_for_datetime()
Definition: item_cmpfunc.h:172
enum Item_result cached_result_type
Definition: item_cmpfunc.h:1187
void negate()
Definition: item_cmpfunc.h:1013
Definition: item_cmpfunc.h:1121
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:2267
cmp_item * make_same() override
Definition: item_cmpfunc.cc:4108
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.cc:4527
Implements the comparison operator less than (<)
Definition: item_cmpfunc.h:953
String * val_str(String *str) override
Definition: item_cmpfunc.cc:3261
enum Functype functype() const override
Definition: item_cmpfunc.h:737
Target down_cast(Source *arg)
Casts from one pointer type to another in a type hierarchy.
Definition: template_utils.h:91
bool convert_constant_arg(THD *thd, Item *field, Item **item, bool *converted)
Definition: item_cmpfunc.cc:605
uint16 comparator_count
Definition: item_cmpfunc.h:79
A better implementation of the UNIX ctype(3) library.
Item_cond(Item *i1, Item *i2)
Definition: item_cmpfunc.h:2073
Item_func_trig_cond(Item *a, bool *f, JOIN *join, plan_idx idx, enum_trig_type trig_type_arg)
Definition: item_cmpfunc.h:729
Definition: item_cmpfunc.h:1903
void set_comparator(uint col, cmp_item *comparator)
Definition: item_cmpfunc.h:1866
Definition: item_cmpfunc.h:1639
Definition: item_subselect.h:316
Definition: item_func.h:130
enum Functype functype() const override
Definition: item_cmpfunc.h:2024
void print(const THD *thd, String *str, enum_query_type query_type) const override
Definition: item_cmpfunc.cc:3627
virtual bool compare_elems(uint pos1, uint pos2) const =0
Compare values number pos1 and pos2 for equality.
int compare_real_fixed()
Definition: item_cmpfunc.cc:1607
Definition: item_func.h:134
void set_const(Item *c)
Definition: item_cmpfunc.h:2220
static cmp_item * get_comparator(Item_result result_type, const Item *item, const CHARSET_INFO *cs)
Find the appropriate comparator for the given type.
Definition: item_cmpfunc.cc:4075
bool * trig_var
Pointer to trigger variable.
Definition: item_cmpfunc.h:711
bool * get_trig_var()
Definition: item_cmpfunc.h:763
Definition: item_cmpfunc.h:825
cmp_item * make_same()
Definition: item_cmpfunc.cc:4278
const string value("\alue\)
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_cmpfunc.cc:3001
Item * truth_transformer(THD *, Bool_test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_cmpfunc.h:882
if(++stacktop > STACKSIZ)
Definition: dbug_analyze.cc:141
~Item_equal() override
Definition: item_cmpfunc.h:2217
virtual enum Functype rev_functype() const
Definition: item_cmpfunc.h:528
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:1236
Definition: item_cmpfunc.h:1844
static STATUS status
Definition: mysql.cc:191
bool fix_fields(THD *thd, Item **ref) override
Definition: item_cmpfunc.cc:5496
Interface for low level time utilities.
Item_func_lt(Item *a, Item *b)
Definition: item_cmpfunc.h:955
Item * truth_transformer(THD *, Bool_test) override
Apply NOT transformation to the item and return a new one.
Definition: item_cmpfunc.cc:6049
Representation of IN subquery predicates of the form "left_expr IN (SELECT ...)". ...
Definition: item_subselect.h:472
const char * func_name() const override
Definition: item_cmpfunc.h:792
bool have_null
If there is some NULL among <in value list>, during a val_int() call; for example IN ( (1...
Definition: item_cmpfunc.h:1746
static bool get_date_from_const(Item *date_arg, Item *str_arg, ulonglong *const_value)
Check if str_arg is a constant and convert it to datetime packed value.
Definition: item_cmpfunc.cc:919
void resize_and_sort() override
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
Definition: item_cmpfunc.cc:3899
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:1873
int cmp(Item *arg) override
Definition: item_cmpfunc.h:1628
Definition: item_func.h:139
bool has_date
Distinguish between DATE/DATETIME/TIMESTAMP and TIME.
Definition: item_cmpfunc.h:1610
virtual void print(const THD *, String *str, enum_query_type) const
This method is used for to:
Definition: item.h:1869
void cleanup_arrays()
Cleanup data and comparator arrays.
Definition: item_cmpfunc.h:1778
Abstract base class for the MIN and MAX aggregate functions.
Definition: item_sum.h:1487
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
bool is_bool_func() const override
Definition: item_cmpfunc.h:1799
bool val_bool() override
Definition: item_cmpfunc.h:253
bool compare_as_dates
Definition: item_cmpfunc.h:2209
longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, const Item *warn_item, bool *is_null)
Definition: item_cmpfunc.cc:1295
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:2333
bool update_const(THD *thd)
Check appearance of new constant items in the multiple equality object.
Definition: item_cmpfunc.cc:6260
Definition: item_func.h:127
Definition: table.h:2442
Item_cond_or(const POS &pos, Item *i1, Item *i2)
Definition: item_cmpfunc.h:2340
#define STRING_BUFFER_USUAL_SIZE
Definition: sql_const.h:130
bool aggregate_check_distinct(uchar *arg) override
Definition: item_cmpfunc.cc:6784
bool push_back(T *a)
Definition: sql_list.h:442
bool aggregate_check_group(uchar *arg) override
Definition: item_cmpfunc.cc:6777
int cmp(Item *arg) override
Definition: item_cmpfunc.h:1583
virtual bool l_op() const =0
void cleanup() override
Definition: item_cmpfunc.h:1788
Definition: item_func.h:135
static const char * bool_transform_names[10]
Definition: item_cmpfunc.h:206
void cleanup() override
Definition: item_cmpfunc.cc:2157
bool resolve_type(THD *) override
Definition: item_cmpfunc.cc:2953
longlong val_int() override
Definition: item_cmpfunc.cc:6428
uint decimal_precision() const override
Definition: item_cmpfunc.h:202
void fix_after_pullout(SELECT_LEX *parent_select, SELECT_LEX *removed_select) override
Fix after tables have been moved from one select_lex level to the parent level, e.g by semijoin conversion.
Definition: item_cmpfunc.cc:4512
bool fix_fields(THD *, Item **) override
Perform context analysis of an IF item tree.
Definition: item_cmpfunc.cc:3101
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.h:1074
Definition: item_cmpfunc.h:458
Item_sum_hybrid * test_sum_item
Definition: item_cmpfunc.h:772
bool have_rev_func() const override
Definition: item_cmpfunc.h:529
Item_func_truth(Item *a, Bool_test truth_test)
Definition: item_cmpfunc.h:308
cmp_item * eval_item
Definition: item_cmpfunc.h:2206
const char * func_name() const override
Definition: item_cmpfunc.h:1046
const char * func_name() const override
Definition: item_cmpfunc.h:1798
bool dep_subq_in_list
Set to true by resolve_type() if the IN list contains a dependent subquery, in which case condition f...
Definition: item_cmpfunc.h:1752
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1334
Ge_creator()
Definition: item_cmpfunc.h:480
void set_subselect(Item_subselect *item)
Definition: item_cmpfunc.h:797
bool fix_fields(THD *thd, Item **ref) override
Definition: item_cmpfunc.cc:5790
bool abort_on_null
Definition: item_cmpfunc.h:775
void set_sum_test(Item_sum_hybrid *item)
Definition: item_cmpfunc.h:795
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:6483
static arg_cmp_func comparator_matrix[5]
Definition: item_cmpfunc.h:167
Definition: item_cmpfunc.h:1025
bool abort_on_null
Definition: item_cmpfunc.h:2068
my_decimal value
Definition: item_cmpfunc.h:1640
Definition: item_func.h:122
T * head()
Definition: sql_list.h:450
Item_field * get_subst_item(const Item_field *field)
Get item that can be substituted for the supplied item.
Definition: item_cmpfunc.cc:6620
longlong value
Definition: item_cmpfunc.h:1602
uint decimal_precision() const override
Definition: item_cmpfunc.h:1770
bool m_null_value
If stored value is NULL.
Definition: item_cmpfunc.h:1509
String tmp
Definition: item_cmpfunc.h:1326
#define false
Definition: config_static.h:43
virtual const char * symbol(bool invert) const
This interface is only used by Item_allany_subselect.
Definition: item_cmpfunc.h:493
Lt_creator()
Definition: item_cmpfunc.h:470
int compare(const cmp_item *c) const
Definition: item_cmpfunc.cc:4273
virtual Item * negated_item()
just fake method, should never be called.
Definition: item_cmpfunc.cc:6104
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_cmpfunc.cc:5333
virtual Item_bool_func * create(Item *a, Item *b) const
Definition: item_cmpfunc.cc:320
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size...
Definition: item_cmpfunc.h:198
bool set_null
Definition: item_cmpfunc.h:83
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize()/contextualize_() but with additional parameter.
Definition: item_cmpfunc.cc:5889
double val_real() override
Definition: item_cmpfunc.cc:3237
enum Functype functype() const override
Definition: item_cmpfunc.h:1045
Definition: item_cmpfunc.h:427
bool pred_level
Definition: item_cmpfunc.h:1001
Definition: item_cmpfunc.h:1348
bool find_item(Item *item) override
Calls item->val_int() or item->val_str() etc.
Definition: item_cmpfunc.cc:4063
bool walk(Item_processor processor, enum_walk walk, uchar *arg) override
Traverses a tree of Items in prefix and/or postfix order.
Definition: item_cmpfunc.cc:6452
void rewind(void)
Definition: item_cmpfunc.h:2302
longlong val_int() override
Definition: item_cmpfunc.cc:2249
Item * truth_transformer(THD *, Bool_test test) override
a IS NULL -> a IS NOT NULL.
Definition: item_cmpfunc.cc:6020
void add_at_head(List< Item > *nlist)
Definition: item_cmpfunc.h:2094
Item_func_interval(const POS &pos, MEM_ROOT *mem_root, Item *expr1, Item *expr2, class PT_item_list *opt_expr_list=NULL)
Definition: item_cmpfunc.h:1099
bool compare_as_temporal_dates
Definition: item_cmpfunc.h:1033
static int compare(size_t a, size_t b)
Function to compare two size_t integers for their relative order.
Definition: rpl_utility.cc:102
Definition: item_cmpfunc.h:2305
const char * func_name() const override
Definition: item_cmpfunc.h:586
Item_cond_and(THD *thd, Item_cond_and *item)
Definition: item_cmpfunc.h:2315
longlong val_int() override
Definition: item_cmpfunc.cc:5662
Item_func_not_all(Item *a)
Definition: item_cmpfunc.h:780
Definition: item_func.h:124
void cleanup()
Definition: item_cmpfunc.cc:692
Definition: items.h:34
Item_result cmp_type
Definition: item_cmpfunc.h:1674
Item_in_subselect * owner
Definition: item_cmpfunc.h:1943
const char * func_name() const override
Definition: item_cmpfunc.h:1212
Item_basic_constant * create_item(MEM_ROOT *mem_root) const override
Create an instance of Item_{type} (e.g.
Definition: item_cmpfunc.h:1457
Definition: item_cmpfunc.h:1066
const CHARSET_INFO * compare_collation() const override
Definition: item_cmpfunc.h:537
float get_single_col_filtering_effect(Item_ident *fieldref, table_map filter_for_table, const MY_BITMAP *fields_to_ignore, double rows_in_table)
Utility function to help calculate the total filtering effect of IN predicates.
Definition: item_cmpfunc.cc:4321
String m_str_value
String buffer.
Definition: item_cmpfunc.h:1561
This trigger type deactivates predicated from WHERE condition when no row satisfying the join conditi...
Definition: item_cmpfunc.h:697
Item_func_bool_const()
Definition: item_cmpfunc.h:229
void update_used_tables() override
Definition: item_cmpfunc.cc:6414
Item_func_nullif(const POS &pos, Item *a, Item *b)
Definition: item_cmpfunc.h:1220
Item * a_cache
Definition: item_cmpfunc.h:82
bool ignore_unknown() const
Treat UNKNOWN result like FALSE because callers see no difference.
Definition: item_cmpfunc.h:789
The <=> operator evaluates the same as.
Definition: item_cmpfunc.h:867
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table &#39;filter_for_table&#39; for this item...
Definition: item_cmpfunc.cc:5904
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777
Item_bool_func super
Definition: item_cmpfunc.h:2064
int compare_decimal()
Definition: item_cmpfunc.cc:1592
Arg_comparator()
Definition: item_cmpfunc.h:111
enum Functype functype() const override
Definition: item_cmpfunc.h:2344
Item * escape_item
Definition: item_cmpfunc.h:2000
in_datetime_as_longlong(MEM_ROOT *mem_root, uint elements)
Definition: item_cmpfunc.h:1383
bool fix_fields(THD *thd, Item **ref) override
Definition: item_cmpfunc.cc:3461
bool push_front(T *a)
Definition: sql_list.h:446
int compare_int_unsigned()
Compare values as BIGINT UNSIGNED.
Definition: item_cmpfunc.cc:1682
const char * func_name() const override
&#39;<if>&#39;, to distinguish from the if() SQL function
Definition: item_cmpfunc.h:739
Item_cond_and()
Definition: item_cmpfunc.h:2310
enum Functype functype() const override
Definition: item_cmpfunc.h:2317
void resize_and_sort() override
Resize and then sort the IN-list array, so we can do efficient lookup with binary_search.
Definition: item_cmpfunc.cc:4058
Item_cond_and(List< Item > &list_arg)
Definition: item_cmpfunc.h:2316
Item_bool_func2(Item *a, Item *b)
Definition: item_cmpfunc.h:508
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_cmpfunc.h:962
cmp_item ** comparators
Definition: item_cmpfunc.h:1845
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:97
virtual void store_value_by_template(cmp_item *, Item *item)
Definition: item_cmpfunc.h:1501
bool negated
Definition: item_cmpfunc.h:1000