diff options
author | bell@sanja.is.com.ua <> | 2004-11-18 18:10:07 +0200 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2004-11-18 18:10:07 +0200 |
commit | f5e253dc2f94029cf2904702c197aa01537ddab4 (patch) | |
tree | d831cff077b97eced161a50c24d8964c0a08a416 /sql/item_subselect.h | |
parent | 078597564d699289ba76ab211f5c5c685705efa1 (diff) | |
download | mariadb-git-f5e253dc2f94029cf2904702c197aa01537ddab4.tar.gz |
reporting empty result added in case of max/min optimisation of ALL/ANY/SOME subqueries
fixed null processing in NOT operation used in ALL subquery (Bug #6247)
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r-- | sql/item_subselect.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 764c41f33b4..bd6ede49255 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -93,7 +93,7 @@ public: return null_value; } bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref); - bool exec(); + virtual bool exec(); virtual void fix_length_and_dec(); table_map used_tables() const; bool const_item() const; @@ -109,6 +109,11 @@ public: engine_changed= 1; return eng == 0; } + /* + Used by max/min subquery to initialize value presence registration + mechanism. Engine call this method before rexecution query. + */ + virtual void reset_value_registration() {} friend class select_subselect; friend class Item_in_optimizer; @@ -150,13 +155,20 @@ public: }; /* used in static ALL/ANY optimisation */ +class select_max_min_finder_subselect; class Item_maxmin_subselect :public Item_singlerow_subselect { +protected: bool max; + bool was_values; // was checked at least some values public: Item_maxmin_subselect(Item_subselect *parent, st_select_lex *select_lex, bool max); void print(String *str); + void cleanup(); + bool any_value() { return was_values; } + void register_value() { was_values= TRUE; } + void reset_value_registration() { was_values= FALSE; } }; /* exists subselect */ @@ -204,11 +216,11 @@ protected: bool abort_on_null; bool transformed; public: - Item_func_not_all *upper_not; // point on NOT before ALL subquery + Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery Item_in_subselect(Item * left_expr, st_select_lex *select_lex); Item_in_subselect() - :Item_exists_subselect(), abort_on_null(0), transformed(0), upper_not(0) + :Item_exists_subselect(), abort_on_null(0), transformed(0), upper_item(0) {} @@ -249,7 +261,7 @@ public: st_select_lex *select_lex, bool all); // only ALL subquery has upper not - subs_type substype() { return upper_not?ALL_SUBS:ANY_SUBS; } + subs_type substype() { return all?ALL_SUBS:ANY_SUBS; } trans_res select_transformer(JOIN *join); void print(String *str); }; |