Commit 0c6cb114 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

subselect clean up

fix after automerge
parent 1a885421
...@@ -1922,7 +1922,7 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables) ...@@ -1922,7 +1922,7 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables)
if (thd && check_stack_overrun(thd,buff)) if (thd && check_stack_overrun(thd,buff))
return 0; // Fatal error if flag is set! return 0; // Fatal error if flag is set!
if (args[0]->fix_fields(thd,tables)) if (args[0]->fix_fields(thd, tables, args))
return 1; return 1;
maybe_null=args[0]->maybe_null; maybe_null=args[0]->maybe_null;
binary=args[0]->binary; binary=args[0]->binary;
......
...@@ -240,6 +240,7 @@ typedef struct st_select_lex_unit SELECT_LEX_UNIT; ...@@ -240,6 +240,7 @@ typedef struct st_select_lex_unit SELECT_LEX_UNIT;
/* /*
SELECT_LEX - store information of parsed SELECT_LEX statment SELECT_LEX - store information of parsed SELECT_LEX statment
*/ */
class JOIN;
class st_select_lex: public st_select_lex_node { class st_select_lex: public st_select_lex_node {
public: public:
char *db, *db1, *table1, *db2, *table2; /* For outer join using .. */ char *db, *db1, *table1, *db2, *table2; /* For outer join using .. */
...@@ -251,12 +252,13 @@ public: ...@@ -251,12 +252,13 @@ public:
List<String> interval_list, use_index, *use_index_ptr, List<String> interval_list, use_index, *use_index_ptr,
ignore_index, *ignore_index_ptr; ignore_index, *ignore_index_ptr;
List<Item_func_match> ftfunc_list; List<Item_func_match> ftfunc_list;
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
uint in_sum_expr; uint in_sum_expr;
bool create_refs, bool create_refs,
braces, /* SELECT ... UNION (SELECT ... ) <- this braces */ braces, /* SELECT ... UNION (SELECT ... ) <- this braces */
depended, /* depended from outer select subselect */ depended, /* depended from outer select subselect */
/* TRUE when having fix field called in processing of this SELECT */ /* TRUE when having fix field called in processing of this SELECT */
having_fix_field; having_fix_field;e
void init_query(); void init_query();
void init_select(); void init_select();
......
...@@ -211,6 +211,7 @@ JOIN::prepare(TABLE_LIST *tables_init, ...@@ -211,6 +211,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
proc_param= proc_param_init; proc_param= proc_param_init;
tables_list= tables_init; tables_list= tables_init;
select_lex= select; select_lex= select;
select->join= this;
union_part= (unit->first_select()->next_select() != 0); union_part= (unit->first_select()->next_select() != 0);
/* Check that all tables, fields, conds and order are ok */ /* Check that all tables, fields, conds and order are ok */
...@@ -974,6 +975,21 @@ JOIN::cleanup(THD *thd) ...@@ -974,6 +975,21 @@ JOIN::cleanup(THD *thd)
delete select; delete select;
delete_dynamic(&keyuse); delete_dynamic(&keyuse);
delete procedure; delete procedure;
for (SELECT_LEX_UNIT *unit= select_lex->first_inner_unit();
unit != 0;
unit= unit->next_unit())
for (SELECT_LEX *sl= unit->first_select();
sl != 0;
sl= sl->next_select())
{
if (sl->join)
{
int err= sl->join->cleanup(thd);
if (err)
error= err;
sl->join= 0;
}
}
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment