diff options
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index df258d49c0a..6e17c974c2c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -26,6 +26,7 @@ #include "sql_acl.h" // *_ACL #include "sql_array.h" // Dynamic_array #include "log_event.h" // append_query_string, Query_log_event +#include "sql_derived.h" // mysql_handle_derived #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation @@ -62,19 +63,7 @@ extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first); static void reset_start_time_for_sp(THD *thd) { if (!thd->in_sub_stmt) - { - /* - First investigate if there is a cached time stamp - */ - if (thd->user_time) - { - thd->start_time= thd->user_time; - } - else - { - my_micro_time_and_time(&thd->start_time); - } - } + thd->set_start_time(); } Item_result @@ -3066,6 +3055,9 @@ int sp_instr::exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables) result= -1; else result= 0; + /* Prepare all derived tables/views to catch possible errors. */ + if (!result) + result= mysql_handle_derived(thd->lex, DT_PREPARE) ? -1 : 0; return result; } |