summaryrefslogtreecommitdiff
path: root/sql/item.h
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.h
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.h')
-rw-r--r--sql/item.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h
index f78f25bb9d2..76df608ab29 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -518,7 +518,7 @@ public:
SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER,
PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM,
XPATH_NODESET, XPATH_NODESET_CMP,
- VIEW_FIXER_ITEM, EXPR_CACHE_ITEM};
+ VIEW_FIXER_ITEM, EXPR_CACHE_ITEM, UNKNOWN_ITEM};
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
@@ -612,7 +612,7 @@ public:
virtual Item_result cast_to_int_type() const { return result_type(); }
virtual enum_field_types string_field_type() const;
virtual enum_field_types field_type() const;
- virtual enum Type type() const =0;
+ virtual enum Type type() const { return UNKNOWN_ITEM; };
/*
Return information about function monotonicity. See comment for
@@ -2609,6 +2609,43 @@ public:
virtual Ref_Type ref_type() { return DIRECT_REF; }
};
+
+/**
+ This class is the same as Item_direct_ref but created to wrap Item_ident
+ before fix_fields() call
+*/
+
+class Item_direct_ref_to_ident :public Item_direct_ref
+{
+ Item_ident *ident;
+public:
+ Item_direct_ref_to_ident(Item_ident *item)
+ :Item_direct_ref(item->context, (Item**)&item, item->table_name, item->field_name,
+ FALSE)
+ {
+ ident= item;
+ ref= (Item**)&ident;
+ }
+
+ bool fix_fields(THD *thd, Item **it)
+ {
+ DBUG_ASSERT(ident->type() == FIELD_ITEM || ident->type() == REF_ITEM);
+ if ((!ident->fixed && ident->fix_fields(thd, ref)) ||
+ ident->check_cols(1))
+ return TRUE;
+ set_properties();
+ return FALSE;
+ }
+
+ virtual void print(String *str, enum_query_type query_type)
+ { ident->print(str, query_type); }
+
+ virtual Item* transform(Item_transformer transformer, uchar *arg);
+ virtual Item* compile(Item_analyzer analyzer, uchar **arg_p,
+ Item_transformer transformer, uchar *arg_t);
+};
+
+
class Expression_cache;
class Item_cache;