1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

removed SELECT_LEX_UNIT -> SELECT_LEX pointer conversion (SCRUM)

fixed some possible bugs
This commit is contained in:
bell@sanja.is.com.ua
2002-10-30 13:18:52 +02:00
parent 9adf688be6
commit 1f20cf3b42
16 changed files with 569 additions and 281 deletions

View File

@ -2908,9 +2908,9 @@ mysql_init_query(THD *thd)
thd->select_number= thd->lex.select_lex.select_number= 1;
thd->lex.value_list.empty();
thd->free_list= 0;
thd->lex.select= &thd->lex.select_lex;
thd->lex.current_select= &thd->lex.select_lex;
thd->lex.olap=thd->lex.describe=0;
thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
thd->lex.select_lex.olap= UNSPECIFIED_OLAP_TYPE;
thd->fatal_error= 0; // Safety
thd->total_warn_count=0; // Warnings for this query
thd->last_insert_id_used= thd->query_start_used= thd->insert_id_used=0;
@ -2924,7 +2924,8 @@ mysql_init_query(THD *thd)
void
mysql_init_select(LEX *lex)
{
SELECT_LEX *select_lex= lex->select;
SELECT_LEX *select_lex= (SELECT_LEX *)lex->current_select;
DBUG_ASSERT(select_lex->linkage != GLOBAL_OPTIONS_TYPE);
select_lex->init_select();
select_lex->master_unit()->select_limit= select_lex->select_limit=
lex->thd->variables.select_limit;
@ -2938,7 +2939,7 @@ mysql_init_select(LEX *lex)
bool
mysql_new_select(LEX *lex, bool move_down)
{
SELECT_LEX *select_lex = (SELECT_LEX *) lex->thd->calloc(sizeof(SELECT_LEX));
SELECT_LEX *select_lex = new SELECT_LEX();
select_lex->select_number= ++lex->thd->select_number;
if (!select_lex)
return 1;
@ -2947,21 +2948,22 @@ mysql_new_select(LEX *lex, bool move_down)
if (move_down)
{
/* first select_lex of subselect or derived table */
SELECT_LEX_UNIT *unit=
(SELECT_LEX_UNIT *) lex->thd->calloc(sizeof(SELECT_LEX_UNIT));
SELECT_LEX_UNIT *unit= new SELECT_LEX_UNIT();
if (!unit)
return 1;
unit->init_query();
unit->init_select();
unit->include_down(lex->select);
unit->include_down(lex->current_select);
select_lex->include_down(unit);
}
else
select_lex->include_neighbour(lex->select);
select_lex->include_neighbour(lex->current_select);
select_lex->master_unit()->global_parameters= select_lex;
select_lex->include_global(lex->select->next_select_in_list_addr());
lex->select= select_lex;
DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
select_lex->include_global(((SELECT_LEX*)lex->current_select)->
next_select_in_list_addr());
lex->current_select= select_lex;
return 0;
}
@ -2997,10 +2999,10 @@ void mysql_init_multi_delete(LEX *lex)
{
lex->sql_command= SQLCOM_DELETE_MULTI;
mysql_init_select(lex);
lex->select->select_limit= lex->select->master_unit()->select_limit_cnt=
lex->select_lex.select_limit= lex->unit.select_limit_cnt=
HA_POS_ERROR;
lex->auxilliary_table_list= lex->select_lex.table_list;
lex->select->init_query();
lex->select_lex.init_query();
}
@ -3410,12 +3412,12 @@ bool add_to_list(SQL_LIST &list,Item *item,bool asc)
}
TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
bool updating,
thr_lock_type flags,
List<String> *use_index,
List<String> *ignore_index
)
TABLE_LIST *st_select_lex::add_table_to_list(Table_ident *table,
LEX_STRING *alias,
bool updating,
thr_lock_type flags,
List<String> *use_index,
List<String> *ignore_index)
{
register TABLE_LIST *ptr;
THD *thd=current_thd;
@ -3477,7 +3479,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
/* check that used name is unique */
if (flags != TL_IGNORE)
{
for (TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select->table_list.first ;
for (TABLE_LIST *tables=(TABLE_LIST*) table_list.first ;
tables ;
tables=tables->next)
{
@ -3488,7 +3490,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
}
}
}
link_in_list(&thd->lex.select->table_list,(byte*) ptr,(byte**) &ptr->next);
link_in_list(&table_list, (byte*) ptr, (byte**) &ptr->next);
DBUG_RETURN(ptr);
}
@ -3691,7 +3693,7 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
bool check_simple_select()
{
THD *thd= current_thd;
if (thd->lex.select != &thd->lex.select_lex)
if (thd->lex.current_select != &thd->lex.select_lex)
{
char command[80];
strmake(command, thd->lex.yylval->symbol.str,