mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
VIEW
two TABLE_LIST copy eliminated include/mysqld_error.h: errors of view libmysqld/Makefile.am: new view file mysql-test/r/connect.result: SHOW TABLE show type of table mysql-test/r/ctype_recoding.result: SHOW TABLE show type of table mysql-test/r/drop.result: SHOW TABLE show type of table mysql-test/r/grant.result: new two privileges (CRETEA|SHOW VIEW) mysql-test/r/lowercase_table.result: SHOW TABLE show type of table mysql-test/r/ps_1general.result: SHOW TABLE show type of table mysql-test/r/rename.result: SHOW TABLE show type of table mysql-test/r/rpl000009.result: SHOW TABLE show type of table mysql-test/r/rpl_error_ignored_table.result: SHOW TABLE show type of table mysql-test/r/select.result: SHOW TABLE show type of table mysql-test/r/system_mysql_db.result: SHOW TABLE show type of table new two privileges (CRETEA|SHOW VIEW) mysql-test/t/system_mysql_db_fix.test: removing all system tables scripts/mysql_fix_privilege_tables.sql: new two privileges (CRETEA|SHOW VIEW) sql/Makefile.am: new VIEW related file sql/ha_myisammrg.cc: two TABLE_LIST copy eliminated sql/item.cc: VIEW sql/item.h: VIEW sql/item_subselect.cc: VIEW sql/item_subselect.h: VIEW sql/lex.h: VIEW sql/lock.cc: VIEW sql/mysql_priv.h: VIEW sql/mysqld.cc: VIEW new parameter - sql_updatable_view_key sql/opt_sum.cc: two TABLE_LIST copy eliminated sql/set_var.cc: new parameter - sql_updatable_view_key sql/share/czech/errmsg.txt: errors messages of views sql/share/danish/errmsg.txt: errors messages of views sql/share/dutch/errmsg.txt: errors messages of views sql/share/english/errmsg.txt: errors messages of views sql/share/estonian/errmsg.txt: errors messages of views sql/share/french/errmsg.txt: errors messages of views sql/share/german/errmsg.txt: errors messages of views sql/share/greek/errmsg.txt: errors messages of views sql/share/hungarian/errmsg.txt: errors messages of views sql/share/italian/errmsg.txt: errors messages of views sql/share/japanese/errmsg.txt: errors messages of views sql/share/korean/errmsg.txt: errors messages of views sql/share/norwegian-ny/errmsg.txt: errors messages of views sql/share/norwegian/errmsg.txt: errors messages of views sql/share/polish/errmsg.txt: errors messages of views sql/share/portuguese/errmsg.txt: errors messages of views sql/share/romanian/errmsg.txt: errors messages of views sql/share/russian/errmsg.txt: errors messages of views sql/share/serbian/errmsg.txt: errors messages of views sql/share/slovak/errmsg.txt: errors messages of views sql/share/spanish/errmsg.txt: errors messages of views sql/share/swedish/errmsg.txt: errors messages of views sql/share/ukrainian/errmsg.txt: errors messages of views sql/slave.cc: two TABLE_LIST copy eliminated sql/sp.cc: VIEW sql/sql_acl.cc: VIEW sql/sql_acl.h: VIEW sql/sql_base.cc: VIEW sql/sql_cache.cc: two TABLE_LIST copy eliminated sql/sql_class.h: VIEW sql/sql_db.cc: two TABLE_LIST copy eliminated sql/sql_delete.cc: VIEW sql/sql_derived.cc: VIEW sql/sql_handler.cc: two TABLE_LIST copy eliminated sql/sql_help.cc: two TABLE_LIST copy eliminated sql/sql_insert.cc: VIEW sql/sql_lex.cc: VIEW sql/sql_lex.h: VIEW sql/sql_load.cc: VIEW sql/sql_olap.cc: VIEW sql/sql_parse.cc: two TABLE_LIST copy eliminated VIEW sql/sql_prepare.cc: VIEW sql/sql_rename.cc: two TABLE_LIST copy eliminated sql/sql_select.cc: VIEW sql/sql_show.cc: VIEW sql/sql_table.cc: VIEW sql/sql_union.cc: VIEW sql/sql_update.cc: VIEW sql/sql_yacc.yy: VIEW sql/table.cc: VIEW sql/table.h: VIEW sql/tztime.cc: two TABLE_LIST copy eliminated sql/unireg.h: VIEW tests/client_test.c: VIEW
This commit is contained in:
@ -83,8 +83,8 @@ enum enum_sql_command {
|
||||
SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION,
|
||||
SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_CREATE_FUNC,
|
||||
SQLCOM_SHOW_STATUS_PROC, SQLCOM_SHOW_STATUS_FUNC,
|
||||
|
||||
SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE,
|
||||
SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW,
|
||||
/* This should be the last !!! */
|
||||
SQLCOM_END
|
||||
};
|
||||
@ -98,6 +98,23 @@ enum suid_behaviour
|
||||
IS_DEFAULT_SUID= 0, IS_NOT_SUID, IS_SUID
|
||||
};
|
||||
|
||||
#define DERIVED_SUBQUERY 1
|
||||
#define DERIVED_VIEW 2
|
||||
|
||||
enum enum_view_create_mode
|
||||
{
|
||||
VIEW_CREATE_NEW, // check that there are not such VIEW/table
|
||||
VIEW_ALTER, // check that VIEW .frm with such name exists
|
||||
VIEW_CREATE_OR_REPLACE // check only that there are not such table
|
||||
};
|
||||
|
||||
enum enum_drop_mode
|
||||
{
|
||||
DROP_DEFAULT, // mode is not specified
|
||||
DROP_CASCADE, // CASCADE option
|
||||
DROP_RESTRICT // RESTRICT option
|
||||
};
|
||||
|
||||
typedef List<Item> List_item;
|
||||
|
||||
typedef struct st_lex_master_info
|
||||
@ -293,6 +310,8 @@ public:
|
||||
|
||||
friend class st_select_lex_unit;
|
||||
friend bool mysql_new_select(struct st_lex *lex, bool move_down);
|
||||
friend my_bool mysql_make_view (File_parser *parser,
|
||||
TABLE_LIST *table);
|
||||
private:
|
||||
void fast_exclude();
|
||||
};
|
||||
@ -355,7 +374,6 @@ public:
|
||||
bool describe; /* union exec() called for EXPLAIN */
|
||||
|
||||
void init_query();
|
||||
bool create_total_list(THD *thd, st_lex *lex, TABLE_LIST **result);
|
||||
st_select_lex_unit* master_unit();
|
||||
st_select_lex* outer_select();
|
||||
st_select_lex* first_select()
|
||||
@ -390,9 +408,6 @@ public:
|
||||
|
||||
friend void mysql_init_query(THD *thd, bool lexonly);
|
||||
friend int subselect_union_engine::exec();
|
||||
private:
|
||||
bool create_total_list_n_last_return(THD *thd, st_lex *lex,
|
||||
TABLE_LIST ***result);
|
||||
};
|
||||
typedef class st_select_lex_unit SELECT_LEX_UNIT;
|
||||
|
||||
@ -405,6 +420,8 @@ public:
|
||||
char *db, *db1, *table1, *db2, *table2; /* For outer join using .. */
|
||||
Item *where, *having; /* WHERE & HAVING clauses */
|
||||
Item *prep_where; /* saved WHERE clause for prepared statement processing */
|
||||
/* point on lex in which it was created, used in view subquery detection */
|
||||
st_lex *parent_lex;
|
||||
enum olap_type olap;
|
||||
SQL_LIST table_list, group_list; /* FROM & GROUP BY clauses */
|
||||
List<Item> item_list; /* list of fields & expressions */
|
||||
@ -555,6 +572,7 @@ public:
|
||||
void print(THD *thd, String *str);
|
||||
static void print_order(String *str, ORDER *order);
|
||||
void print_limit(THD *thd, String *str);
|
||||
void fix_prepare_information(THD *thd, Item **conds);
|
||||
};
|
||||
typedef class st_select_lex SELECT_LEX;
|
||||
|
||||
@ -618,6 +636,9 @@ typedef struct st_lex
|
||||
gptr yacc_yyss,yacc_yyvs;
|
||||
THD *thd;
|
||||
CHARSET_INFO *charset;
|
||||
TABLE_LIST *query_tables; /* global list of all tables in this query */
|
||||
/* last element next_global of previous list */
|
||||
TABLE_LIST **query_tables_last;
|
||||
|
||||
List<key_part_spec> col_list;
|
||||
List<key_part_spec> ref_list;
|
||||
@ -630,6 +651,7 @@ typedef struct st_lex
|
||||
List<List_item> many_values;
|
||||
List<set_var_base> var_list;
|
||||
List<Item_param> param_list;
|
||||
List<LEX_STRING> view_list; // view list (list of field names in view)
|
||||
SQL_LIST proc_list, auxilliary_table_list, save_list;
|
||||
TYPELIB *interval;
|
||||
create_field *last_field;
|
||||
@ -649,15 +671,21 @@ typedef struct st_lex
|
||||
enum enum_ha_read_modes ha_read_mode;
|
||||
enum ha_rkey_function ha_rkey_mode;
|
||||
enum enum_var_type option_type;
|
||||
enum enum_view_create_mode create_view_mode;
|
||||
enum enum_drop_mode drop_mode;
|
||||
uint uint_geom_type;
|
||||
uint grant, grant_tot_col, which_columns;
|
||||
uint fk_delete_opt, fk_update_opt, fk_match_option;
|
||||
uint slave_thd_opt;
|
||||
uint8 describe;
|
||||
uint8 derived_tables;
|
||||
uint8 create_view_algorithm;
|
||||
bool drop_if_exists, drop_temporary, local_file, one_shot_set;
|
||||
bool in_comment, ignore_space, verbose, no_write_to_binlog;
|
||||
bool derived_tables;
|
||||
/* special JOIN::prepare mode: changing of query is prohibited */
|
||||
bool view_prepare_mode;
|
||||
bool safe_to_cache_query;
|
||||
bool variables_used;
|
||||
ALTER_INFO alter_info;
|
||||
/* Prepared statements SQL syntax:*/
|
||||
LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */
|
||||
@ -676,6 +704,12 @@ typedef struct st_lex
|
||||
sp_pcontext *spcont;
|
||||
HASH spfuns; /* Called functions */
|
||||
st_sp_chistics sp_chistics;
|
||||
bool only_view; /* used for SHOW CREATE TABLE/VIEW */
|
||||
/*
|
||||
field_list was created for view and should be removed before PS/SP
|
||||
rexecuton
|
||||
*/
|
||||
bool empty_field_list_on_rset;
|
||||
|
||||
st_lex()
|
||||
{
|
||||
@ -707,12 +741,13 @@ typedef struct st_lex
|
||||
un->uncacheable|= cause;
|
||||
}
|
||||
}
|
||||
TABLE_LIST *unlink_first_table(TABLE_LIST *tables,
|
||||
TABLE_LIST **global_first,
|
||||
TABLE_LIST **local_first);
|
||||
TABLE_LIST *link_first_table_back(TABLE_LIST *tables,
|
||||
TABLE_LIST *global_first,
|
||||
TABLE_LIST *local_first);
|
||||
TABLE_LIST *unlink_first_table(bool *link_to_local);
|
||||
void link_first_table_back(TABLE_LIST *first, bool link_to_local);
|
||||
void first_lists_tables_same();
|
||||
|
||||
bool can_be_merged();
|
||||
bool can_use_merged();
|
||||
bool only_view_structure();
|
||||
} LEX;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user