summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorunknown <gkodinov@dl145s.mysql.com>2006-09-18 12:20:20 +0200
committerunknown <gkodinov@dl145s.mysql.com>2006-09-18 12:20:20 +0200
commitdb1a94a7ffd31d2e028c4c45c876c549a43d3630 (patch)
treeef8b29380aeeea8e3218f0c2359ac158bcaab2f6 /sql/sql_lex.cc
parent4c8e0e192b315d8730e5dab9c757b9409ba7bdfb (diff)
parent58e178c5ccc1ea44482d9f00459275e8bf02313e (diff)
downloadmariadb-git-db1a94a7ffd31d2e028c4c45c876c549a43d3630.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-opt
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 43aeea2bf53..d0087b14d6a 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2158,15 +2158,25 @@ static void fix_prepare_info_in_table_list(THD *thd, TABLE_LIST *tbl)
/*
- fix some structures at the end of preparation
+ Save WHERE/HAVING/ON clauses and replace them with disposable copies
SYNOPSIS
st_select_lex::fix_prepare_information
- thd thread handler
- conds pointer on conditions which will be used for execution statement
+ thd thread handler
+ conds in/out pointer to WHERE condition to be met at execution
+ having_conds in/out pointer to HAVING condition to be met at execution
+
+ DESCRIPTION
+ The passed WHERE and HAVING are to be saved for the future executions.
+ This function saves it, and returns a copy which can be thrashed during
+ this execution of the statement. By saving/thrashing here we mean only
+ AND/OR trees.
+ The function also calls fix_prepare_info_in_table_list that saves all
+ ON expressions.
*/
-void st_select_lex::fix_prepare_information(THD *thd, Item **conds)
+void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
+ Item **having_conds)
{
if (!thd->stmt_arena->is_conventional() && first_execution)
{
@@ -2176,6 +2186,11 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds)
prep_where= *conds;
*conds= where= prep_where->copy_andor_structure(thd);
}
+ if (*having_conds)
+ {
+ prep_having= *having_conds;
+ *having_conds= having= prep_having->copy_andor_structure(thd);
+ }
fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
}
}