diff options
author | unknown <timour@mysql.com> | 2005-08-12 19:27:54 +0300 |
---|---|---|
committer | unknown <timour@mysql.com> | 2005-08-12 19:27:54 +0300 |
commit | 2b53b711d8c36fadf3ce123a678795876fb67be4 (patch) | |
tree | 47cfdff5ea22001b614037779ee931abbc209636 /sql/sql_lex.cc | |
parent | c9415c77b5ce586b4134b91a92447fe175c4e7b2 (diff) | |
parent | 7517d7e11298da9ce9aaea8e2e42c25a640d5be9 (diff) | |
download | mariadb-git-2b53b711d8c36fadf3ce123a678795876fb67be4.tar.gz |
Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into mysql.com:/home/timka/mysql/src/5.0-2486-merge
mysql-test/r/errors.result:
Auto merged
mysql-test/r/fulltext.result:
Auto merged
mysql-test/r/fulltext_order_by.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/join_nested.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/errors.test:
Auto merged
mysql-test/t/fulltext.test:
Auto merged
mysql-test/t/fulltext_order_by.test:
Auto merged
mysql-test/t/innodb.test:
Auto merged
mysql-test/t/join_nested.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
sql/item.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
tests/mysql_client_test.c:
Auto merged
sql/sql_insert.cc:
merge WL#2486
sql/sql_show.cc:
merge WL#2486
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 674d9302c72..86e677cc8dc 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -118,8 +118,11 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->buf= lex->ptr= buf; lex->end_of_query= buf+length; + lex->context_stack.empty(); lex->unit.init_query(); lex->unit.init_select(); + /* 'parent_lex' is used in init_query() so it must be before it. */ + lex->select_lex.parent_lex= lex; lex->select_lex.init_query(); lex->value_list.empty(); lex->update_list.empty(); @@ -148,7 +151,6 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->leaf_tables_insert= lex->query_tables= 0; lex->query_tables_last= &lex->query_tables; lex->variables_used= 0; - lex->select_lex.parent_lex= lex; lex->empty_field_list_on_rset= 0; lex->select_lex.select_number= 1; lex->next_state=MY_LEX_START; @@ -1114,6 +1116,11 @@ void st_select_lex::init_query() having_fix_field= 0; context.select_lex= this; context.init(); + /* + Add the name resolution context of the current (sub)query to the + stack of contexts for the whole query. + */ + parent_lex->push_context(&context); cond_count= with_wild= 0; conds_processed_with_permanent_arena= 0; ref_pointer_array= 0; @@ -1130,7 +1137,7 @@ void st_select_lex::init_select() { st_select_lex_node::init_select(); group_list.empty(); - type= db= db1= table1= db2= table2= 0; + type= db= 0; having= 0; use_index_ptr= ignore_index_ptr= 0; table_join_options= 0; @@ -1860,8 +1867,9 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) */ if ((*link_to_local= test(select_lex.table_list.first))) { - select_lex.table_list.first= (byte*) (select_lex.context.table_list= - first->next_local); + select_lex.context.table_list= first->next_local; + select_lex.context.first_name_resolution_table= first->next_local; + select_lex.table_list.first= (byte*) (first->next_local); select_lex.table_list.elements--; //safety first->next_local= 0; /* @@ -1966,8 +1974,8 @@ void st_lex::link_first_table_back(TABLE_LIST *first, if (link_to_local) { first->next_local= (TABLE_LIST*) select_lex.table_list.first; - select_lex.table_list.first= - (byte*) (select_lex.context.table_list= first); + select_lex.context.table_list= first; + select_lex.table_list.first= (byte*) first; select_lex.table_list.elements++; //safety } } |