diff options
author | dlenev@mysql.com <> | 2005-01-28 09:32:43 +0300 |
---|---|---|
committer | dlenev@mysql.com <> | 2005-01-28 09:32:43 +0300 |
commit | c80c503a1b869bfde11b104fdde9d05f3d0de5a0 (patch) | |
tree | 6ab480710ff3945ba2b743ac5acb104b3f7d3f02 /sql/sql_lex.cc | |
parent | 3800cede90d58c83f18c6c20c686455e864a3f4e (diff) | |
parent | 80282016c230ea6e91d629b1147a40e262487cb0 (diff) | |
download | mariadb-git-c80c503a1b869bfde11b104fdde9d05f3d0de5a0.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-tzbug
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e0cb43e093e..3ac783da9c4 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1718,8 +1718,8 @@ st_lex::st_lex() global_first Save first global table here local_first Save first local table here - NORES - global_first & local_first are used to save result for link_first_table_back + NOTES + This function assumes that outer select list is non-empty. RETURN global list without first table @@ -1729,25 +1729,25 @@ 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; + DBUG_ASSERT(select_lex.table_list.first != 0); /* - Exclude from global table list + Save pointers to first elements of global table list and list + of tables used in outer select. It does not harm if these lists + are the same. */ + *global_first= tables; + *local_first= (TABLE_LIST*)select_lex.table_list.first; + + /* Exclude first elements from these lists */ + select_lex.table_list.first= (byte*) (*local_first)->next; tables= tables->next; - /* - and from local list if it is not the same - */ - select_lex.table_list.first= ((&select_lex != all_selects_list) ? - (byte*) (*local_first)->next : - (byte*) tables); (*global_first)->next= 0; return tables; } /* - Link table back that was unlinked with unlink_first_table() + Link table which was unlinked with unlink_first_table() back. SYNOPSIS link_first_table_back() @@ -1763,16 +1763,7 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, TABLE_LIST *local_first) { global_first->next= tables; - 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= (byte*) local_first; - } - else - select_lex.table_list.first= (byte*) global_first; + select_lex.table_list.first= (byte*) local_first; return global_first; } |