diff options
author | Igor Babaev <igor@askmonty.org> | 2013-10-10 10:08:26 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-10-10 10:08:26 -0700 |
commit | 7c87385e3075143de18e50c1d327eeb2e224603a (patch) | |
tree | 7819d66c3d59be663839b70b0204d281b849f98a /sql/item_cmpfunc.h | |
parent | ec226e553aa56718ed9939e333fe36b3499ac9be (diff) | |
download | mariadb-git-7c87385e3075143de18e50c1d327eeb2e224603a.tar.gz |
Fixed bug mdev-5105.
The bug caused a memory overwrite in the function update_ref_and_keys()
It happened due to a wrong value of SELECT_LEX::cond_count. This value
historically was calculated by the fix_fields method. Now the logic of
calling this method became too complicated and, as a result, this value
is calculated not always correctly.
The patch changes the way how and when the values of SELECT_LEX::cond_count
and of SELECT_LEX::between_count are calculated. The new code does it just at
the beginning of update_ref_and_keys().
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 99d89e16532..4deda7679ac 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -118,7 +118,7 @@ public: Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {} Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} bool is_bool_func() { return 1; } - void fix_length_and_dec() { decimals=0; max_length=1; } + void fix_length_and_dec() { decimals=0; max_length=1; sargable= true;} uint decimal_precision() const { return 1; } }; @@ -681,6 +681,7 @@ public: uint decimal_precision() const { return 1; } bool eval_not_null_tables(uchar *opt_arg); void fix_after_pullout(st_select_lex *new_parent, Item **ref); + bool count_sargable_conds(uchar *arg); }; @@ -1747,6 +1748,7 @@ public: CHARSET_INFO *compare_collation(); void set_context_field(Item_field *ctx_field) { context_field= ctx_field; } + bool count_sargable_conds(uchar *arg); friend class Item_equal_iterator<List_iterator_fast,Item>; friend class Item_equal_iterator<List_iterator,Item>; friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, |