From 4fd41f7c0bd7e61265e219aecada2e7b36df88c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Nov 2005 21:57:50 +0200 Subject: 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. --- sql/table.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sql/table.h') diff --git a/sql/table.h b/sql/table.h index d919b9a4203..e6c9ab4de87 100644 --- a/sql/table.h +++ b/sql/table.h @@ -734,11 +734,11 @@ public: class Field_iterator_natural_join: public Field_iterator { - List_iterator_fast *column_ref_it; + List_iterator_fast column_ref_it; Natural_join_column *cur_column_ref; public: - Field_iterator_natural_join() :column_ref_it(NULL), cur_column_ref(NULL) {} - ~Field_iterator_natural_join() { delete column_ref_it; } + Field_iterator_natural_join() :cur_column_ref(NULL) {} + ~Field_iterator_natural_join() {} void set(TABLE_LIST *table); void next(); bool end_of_fields() { return !cur_column_ref; } @@ -785,7 +785,8 @@ public: GRANT_INFO *grant(); Item *create_item(THD *thd) { return field_it->create_item(thd); } Field *field() { return field_it->field(); } - Natural_join_column *get_or_create_column_ref(THD *thd, bool *is_created); + Natural_join_column *get_or_create_column_ref(bool *is_created); + Natural_join_column *get_natural_column_ref(); }; -- cgit v1.2.1 From e486fe1ff18796792fac56ca5425733fb0f68692 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Nov 2005 21:27:11 +0200 Subject: WL#2486 - natural/using joins according to SQL:2003 Post-review fixes that simplify the way access rights are checked during name resolution and factor out all entry points to check access rights into one single function. sql/item.cc: Simplfied find_field_in_table - factored out all acces right checks into a separate function. sql/mysql_priv.h: Simplified the way we control whether to perform access right checks for columns. sql/sql_acl.cc: - Added new functon check_column_grant_in_table_ref that serves as a single point of entry to check access rights during name resolution for different kinds of table references. - Moved check_grant_column_in_sctx to sql_acl.cc where it logically belongs. - Removed the parameter check_grants - it is checked before calling the function. sql/sql_acl.h: - Added new function check_column_grant_in_table_ref. - Made check_grant_column_in_sctx available to other modules. sql/sql_base.cc: - Factored out all code that check access rights for columns during name resolution into one function - check_column_grant_in_table_ref. - Moved check_grant_column_in_sctx to sql_acl.cc where it logically belongs. - Removed the parameter check_grants - it is checked before calling the function. sql/table.cc: Removed code that duplicates the functionality of check_column_grant_in_table_ref, and called directly that function. sql/table.h: check_grants method is replaced by more general check_column_grant_in_table_ref. --- sql/table.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'sql/table.h') diff --git a/sql/table.h b/sql/table.h index e6c9ab4de87..ce0616a6833 100644 --- a/sql/table.h +++ b/sql/table.h @@ -407,9 +407,6 @@ public: const char *table_name(); const char *db_name(); GRANT_INFO *grant(); -#ifndef NO_EMBEDDED_ACCESS_CHECKS - bool check_grants(THD *thd, const char *name, uint length); -#endif }; -- cgit v1.2.1