diff options
author | unknown <gkodinov@dl145s.mysql.com> | 2006-09-18 19:01:07 +0400 |
---|---|---|
committer | unknown <gkodinov@dl145s.mysql.com> | 2006-09-18 19:01:07 +0400 |
commit | 665ebc05d07d39eccedd754d2625e2651c23888a (patch) | |
tree | 548b719f89fcc1102691eb225571873950d7770f /sql/item.h | |
parent | 24cdd48020634acc1c2c2309a5c27d28368e0ba9 (diff) | |
parent | db1a94a7ffd31d2e028c4c45c876c549a43d3630 (diff) | |
download | mariadb-git-665ebc05d07d39eccedd754d2625e2651c23888a.tar.gz |
Merge bk-internal:/home/bk/mysql-5.0
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h index 58a3bfd0d75..0cfb0b01fd8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -410,7 +410,19 @@ public: }; -typedef bool (Item::*Item_processor)(byte *arg); +typedef bool (Item::*Item_processor) (byte *arg); +/* + Analyzer function + SYNOPSIS + argp in/out IN: Analysis parameter + OUT: Parameter to be passed to the transformer + + RETURN + TRUE Invoke the transformer + FALSE Don't do it + +*/ +typedef bool (Item::*Item_analyzer) (byte **argp); typedef Item* (Item::*Item_transformer) (byte *arg); typedef void (*Cond_traverser) (const Item *item, void *arg); @@ -736,6 +748,30 @@ public: virtual Item* transform(Item_transformer transformer, byte *arg); + /* + This function performs a generic "compilation" of the Item tree. + The process of compilation is assumed to go as follows: + + compile() + { + if (this->*some_analyzer(...)) + { + compile children if any; + this->*some_transformer(...); + } + } + + i.e. analysis is performed top-down while transformation is done + bottom-up. + */ + virtual Item* compile(Item_analyzer analyzer, byte **arg_p, + Item_transformer transformer, byte *arg_t) + { + if ((this->*analyzer) (arg_p)) + return ((this->*transformer) (arg_t)); + return 0; + } + virtual void traverse_cond(Cond_traverser traverser, void *arg, traverse_order order) { @@ -750,6 +786,12 @@ public: virtual bool change_context_processor(byte *context) { return 0; } virtual bool reset_query_id_processor(byte *query_id) { return 0; } virtual bool is_expensive_processor(byte *arg) { return 0; } + virtual bool subst_argument_checker(byte **arg) + { + if (*arg) + *arg= NULL; + return TRUE; + } virtual Item *equal_fields_propagator(byte * arg) { return this; } virtual bool set_no_const_sub(byte *arg) { return FALSE; } @@ -1251,6 +1293,7 @@ public: return field->can_be_compared_as_longlong(); } Item_equal *find_item_equal(COND_EQUAL *cond_equal); + bool subst_argument_checker(byte **arg); Item *equal_fields_propagator(byte *arg); bool set_no_const_sub(byte *arg); Item *replace_equal_field(byte *arg); @@ -2141,7 +2184,11 @@ public: { return Item_field::save_in_field(field_arg, no_conversions); } - table_map used_tables() const { return (table_map)0L; } + /* + We use RAND_TABLE_BIT to prevent Item_insert_value from + being treated as a constant and precalculated before execution + */ + table_map used_tables() const { return RAND_TABLE_BIT; } bool walk(Item_processor processor, byte *args) { |