summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <gkodinov@dl145s.mysql.com>2006-09-18 12:57:20 +0200
committerunknown <gkodinov@dl145s.mysql.com>2006-09-18 12:57:20 +0200
commit5222b59093bfd3d6055ff4d375f450c4468a7366 (patch)
tree5370a5cf6745df5fd6690197a45f08ce5e60daf1 /sql/item.h
parentdaaf51fbe97d13acc13cb457ab6adc435fd93114 (diff)
parentdb1a94a7ffd31d2e028c4c45c876c549a43d3630 (diff)
downloadmariadb-git-5222b59093bfd3d6055ff4d375f450c4468a7366.tar.gz
Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1 mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/heap_hash.result: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/row.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/view_grant.result: Auto merged mysql-test/t/func_group.test: Auto merged mysql-test/t/func_str.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/view.test: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/opt_range.h: Auto merged sql/opt_sum.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/t/sp.test: SCCS merged sql/item_cmpfunc.cc: SCCS merged sql/sql_select.cc: SCCS merged
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h51
1 files changed, 49 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h
index f5a5e6e4fd9..af075c34869 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -439,7 +439,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);
@@ -776,6 +788,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)
{
@@ -813,6 +849,12 @@ public:
*/
virtual bool check_partition_func_processor(byte *bool_arg)
{ *(bool *)bool_arg= FALSE; 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; }
@@ -1315,6 +1357,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);
@@ -2222,7 +2265,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, bool walk_subquery, byte *args)
{