diff options
author | unknown <timour@mysql.com> | 2005-11-28 21:57:50 +0200 |
---|---|---|
committer | unknown <timour@mysql.com> | 2005-11-28 21:57:50 +0200 |
commit | 4fd41f7c0bd7e61265e219aecada2e7b36df88c3 (patch) | |
tree | e240ac23234a12c571460f2d81c1fa3ad1bfb391 /sql/item.h | |
parent | 97bfd41fe1382ff33a9fc458c0bd092342b217e5 (diff) | |
download | mariadb-git-4fd41f7c0bd7e61265e219aecada2e7b36df88c3.tar.gz |
WL#2486 - Natural/using join according to SQL:2003.
Post-review fixes according to Monty's review.
sql/item.h:
Unite all code that stores and restores the state of a name resolution context
into a class to represent the state, and methods to save/restore that
state.
sql/mysql_priv.h:
Reorder parameters so that length is after the name of a field,
and database is before table name.
sql/sql_acl.cc:
Reorder parameters so that length is after the name of a field,
and database is before table name.
sql/sql_base.cc:
* Reorder parameters so that length is after the name of a field,
and database is before table name.
* Added new method - Field_iterator_table_ref::get_natural_column_ref
to avoid unnecessary code when it is knwon that no new columns will
be created when accessing natural join columns.
sql/sql_insert.cc:
Unite all code that stores and restores the state of a name resolution context
into a class to represent the state, and methods to save/restore that
state.
sql/sql_lex.cc:
Removed obsolete comment.
sql/sql_lex.h:
Return error from push_contex() if there is no memory.
sql/sql_list.h:
Extended base_list_iterator, List_iterator, and List_iterator_fast with an
empty constructor, and init() methods, so that one doesn't have to construct
a new iterator object every time one needs to iterate over a new list.
sql/sql_parse.cc:
Moved common functionality from the parser into one function, and renamed
the function to better reflect what it does.
sql/sql_yacc.yy:
Moved common functionality from the parser into one function, and renamed
the function to better reflect what it does.
sql/table.cc:
* Extended base_list_iterator, List_iterator, and List_iterator_fast with an
empty constructor, and init() methods, so that one doesn't have to construct
a new iterator object every time one needs to iterate over a new list.
* Added new method Field_iterator_table_ref::get_natural_column_ref to be
used in cases when it is known for sure that no new columns should be
created.
sql/table.h:
- column_ref_it no longer allocated for each new list of columns
- new method get_natural_join_column for faster/simpler access
to natural join columns.
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index 4201790e907..78b919502df 100644 --- a/sql/item.h +++ b/sql/item.h @@ -326,6 +326,48 @@ struct Name_resolution_context: Sql_alloc }; +/* + Store and restore the current state of a name resolution context. +*/ + +class Name_resolution_context_state +{ +private: + TABLE_LIST *save_table_list; + TABLE_LIST *save_first_name_resolution_table; + TABLE_LIST *save_next_name_resolution_table; + bool save_resolve_in_select_list; + +public: + TABLE_LIST *save_next_local; + +public: + /* Save the state of a name resolution context. */ + void save_state(Name_resolution_context *context, TABLE_LIST *table_list) + { + save_table_list= context->table_list; + save_first_name_resolution_table= context->first_name_resolution_table; + save_next_name_resolution_table= (context->first_name_resolution_table) ? + context->first_name_resolution_table-> + next_name_resolution_table : + NULL; + save_resolve_in_select_list= context->resolve_in_select_list; + save_next_local= table_list->next_local; + } + + /* Restore a name resolution context from saved state. */ + void restore_state(Name_resolution_context *context, TABLE_LIST *table_list) + { + table_list->next_local= save_next_local; + context->table_list= save_table_list; + context->first_name_resolution_table= save_first_name_resolution_table; + if (context->first_name_resolution_table) + context->first_name_resolution_table-> + next_name_resolution_table= save_next_name_resolution_table; + context->resolve_in_select_list= save_resolve_in_select_list; + } +}; + /*************************************************************************/ typedef bool (Item::*Item_processor)(byte *arg); |