summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2011-01-24 13:31:17 +0200
committerunknown <sanja@askmonty.org>2011-01-24 13:31:17 +0200
commit481cd2dbf1312f60d320598ee7a40ecb77da1930 (patch)
treed88616229c2a15b35c8d49a2ecc0a4ec4258ac1e /sql/item.cc
parent2038256bede201f025cac384a9043627a83afd5d (diff)
downloadmariadb-git-481cd2dbf1312f60d320598ee7a40ecb77da1930.tar.gz
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.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc34
1 files changed, 34 insertions, 0 deletions
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;