diff options
author | unknown <bell@sanja.is.com.ua> | 2005-07-01 07:05:42 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-07-01 07:05:42 +0300 |
commit | f75ad37111ef4b7e87015b0370cd0fea0c4de380 (patch) | |
tree | 9add97047abadbc8746b2d0a892d7944e8703d4f /sql/table.h | |
parent | aefeb06c065f54cc68ec7c5c0c2aa5d2c83e9098 (diff) | |
download | mariadb-git-f75ad37111ef4b7e87015b0370cd0fea0c4de380.tar.gz |
Name resolution context added (BUG#6443)
include/my_bitmap.h:
new bitmap operation
mysql-test/r/view.result:
added warnings
Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysql-test/t/view.test:
Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysys/my_bitmap.c:
new bitmap operation
sql/field.h:
index of field in table added
sql/item.cc:
Name resolution context added
table list removed from fix_fields() arguments
sql/item.h:
Name resolution context added
table list removed from fix_fields() arguments
sql/item_cmpfunc.cc:
table list removed from fix_fields() arguments
sql/item_cmpfunc.h:
table list removed from fix_fields() arguments
sql/item_func.cc:
table list removed from fix_fields() arguments
sql/item_func.h:
table list removed from fix_fields() arguments
sql/item_row.cc:
table list removed from fix_fields() arguments
sql/item_row.h:
table list removed from fix_fields() arguments
sql/item_strfunc.cc:
fixed server crash on NULL argument
sql/item_strfunc.h:
table list removed from fix_fields() arguments
sql/item_subselect.cc:
table list removed from fix_fields() arguments
sql/item_subselect.h:
table list removed from fix_fields() arguments
sql/item_sum.cc:
table list removed from fix_fields() arguments
sql/item_sum.h:
table list removed from fix_fields() arguments
sql/item_timefunc.cc:
table list removed from fix_fields() arguments
sql/item_timefunc.h:
table list removed from fix_fields() arguments
sql/item_uniq.h:
table list removed from fix_fields() arguments
sql/log_event.cc:
Name resolution context added
sql/log_event.h:
Name resolution context added
sql/mysql_priv.h:
Name resolution context added
sql/set_var.cc:
table list removed from fix_fields() arguments
sql/share/errmsg.txt:
new error message
sql/sp.cc:
Name resolution context added
sql/sp_head.cc:
table list removed from fix_fields() arguments
sql/sp_head.h:
Name resolution context added
sql/sql_base.cc:
table list removed from fix_fields() arguments
Name resolution context added
sql/sql_class.cc:
renamed variable
sql/sql_delete.cc:
Name resolution context added
sql/sql_derived.cc:
Name resolution context added
sql/sql_do.cc:
table list removed from fix_fields() arguments
sql/sql_handler.cc:
Name resolution context added
sql/sql_help.cc:
Name resolution context added
sql/sql_insert.cc:
Name resolution context added
table list removed from fix_fields() arguments
sql/sql_lex.cc:
Name resolution context added
sql/sql_lex.h:
removed resolve mode (information stored into name resolution context)
sql/sql_load.cc:
table list removed from fix_fields() arguments
sql/sql_olap.cc:
Name resolution context added
sql/sql_parse.cc:
Name resolution context added
sql/sql_prepare.cc:
table list removed from fix_fields() arguments
sql/sql_select.cc:
table list removed from fix_fields() arguments
sql/sql_show.cc:
Name resolution context added
sql/sql_trigger.cc:
table list removed from fix_fields() arguments
sql/sql_udf.h:
table list removed from fix_fields() arguments
sql/sql_union.cc:
Name resolution context added
sql/sql_update.cc:
Name resolution context added
sql/sql_view.cc:
Name resolution context added
sql/sql_view.h:
table list removed from fix_fields() arguments
sql/sql_yacc.yy:
Name resolution context added
sql/table.cc:
Name resolution context added
merged view processing moved
sql/table.h:
merged view processing moved
Diffstat (limited to 'sql/table.h')
-rw-r--r-- | sql/table.h | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/sql/table.h b/sql/table.h index 8bc4e01852f..d0c998c4c10 100644 --- a/sql/table.h +++ b/sql/table.h @@ -314,9 +314,9 @@ typedef struct st_schema_table #define JOIN_TYPE_LEFT 1 #define JOIN_TYPE_RIGHT 2 -#define VIEW_ALGORITHM_UNDEFINED 0 -#define VIEW_ALGORITHM_TMPTABLE 1 -#define VIEW_ALGORITHM_MERGE 2 +#define VIEW_ALGORITHM_UNDEFINED 0 +#define VIEW_ALGORITHM_TMPTABLE 1 +#define VIEW_ALGORITHM_MERGE 2 /* view WITH CHECK OPTION parameter options */ #define VIEW_CHECK_NONE 0 @@ -329,9 +329,13 @@ typedef struct st_schema_table #define VIEW_CHECK_SKIP 2 struct st_lex; +struct st_table_list; class select_union; class TMP_TABLE_PARAM; +Item *create_view_field(THD *thd, st_table_list *view, Item **field_ref, + const char *name); + struct Field_translator { Item *item; @@ -384,6 +388,8 @@ typedef struct st_table_list st_select_lex *select_lex; st_lex *view; /* link on VIEW lex for merging */ Field_translator *field_translation; /* array of VIEW fields */ + /* pointer to element after last one in translation table above */ + Field_translator *field_translation_end; /* list of ancestor(s) of this table (underlying table(s)/view(s) */ st_table_list *ancestor; /* most upper view this table belongs to */ @@ -408,8 +414,7 @@ typedef struct st_table_list algorithm) */ uint8 effective_with_check; - uint effective_algorithm; /* which algorithm was really used */ - uint privilege_backup; /* place for saving privileges */ + uint8 effective_algorithm; /* which algorithm was really used */ GRANT_INFO grant; /* data need by some engines in query cache*/ ulonglong engine_data; @@ -424,7 +429,6 @@ typedef struct st_table_list bool updating; /* for replicate-do/ignore table */ bool force_index; /* prefer index over table scan */ bool ignore_leaves; /* preload only non-leaf nodes */ - bool no_where_clause; /* do not attach WHERE to SELECT */ table_map dep_tables; /* tables the table depends on */ table_map on_expr_dep_tables; /* tables on expression depends on */ struct st_nested_join *nested_join; /* if the element is a nested join */ @@ -437,6 +441,8 @@ typedef struct st_table_list /* TRUE if this merged view contain auto_increment field */ bool contain_auto_increment; bool multitable_view; /* TRUE iff this is multitable view */ + /* view where processed */ + bool where_processed; /* FRMTYPE_ERROR if any type is acceptable */ enum frm_type_enum required_type; char timestamp_buffer[20]; /* buffer for timestamp (19+1) */ @@ -449,16 +455,32 @@ typedef struct st_table_list void calc_md5(char *buffer); void set_ancestor(); int view_check_option(THD *thd, bool ignore_failure); - bool setup_ancestor(THD *thd, Item **conds, uint8 check_option); + bool setup_ancestor(THD *thd); void cleanup_items(); bool placeholder() {return derived || view; } void print(THD *thd, String *str); - void save_and_clear_want_privilege(); - void restore_want_privilege(); bool check_single_table(st_table_list **table, table_map map, st_table_list *view); bool set_insert_values(MEM_ROOT *mem_root); + void hide_view_error(THD *thd); st_table_list *find_underlying_table(TABLE *table); + inline bool prepare_check_option(THD *thd) + { + bool res= FALSE; + if (effective_with_check) + res= prep_check_option(thd, effective_with_check); + return res; + } + inline bool prepare_where(THD *thd, Item **conds, + bool no_where_clause) + { + if (effective_algorithm == VIEW_ALGORITHM_MERGE) + return prep_where(thd, conds, no_where_clause); + return FALSE; + } +private: + bool prep_check_option(THD *thd, uint8 check_opt_type); + bool prep_where(THD *thd, Item **conds, bool no_where_clause); } TABLE_LIST; class Item; @@ -471,7 +493,7 @@ public: virtual void next()= 0; virtual bool end_of_fields()= 0; /* Return 1 at end of list */ virtual const char *name()= 0; - virtual Item *item(THD *)= 0; + virtual Item *create_item(THD *)= 0; virtual Field *field()= 0; }; @@ -486,7 +508,7 @@ public: void next() { ptr++; } bool end_of_fields() { return *ptr == 0; } const char *name(); - Item *item(THD *thd); + Item *create_item(THD *thd); Field *field() { return *ptr; } }; @@ -494,15 +516,18 @@ public: class Field_iterator_view: public Field_iterator { Field_translator *ptr, *array_end; + TABLE_LIST *view; public: Field_iterator_view() :ptr(0), array_end(0) {} void set(TABLE_LIST *table); void next() { ptr++; } bool end_of_fields() { return ptr == array_end; } const char *name(); - Item *item(THD *thd) { return ptr->item; } + Item *create_item(THD *thd); Item **item_ptr() {return &ptr->item; } Field *field() { return 0; } + + inline Item *item() { return ptr->item; } }; |