diff options
author | bell@sanja.is.com.ua <> | 2004-04-08 00:19:43 +0300 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2004-04-08 00:19:43 +0300 |
commit | 56be6f3f9325f056b5343fc9a4a122f30e280d12 (patch) | |
tree | 8623a46473c8c2cb769c792a41b7a28bae698da7 /sql/sql_lex.cc | |
parent | 3b6c3dd2f5b2416a02b0a878187e977d9bf1d044 (diff) | |
parent | 5e37c41faee13cdc977842d253e6da0266766baf (diff) | |
download | mariadb-git-56be6f3f9325f056b5343fc9a4a122f30e280d12.tar.gz |
merge
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 4c63a8b7c7f..7fa0591ddc8 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1635,6 +1635,66 @@ void st_select_lex::print_limit(THD *thd, String *str) } /* + unlink first table from table lists + + SYNOPSIS + unlink_first_table() + tables - global table list + global_first - save first global table passed using this parameter + local_first - save first local table passed using this parameter + + RETURN + global list without first table +*/ +TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, + TABLE_LIST **global_first, + TABLE_LIST **local_first) +{ + *global_first= tables; + *local_first= (TABLE_LIST*)select_lex.table_list.first; + // exclude from global table list + tables= tables->next; + // and from local list if it is not the same + if (&select_lex != all_selects_list) + select_lex.table_list.first= (gptr)(*local_first)->next; + else + select_lex.table_list.first= (gptr)tables; + (*global_first)->next= 0; + return tables; +} + +/* + link unlinked first table back + + SYNOPSIS + link_first_table_back() + tables - global table list + global_first - save first global table + local_first - save first local table + + RETURN + global list +*/ +TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, + TABLE_LIST *global_first, + TABLE_LIST *local_first) +{ + global_first->next= tables; + tables= global_first; + if (&select_lex != all_selects_list) + { + /* + we do not touch local table 'next' field => we need just + put the table in the list + */ + select_lex.table_list.first= (gptr) local_first; + } + else + select_lex.table_list.first= (gptr) tables; + return tables; +} + +/* There are st_select_lex::add_table_to_list & st_select_lex::set_lock_for_tables are in sql_parse.cc |