summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2004-10-09 10:34:13 -0700
committerigor@rurik.mysql.com <>2004-10-09 10:34:13 -0700
commit71f6ab7a09fa8cb225315f74caae6b507af9a029 (patch)
tree84324c7af32f54d423310e3a2ee3255f7f43749b /sql/item.h
parent80d2d8d662d9e3db96295d831358a5d633a3c2eb (diff)
parent0dcc255b9b64df1767091c438678049cc1acdd7e (diff)
downloadmariadb-git-71f6ab7a09fa8cb225315f74caae6b507af9a029.tar.gz
Merge for Item_equal.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h
index 71db03ad687..9826bcb4a5a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -90,6 +90,7 @@ public:
};
typedef bool (Item::*Item_processor)(byte *arg);
+typedef Item* (Item::*Item_transformer) (byte *arg);
class Item {
Item(const Item &); /* Prevent use of these */
@@ -261,8 +262,15 @@ public:
return (this->*processor)(arg);
}
+ virtual Item* transform(Item_transformer transformer, byte *arg)
+ {
+ return (this->*transformer)(arg);
+ }
+
virtual bool remove_dependence_processor(byte * arg) { return 0; }
virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; }
+ virtual Item *equal_fields_propagator(byte * arg) { return this; }
+ virtual bool replace_equal_field_processor(byte * arg) { return 0; }
virtual Item *this_item() { return this; } /* For SPs mostly. */
virtual Item *this_const_item() const { return const_cast<Item*>(this); } /* For SPs mostly. */
@@ -440,6 +448,8 @@ public:
bool any_privileges, bool allocate_view_names);
};
+class Item_equal;
+class COND_EQUAL;
class Item_field :public Item_ident
{
@@ -458,7 +468,8 @@ public:
Item_field(const char *db_par,const char *table_name_par,
const char *field_name_par)
:Item_ident(db_par,table_name_par,field_name_par),
- field(0), result_field(0), have_privileges(0), any_privileges(0)
+ field(0), result_field(0), item_equal(0),}
+ have_privileges(0), any_privileges(0)
{ collation.set(DERIVATION_IMPLICIT); }
// Constructor need to process subselect with temporary tables (see Item)
Item_field(THD *thd, Item_field *item);
@@ -498,6 +509,9 @@ public:
bool is_null() { return field->is_null(); }
Item *get_tmp_table_item(THD *thd);
void cleanup();
+ Item_equal *find_item_equal(COND_EQUAL *cond_equal);
+ Item *equal_fields_propagator(byte *arg);
+ bool replace_equal_field_processor(byte *arg);
inline uint32 max_disp_length() { return field->max_length(); }
Item_field *filed_for_view_update() { return this; }
friend class Item_default_value;
@@ -1173,6 +1187,19 @@ public:
return arg->walk(processor, args) ||
(this->*processor)(args);
}
+
+ /*
+ This method like the walk method traverses the item tree, but
+ at the same time it can replace some nodes in the tree
+ */
+ Item *transform(Item_transformer transformer, byte *args)
+ {
+ Item *new_item= arg->transform(transformer, args);
+ if (!new_item)
+ return 0;
+ arg= new_item;
+ return (this->*transformer)(args);
+ }
};
class Item_insert_value : public Item_field