summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2004-05-20 02:02:49 +0300
committerbell@sanja.is.com.ua <>2004-05-20 02:02:49 +0300
commitc7396f8d207510456e37143a3f3e1d0ae7c1a305 (patch)
treede54f6ead302056d37992e52523ed0bec48700fc /sql/sql_update.cc
parent9620715679e21196e087a57f10f42b974c281fe3 (diff)
downloadmariadb-git-c7396f8d207510456e37143a3f3e1d0ae7c1a305.tar.gz
PS and SP made compatible in mechanism used for preparing query for rexecutions (Bug #2266)
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 918a4c769b4..5c6ed023485 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -425,6 +425,7 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
TABLE *table= table_list->table;
TABLE_LIST tables;
List<Item> all_fields;
+ SELECT_LEX *select_lex= &thd->lex->select_lex;
DBUG_ENTER("mysql_prepare_update");
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -437,10 +438,10 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
if (setup_tables(update_table_list) ||
setup_conds(thd, update_table_list, conds) ||
- thd->lex->select_lex.setup_ref_array(thd, order_num) ||
- setup_order(thd, thd->lex->select_lex.ref_pointer_array,
+ select_lex->setup_ref_array(thd, order_num) ||
+ setup_order(thd, select_lex->ref_pointer_array,
update_table_list, all_fields, all_fields, order) ||
- setup_ftfuncs(&thd->lex->select_lex))
+ setup_ftfuncs(select_lex))
DBUG_RETURN(-1);
/* Check that we are not using table that we are updating in a sub select */
@@ -450,6 +451,11 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1);
}
+ if (thd->current_arena && select_lex->first_execution)
+ {
+ select_lex->prep_where= select_lex->where;
+ select_lex->first_execution= 0;
+ }
DBUG_RETURN(0);
}