From 481cd2dbf1312f60d320598ee7a40ecb77da1930 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jan 2011 13:31:17 +0200 Subject: Fix of problem with WHERE/HAVING consist of alone outer reference field by wrapping it. sql/item.cc: Wrapper added. sql/item.h: Wrapper added. sql/mysql_priv.h: Wrap function added. sql/sql_base.cc: Wrap function added. Fix of problem with WHERE consist of alone outer reference field by wrapping it. sql/sql_select.cc: Fix of problem with HAVING consist of alone outer reference field by wrapping it. --- sql/item.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'sql/item.cc') diff --git a/sql/item.cc b/sql/item.cc index 188200bd7bd..a3a80ab6777 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6619,6 +6619,40 @@ bool Item_direct_ref::get_date(MYSQL_TIME *ltime,uint fuzzydate) } +Item* Item_direct_ref_to_ident::transform(Item_transformer transformer, + uchar *argument) +{ + DBUG_ASSERT(!current_thd->is_stmt_prepare()); + + Item *new_item= ident->transform(transformer, argument); + if (!new_item) + return 0; + DBUG_ASSERT(new_item->type() == FIELD_ITEM || new_item->type() == REF_ITEM); + + if (ident != new_item) + current_thd->change_item_tree((Item**)&ident, new_item); + return (this->*transformer)(argument); +} + + +Item* Item_direct_ref_to_ident::compile(Item_analyzer analyzer, uchar **arg_p, + Item_transformer transformer, + uchar *arg_t) +{ + if (!(this->*analyzer)(arg_p)) + return 0; + + uchar *arg_v= *arg_p; + Item *new_item= ident->compile(analyzer, &arg_v, transformer, arg_t); + if (new_item && ident != new_item) + { + DBUG_ASSERT(new_item->type() == FIELD_ITEM || new_item->type() == REF_ITEM); + current_thd->change_item_tree((Item**)&ident, new_item); + } + return (this->*transformer)(arg_t); +} + + Item_cache_wrapper::~Item_cache_wrapper() { delete expr_cache; -- cgit v1.2.1