1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
sql/sql_yacc.yy:
  Auto merged
This commit is contained in:
unknown
2003-10-07 08:51:09 +03:00
3 changed files with 59 additions and 56 deletions

View File

@@ -46,7 +46,7 @@ Item_subselect::Item_subselect():
null_value= 1;
}
void Item_subselect::init(THD *thd, st_select_lex *select_lex,
void Item_subselect::init(st_select_lex *select_lex,
select_subselect *result)
{
@@ -54,11 +54,10 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex,
DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex));
if (select_lex->next_select())
engine= new subselect_union_engine(thd, select_lex->master_unit(), result,
engine= new subselect_union_engine(select_lex->master_unit(), result,
this);
else
engine= new subselect_single_select_engine(thd, select_lex, result,
this);
engine= new subselect_single_select_engine(select_lex, result, this);
DBUG_VOID_RETURN;
}
@@ -78,7 +77,7 @@ Item_subselect::select_transformer(JOIN *join)
bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
{
thd= thd_param;
engine->set_thd((thd= thd_param));
char const *save_where= thd->where;
int res= engine->prepare();
@@ -151,12 +150,11 @@ inline table_map Item_subselect::used_tables() const
(engine->uncacheable() ? RAND_TABLE_BIT : 0L));
}
Item_singlerow_subselect::Item_singlerow_subselect(THD *thd,
st_select_lex *select_lex)
Item_singlerow_subselect::Item_singlerow_subselect(st_select_lex *select_lex)
:Item_subselect(), value(0)
{
DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect");
init(thd, select_lex, new select_singlerow_subselect(this));
init(select_lex, new select_singlerow_subselect(this));
max_columns= 1;
maybe_null= 1;
max_columns= UINT_MAX;
@@ -338,12 +336,11 @@ String *Item_singlerow_subselect::val_str (String *str)
}
}
Item_exists_subselect::Item_exists_subselect(THD *thd,
st_select_lex *select_lex):
Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex):
Item_subselect()
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
null_value= 0; //can't be NULL
maybe_null= 0; //can't be NULL
@@ -368,13 +365,13 @@ bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit)
return(0);
}
Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
Item_in_subselect::Item_in_subselect(Item * left_exp,
st_select_lex *select_lex):
Item_exists_subselect(), upper_not(0)
{
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr= left_exp;
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
maybe_null= 1;
abort_on_null= 0;
@@ -384,7 +381,7 @@ Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
DBUG_VOID_RETURN;
}
Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
Item_allany_subselect::Item_allany_subselect(Item * left_exp,
compare_func_creator fn,
st_select_lex *select_lex)
:Item_in_subselect()
@@ -392,7 +389,7 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp,
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
left_expr= left_exp;
func= fn;
init(thd, select_lex, new select_exists_subselect(this));
init(select_lex, new select_exists_subselect(this));
max_columns= 1;
abort_on_null= 0;
reset();
@@ -783,12 +780,11 @@ Item_allany_subselect::select_transformer(JOIN *join)
}
subselect_single_select_engine::
subselect_single_select_engine(THD *thd,
st_select_lex *select,
select_subselect *result,
Item_subselect *item):
subselect_engine(thd, item, result),
prepared(0), optimized(0), executed(0)
subselect_single_select_engine(st_select_lex *select,
select_subselect *result,
Item_subselect *item)
:subselect_engine(item, result),
prepared(0), optimized(0), executed(0), join(0)
{
select_lex= select;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
@@ -799,24 +795,19 @@ subselect_single_select_engine::
unit->select_limit_cnt= HA_POS_ERROR; // no limit
if (unit->select_limit_cnt == HA_POS_ERROR)
select_lex->options&= ~OPTION_FOUND_ROWS;
join= new JOIN(thd, select_lex->item_list, select_lex->options, result);
if (!join || !result)
//out of memory
thd->fatal_error();
unit->item= item;
this->select_lex= select_lex;
}
subselect_union_engine::subselect_union_engine(THD *thd,
st_select_lex_unit *u,
subselect_union_engine::subselect_union_engine(st_select_lex_unit *u,
select_subselect *result,
Item_subselect *item):
subselect_engine(thd, item, result)
Item_subselect *item)
:subselect_engine(item, result)
{
unit= u;
if (!result)
//out of memory
thd->fatal_error();
current_thd->fatal_error();
unit->item= item;
}
@@ -824,6 +815,13 @@ int subselect_single_select_engine::prepare()
{
if (prepared)
return 0;
join= new JOIN(thd, select_lex->item_list, select_lex->options, result);
if (!join || !result)
{
//out of memory
thd->fatal_error();
return 1;
}
prepared= 1;
SELECT_LEX *save_select= thd->lex.current_select;
thd->lex.current_select= select_lex;