Commit 0a073770 authored by unknown's avatar unknown

after review patch

commant for function


sql/item_subselect.cc:
  redusing number of parameters
sql/sql_derived.cc:
  redusing number of parameters
sql/sql_lex.cc:
  redusing number of parameters
  comment for function
sql/sql_lex.h:
  redusing number of parameters
sql/sql_parse.cc:
  redusing number of parameters
sql/sql_select.cc:
  redusing number of parameters
sql/sql_union.cc:
  redusing number of parameters
parent 8cd70922
......@@ -883,9 +883,7 @@ subselect_single_select_engine(st_select_lex *select,
{
select_lex= select;
SELECT_LEX_UNIT *unit= select_lex->master_unit();
unit->set_limit(unit->global_parameters->select_limit,
unit->global_parameters->offset_limit,
select_lex);
unit->set_limit(unit->global_parameters, select_lex);
unit->item= item;
this->select_lex= select_lex;
}
......
......@@ -154,8 +154,7 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
res= mysql_union(thd, lex, derived_result, unit);
else
{
unit->set_limit(first_select->select_limit, first_select->offset_limit,
first_select);
unit->set_limit(first_select, first_select);
lex->current_select= first_select;
res= mysql_select(thd, &first_select->ref_pointer_array,
......
......@@ -1635,12 +1635,20 @@ void st_select_lex::print_limit(THD *thd, String *str)
}
}
void st_select_lex_unit::set_limit(ha_rows limit, ha_rows offset,
/*
initialize limit counters
SYNOPSIS
st_select_lex_unit::set_limit()
values - SELECT_LEX with initial values for counters
sl - SELECT_LEX for options set
*/
void st_select_lex_unit::set_limit(SELECT_LEX *values,
SELECT_LEX *sl)
{
offset_limit_cnt= offset;
select_limit_cnt= limit+offset;
if (select_limit_cnt < limit)
offset_limit_cnt= values->offset_limit;
select_limit_cnt= values->select_limit+values->offset_limit;
if (select_limit_cnt < values->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
sl->options&= ~OPTION_FOUND_ROWS;
......
......@@ -371,7 +371,7 @@ class st_select_lex_unit: public st_select_lex_node {
bool check_updateable(char *db, char *table);
void print(String *str);
void set_limit(ha_rows limit, ha_rows offset, st_select_lex *sl);
void set_limit(st_select_lex *values, st_select_lex *sl);
friend void mysql_init_query(THD *thd, bool lexonly);
friend int subselect_union_engine::exec();
......
......@@ -2179,8 +2179,7 @@ mysql_execute_command(THD *thd)
if (tables && check_table_access(thd, SELECT_ACL, tables,0))
goto error; // Error message is given
select_lex->options|= SELECT_NO_UNLOCK;
unit->set_limit(select_lex->select_limit, select_lex->offset_limit,
select_lex);
unit->set_limit(select_lex, select_lex);
if (!(res=open_and_lock_tables(thd,tables)))
{
......@@ -2580,8 +2579,7 @@ mysql_execute_command(THD *thd)
select_lex->options|= SELECT_NO_UNLOCK;
select_result *result;
unit->set_limit(select_lex->select_limit, select_lex->offset_limit,
select_lex);
unit->set_limit(select_lex, select_lex);
if (find_real_table_in_list(tables->next, tables->db, tables->real_name))
{
......
......@@ -179,9 +179,7 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
else
{
SELECT_LEX_UNIT *unit= &lex->unit;
unit->set_limit(unit->global_parameters->select_limit,
unit->global_parameters->offset_limit,
select_lex);
unit->set_limit(unit->global_parameters, select_lex);
res= mysql_select(thd, &select_lex->ref_pointer_array,
(TABLE_LIST*) select_lex->table_list.first,
select_lex->with_wild, select_lex->item_list,
......@@ -1015,8 +1013,7 @@ JOIN::reinit()
{
DBUG_ENTER("JOIN::reinit");
/* TODO move to unit reinit */
unit->set_limit(select_lex->select_limit, select_lex->offset_limit,
select_lex);
unit->set_limit(select_lex, select_lex);
if (setup_tables(tables_list, 1))
DBUG_RETURN(1);
......@@ -9267,8 +9264,7 @@ int mysql_explain_select(THD *thd, SELECT_LEX *select_lex, char const *type,
unit->select_limit_cnt= HA_POS_ERROR;
}
else
unit->set_limit(select_lex->select_limit, select_lex->offset_limit,
select_lex);
unit->set_limit(select_lex, select_lex);
int res= mysql_select(thd, &select_lex->ref_pointer_array,
(TABLE_LIST*) select_lex->table_list.first,
select_lex->with_wild, select_lex->item_list,
......
......@@ -151,7 +151,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
sl->options | thd_arg->options | additional_options,
tmp_result);
thd_arg->lex->current_select= sl;
set_limit(sl->select_limit, sl->offset_limit, sl);
set_limit(sl, sl);
if (sl->braces)
sl->options&= ~OPTION_FOUND_ROWS;
......@@ -375,9 +375,7 @@ int st_select_lex_unit::exec()
{
thd->lex->current_select= fake_select_lex;
fake_select_lex->options= thd->options;
set_limit(global_parameters->select_limit,
global_parameters->offset_limit,
fake_select_lex);
set_limit(global_parameters, fake_select_lex);
if (found_rows_for_union && !thd->lex->describe &&
select_limit_cnt != HA_POS_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