diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-03-31 16:40:29 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-03-31 16:40:29 +0400 |
commit | f00a314f9a659399eff392c4b635d1c381b9badb (patch) | |
tree | c64e89699dcc22b4ba3a62f83f21252c486617ce /sql/item_cmpfunc.cc | |
parent | e191833d758e89d282aea2d84126c9ca10036571 (diff) | |
parent | 2f3d4bd566b5e377fe8a1749c14050b0a0e083d0 (diff) | |
download | mariadb-git-f00a314f9a659399eff392c4b635d1c381b9badb.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c0fd80c51d3..7457708948f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -603,6 +603,22 @@ bool Arg_comparator::set_cmp_func_int() bool Arg_comparator::set_cmp_func_real() { + if ((((*a)->result_type() == DECIMAL_RESULT && !(*a)->const_item() && + (*b)->result_type() == STRING_RESULT && (*b)->const_item()) || + ((*b)->result_type() == DECIMAL_RESULT && !(*b)->const_item() && + (*a)->result_type() == STRING_RESULT && (*a)->const_item()))) + { + /* + <non-const decimal expression> <cmp> <const string expression> + or + <const string expression> <cmp> <non-const decimal expression> + + Do comparison as decimal rather than float, in order not to lose precision. + */ + m_compare_handler= &type_handler_newdecimal; + return set_cmp_func_decimal(); + } + THD *thd= current_thd; func= is_owner_equal_func() ? &Arg_comparator::compare_e_real : &Arg_comparator::compare_real; @@ -5210,6 +5226,18 @@ bool Item_func_like::with_sargable_pattern() const } +SEL_TREE *Item_func_like::get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) +{ + MEM_ROOT *tmp_root= param->mem_root; + param->thd->mem_root= param->old_root; + bool sargable_pattern= with_sargable_pattern(); + param->thd->mem_root= tmp_root; + return sargable_pattern ? + Item_bool_func2::get_mm_tree(param, cond_ptr) : + Item_func::get_mm_tree(param, cond_ptr); +} + + bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, int *escape) |