Merge with MySQL 5.1.49

Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
This commit is contained in:
Michael Widenius 2010-08-02 12:01:24 +03:00
commit e0a6b02c5d
610 changed files with 27019 additions and 15561 deletions

View file

@ -34,6 +34,36 @@
extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
/**
Helper function which operates on a THD object to set the query start_time to
the current time.
@param[in, out] thd The session object
*/
static void reset_start_time_for_sp(THD *thd)
{
/*
Do nothing if the context is a trigger or function because time should be
constant during the execution of those.
*/
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);
}
}
}
Item_result
sp_map_result_type(enum enum_field_types type)
{
@ -1225,10 +1255,13 @@ sp_head::execute(THD *thd)
DBUG_PRINT("execute", ("Instruction %u", ip));
/* Don't change NOW() in FUNCTION or TRIGGER */
if (!thd->in_sub_stmt)
thd->set_time(); // Make current_time() et al work
/*
We need to reset start_time to allow for time to flow inside a stored
procedure. This is only done for SP since time is suppose to be constant
during execution of triggers and functions.
*/
reset_start_time_for_sp(thd);
/*
We have to set thd->stmt_arena before executing the instruction
to store in the instruction free_list all new items, created
@ -1840,8 +1873,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
{
bool err_status= FALSE;
uint params = m_pcont->context_var_count();
/* Query start time may be reset in a multi-stmt SP; keep this for later. */
ulonglong utime_before_sp_exec= thd->utime_after_lock;
sp_rcontext *save_spcont, *octx;
sp_rcontext *nctx = NULL;
bool save_enable_slow_log;
@ -2034,8 +2065,6 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
delete nctx;
thd->spcont= save_spcont;
thd->utime_after_lock= utime_before_sp_exec;
DBUG_RETURN(err_status);
}