mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merging 4.1 -> 5.0
This commit is contained in:
@ -195,7 +195,8 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
|
||||
send_error(thd, 0, NullS);
|
||||
res= 1;
|
||||
}
|
||||
delete result;
|
||||
if (result != lex->result)
|
||||
delete result;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -491,8 +492,8 @@ JOIN::optimize()
|
||||
optimized= 1;
|
||||
|
||||
// Ignore errors of execution if option IGNORE present
|
||||
if (thd->lex.duplicates == DUP_IGNORE)
|
||||
thd->lex.current_select->no_error= 1;
|
||||
if (thd->lex->duplicates == DUP_IGNORE)
|
||||
thd->lex->current_select->no_error= 1;
|
||||
#ifdef HAVE_REF_TO_FIELDS // Not done yet
|
||||
/* Add HAVING to WHERE if possible */
|
||||
if (having && !group_list && !sum_func_count)
|
||||
@ -969,7 +970,7 @@ JOIN::optimize()
|
||||
}
|
||||
}
|
||||
|
||||
if (select_lex != &thd->lex.select_lex &&
|
||||
if (select_lex != &thd->lex->select_lex &&
|
||||
select_lex->linkage != DERIVED_TABLE_TYPE)
|
||||
{
|
||||
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
|
||||
@ -2381,7 +2382,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
|
||||
|
||||
if (!(key_fields=(KEY_FIELD*)
|
||||
thd->alloc(sizeof(key_fields[0])*
|
||||
(thd->lex.current_select->cond_count+1)*2)))
|
||||
(thd->lex->current_select->cond_count+1)*2)))
|
||||
return TRUE; /* purecov: inspected */
|
||||
and_level=0; end=key_fields;
|
||||
if (cond)
|
||||
@ -3414,7 +3415,7 @@ static void
|
||||
make_join_readinfo(JOIN *join, uint options)
|
||||
{
|
||||
uint i;
|
||||
SELECT_LEX *select_lex = &(join->thd->lex.select_lex);
|
||||
SELECT_LEX *select_lex = &(join->thd->lex->select_lex);
|
||||
DBUG_ENTER("make_join_readinfo");
|
||||
|
||||
for (i=join->const_tables ; i < join->tables ; i++)
|
||||
@ -5172,7 +5173,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
||||
thd->proc_info="converting HEAP to MyISAM";
|
||||
|
||||
if (create_myisam_tmp_table(&new_table,param,
|
||||
thd->lex.select_lex.options | thd->options))
|
||||
thd->lex->select_lex.options | thd->options))
|
||||
goto err2;
|
||||
if (open_tmp_table(&new_table))
|
||||
goto err1;
|
||||
@ -5368,7 +5369,7 @@ sub_select_cache(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
||||
}
|
||||
if (join->thd->killed) // If aborted by user
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
return -2; /* purecov: inspected */
|
||||
}
|
||||
if (join_tab->use_quick != 2 || test_if_quick_select(join_tab) <= 0)
|
||||
@ -5408,7 +5409,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
||||
{
|
||||
if (join->thd->killed) // Aborted by user
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
return -2; /* purecov: inspected */
|
||||
}
|
||||
join->examined_rows++;
|
||||
@ -5489,7 +5490,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skipp_last)
|
||||
{
|
||||
if (join->thd->killed)
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
return -2; // Aborted by user /* purecov: inspected */
|
||||
}
|
||||
SQL_SELECT *select=join_tab->select;
|
||||
@ -6113,7 +6114,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
|
||||
if (join->thd->killed) // Aborted by user
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
DBUG_RETURN(-2); /* purecov: inspected */
|
||||
}
|
||||
if (!end_of_records)
|
||||
@ -6181,7 +6182,7 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
DBUG_RETURN(0);
|
||||
if (join->thd->killed) // Aborted by user
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
DBUG_RETURN(-2); /* purecov: inspected */
|
||||
}
|
||||
|
||||
@ -6251,7 +6252,7 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
DBUG_RETURN(0);
|
||||
if (join->thd->killed) // Aborted by user
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
DBUG_RETURN(-2); /* purecov: inspected */
|
||||
}
|
||||
|
||||
@ -6298,7 +6299,7 @@ end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
|
||||
if (join->thd->killed)
|
||||
{ // Aborted by user
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0)); /* purecov: inspected */
|
||||
join->thd->send_kill_message();
|
||||
DBUG_RETURN(-2); /* purecov: inspected */
|
||||
}
|
||||
if (!join->first_record || end_of_records ||
|
||||
@ -7050,7 +7051,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
|
||||
{
|
||||
if (thd->killed)
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0));
|
||||
thd->send_kill_message();
|
||||
error=0;
|
||||
goto err;
|
||||
}
|
||||
@ -7162,7 +7163,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
|
||||
{
|
||||
if (thd->killed)
|
||||
{
|
||||
my_error(ER_SERVER_SHUTDOWN,MYF(0));
|
||||
thd->send_kill_message();
|
||||
error=0;
|
||||
goto err;
|
||||
}
|
||||
@ -8641,7 +8642,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
||||
List<Item> field_list;
|
||||
List<Item> item_list;
|
||||
THD *thd=join->thd;
|
||||
SELECT_LEX *select_lex = &(join->thd->lex.select_lex);
|
||||
SELECT_LEX *select_lex = &(join->thd->lex->select_lex);
|
||||
select_result *result=join->result;
|
||||
Item *item_null= new Item_null();
|
||||
CHARSET_INFO *cs= &my_charset_latin1;
|
||||
@ -8826,8 +8827,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
||||
sl= sl->next_select())
|
||||
{
|
||||
res= mysql_explain_select(thd, sl,
|
||||
(((&thd->lex.select_lex)==sl)?
|
||||
((thd->lex.all_selects_list != sl)?"PRIMARY":
|
||||
(((&thd->lex->select_lex)==sl)?
|
||||
((thd->lex->all_selects_list != sl)?"PRIMARY":
|
||||
"SIMPLE"):
|
||||
((sl == first)?
|
||||
((sl->linkage == DERIVED_TABLE_TYPE) ?
|
||||
@ -8855,7 +8856,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
|
||||
DBUG_ENTER("mysql_explain_select");
|
||||
DBUG_PRINT("info", ("Select 0x%lx, type %s", (ulong)select_lex, type))
|
||||
select_lex->type= type;
|
||||
thd->lex.current_select= select_lex;
|
||||
thd->lex->current_select= select_lex;
|
||||
SELECT_LEX_UNIT *unit= select_lex->master_unit();
|
||||
int res= mysql_select(thd, &select_lex->ref_pointer_array,
|
||||
(TABLE_LIST*) select_lex->table_list.first,
|
||||
@ -8866,7 +8867,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
|
||||
(ORDER*) select_lex->order_list.first,
|
||||
(ORDER*) select_lex->group_list.first,
|
||||
select_lex->having,
|
||||
(ORDER*) thd->lex.proc_list.first,
|
||||
(ORDER*) thd->lex->proc_list.first,
|
||||
select_lex->options | thd->options | SELECT_DESCRIBE,
|
||||
result, unit, select_lex, 0);
|
||||
DBUG_RETURN(res);
|
||||
|
Reference in New Issue
Block a user