mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Manual merge from mysql-trunk-merge.
Conflicts: - extra/comp_err.c - mysql-test/collections/default.experimental - mysql-test/r/archive.result - mysql-test/r/select.result - mysql-test/suite/binlog/r/binlog_unsafe.result - mysql-test/suite/binlog/t/binlog_unsafe.test - mysql-test/suite/rpl/t/disabled.def - mysql-test/t/archive.test - mysql-test/t/select.test - sql/item.cc - sql/item.h - sql/item_timefunc.cc - sql/sql_base.cc - sql/sql_delete.cc - sql/sql_load.cc - sql/sql_partition.cc - sql/sql_table.cc - storage/innobase/handler/ha_innodb.cc - vio/vio.c
This commit is contained in:
@@ -35,7 +35,7 @@ class Arg_comparator: public Sql_alloc
|
||||
{
|
||||
Item **a, **b;
|
||||
arg_cmp_func func;
|
||||
Item_bool_func2 *owner;
|
||||
Item_result_field *owner;
|
||||
Arg_comparator *comparators; // used only for compare_row()
|
||||
double precision;
|
||||
/* Fields used in DATE/DATETIME comparison. */
|
||||
@@ -43,30 +43,42 @@ class Arg_comparator: public Sql_alloc
|
||||
enum_field_types a_type, b_type; // Types of a and b items
|
||||
Item *a_cache, *b_cache; // Cached values of a and b items
|
||||
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
|
||||
bool set_null; // TRUE <=> set owner->null_value
|
||||
// when one of arguments is NULL.
|
||||
bool year_as_datetime; // TRUE <=> convert YEAR value to
|
||||
// the YYYY-00-00 00:00:00 DATETIME
|
||||
// format. See compare_year.
|
||||
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
|
||||
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
|
||||
longlong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
longlong (*get_value_a_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
longlong (*get_value_b_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
public:
|
||||
DTCollation cmp_collation;
|
||||
/* Allow owner function to use string buffers. */
|
||||
String value1, value2;
|
||||
|
||||
Arg_comparator(): thd(0), a_cache(0), b_cache(0) {};
|
||||
Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(0),
|
||||
year_as_datetime(0), get_value_a_func(0), get_value_b_func(0) {};
|
||||
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
|
||||
a_cache(0), b_cache(0) {};
|
||||
a_cache(0), b_cache(0), set_null(0), year_as_datetime(0),
|
||||
get_value_a_func(0), get_value_b_func(0) {};
|
||||
|
||||
int set_compare_func(Item_bool_func2 *owner, Item_result type);
|
||||
inline int set_compare_func(Item_bool_func2 *owner_arg)
|
||||
int set_compare_func(Item_result_field *owner, Item_result type);
|
||||
inline int set_compare_func(Item_result_field *owner_arg)
|
||||
{
|
||||
return set_compare_func(owner_arg, item_cmp_type((*a)->result_type(),
|
||||
(*b)->result_type()));
|
||||
}
|
||||
int set_cmp_func(Item_bool_func2 *owner_arg,
|
||||
int set_cmp_func(Item_result_field *owner_arg,
|
||||
Item **a1, Item **a2,
|
||||
Item_result type);
|
||||
|
||||
inline int set_cmp_func(Item_bool_func2 *owner_arg,
|
||||
Item **a1, Item **a2)
|
||||
inline int set_cmp_func(Item_result_field *owner_arg,
|
||||
Item **a1, Item **a2, bool set_null_arg)
|
||||
{
|
||||
set_null= set_null_arg;
|
||||
return set_cmp_func(owner_arg, a1, a2,
|
||||
item_cmp_type((*a1)->result_type(),
|
||||
(*a2)->result_type()));
|
||||
@@ -92,14 +104,20 @@ public:
|
||||
int compare_real_fixed();
|
||||
int compare_e_real_fixed();
|
||||
int compare_datetime(); // compare args[0] & args[1] as DATETIMEs
|
||||
int compare_year();
|
||||
|
||||
static enum enum_date_cmp_type can_compare_as_dates(Item *a, Item *b,
|
||||
ulonglong *const_val_arg);
|
||||
|
||||
void set_datetime_cmp_func(Item **a1, Item **b1);
|
||||
Item** cache_converted_constant(THD *thd, Item **value, Item **cache,
|
||||
Item_result type);
|
||||
void set_datetime_cmp_func(Item_result_field *owner_arg, Item **a1, Item **b1);
|
||||
static arg_cmp_func comparator_matrix [5][2];
|
||||
inline bool is_owner_equal_func()
|
||||
{
|
||||
return (owner->type() == Item::FUNC_ITEM &&
|
||||
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
|
||||
}
|
||||
|
||||
friend class Item_func;
|
||||
};
|
||||
@@ -329,7 +347,6 @@ class Item_bool_func2 :public Item_int_func
|
||||
{ /* Bool with 2 string args */
|
||||
protected:
|
||||
Arg_comparator cmp;
|
||||
String tmp_value1,tmp_value2;
|
||||
bool abort_on_null;
|
||||
|
||||
public:
|
||||
@@ -338,7 +355,7 @@ public:
|
||||
void fix_length_and_dec();
|
||||
void set_cmp_func()
|
||||
{
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1);
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, TRUE);
|
||||
}
|
||||
optimize_type select_optimize() const { return OPTIMIZE_OP; }
|
||||
virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }
|
||||
|
Reference in New Issue
Block a user