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:
103
sql/table.h
103
sql/table.h
@ -20,6 +20,7 @@
|
||||
class Item; /* Needed by ORDER */
|
||||
class GRANT_TABLE;
|
||||
class st_select_lex_unit;
|
||||
class st_select_lex;
|
||||
|
||||
/* Order clause list element */
|
||||
|
||||
@ -70,7 +71,7 @@ struct st_table {
|
||||
/* hash of field names (contains pointers to elements of field array) */
|
||||
HASH name_hash;
|
||||
byte *record[2]; /* Pointer to records */
|
||||
byte *default_values; /* Default values for INSERT */
|
||||
byte *default_values; /* Default values for INSERT */
|
||||
byte *insert_values; /* used by INSERT ... UPDATE */
|
||||
uint fields; /* field count */
|
||||
uint reclength; /* Recordlength */
|
||||
@ -170,19 +171,53 @@ struct st_table {
|
||||
#define JOIN_TYPE_LEFT 1
|
||||
#define JOIN_TYPE_RIGHT 2
|
||||
|
||||
#define VIEW_ALGORITHM_UNDEFINED 0
|
||||
#define VIEW_ALGORITHM_TMEPTABLE 1
|
||||
#define VIEW_ALGORITHM_MERGE 2
|
||||
|
||||
struct st_lex;
|
||||
|
||||
typedef struct st_table_list
|
||||
{
|
||||
struct st_table_list *next;
|
||||
/* link in a local table list (used by SQL_LIST) */
|
||||
struct st_table_list *next_local;
|
||||
/* link in a global list of all queries tables */
|
||||
struct st_table_list *next_global, **prev_global;
|
||||
char *db, *alias, *real_name;
|
||||
char *option; /* Used by cache index */
|
||||
Item *on_expr; /* Used with outer join */
|
||||
struct st_table_list *natural_join; /* natural join on this table*/
|
||||
/* ... join ... USE INDEX ... IGNORE INDEX */
|
||||
List<String> *use_index, *ignore_index;
|
||||
TABLE *table; /* opened table */
|
||||
st_table_list *table_list; /* pointer to node of list of all tables */
|
||||
class st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */
|
||||
GRANT_INFO grant;
|
||||
TABLE *table; /* opened table */
|
||||
/*
|
||||
Reference from aux_tables to local list entry of main select of
|
||||
multi-delete statement:
|
||||
delete t1 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
here it will be reference of first occurrence of t1 to second (as you
|
||||
can see this lists can't be merged)
|
||||
*/
|
||||
st_table_list *correspondent_table;
|
||||
st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */
|
||||
/* link to select_lex where this table was used */
|
||||
st_select_lex *select_lex;
|
||||
st_lex *view; /* link on VIEW lex for merging */
|
||||
Item **field_translation; /* array of VIEW fields */
|
||||
/* ancestor of this table (VIEW merge algorithm) */
|
||||
st_table_list *ancestor;
|
||||
Item *where; /* VIEW WHERE clause condition */
|
||||
LEX_STRING query; /* text of (CRETE/SELECT) statement */
|
||||
LEX_STRING md5; /* md5 of query tesxt */
|
||||
LEX_STRING source; /* source of CREATE VIEW */
|
||||
LEX_STRING view_db; /* save view database */
|
||||
LEX_STRING view_name; /* save view name */
|
||||
LEX_STRING timestamp; /* GMT time stamp of last operation */
|
||||
ulonglong file_version; /* version of file's field set */
|
||||
ulonglong revision; /* revision control number */
|
||||
ulonglong updatable; /* Is VIEW updateable */
|
||||
ulonglong algorithm; /* 0 any, 1 tmp tables , 2 merging */
|
||||
uint effective_algorithm; /* which algorithm was really used */
|
||||
GRANT_INFO grant;
|
||||
thr_lock_type lock_type;
|
||||
uint outer_join; /* Which join type */
|
||||
uint shared; /* Used in multi-upd */
|
||||
@ -197,12 +232,64 @@ typedef struct st_table_list
|
||||
st_table_list *embedding; /* nested join containing the table */
|
||||
List<struct st_table_list> *join_list;/* join list the table belongs to */
|
||||
bool cacheable_table; /* stop PS caching */
|
||||
/* used in multi-upd privelege check */
|
||||
bool table_in_update_from_clause;
|
||||
/* used in multi-upd/views privelege check */
|
||||
bool table_in_first_from_clause;
|
||||
bool skip_temporary; /* this table shouldn't be temporary */
|
||||
bool setup_is_done; /* setup_tables() is done */
|
||||
/* do view contain auto_increment field */
|
||||
bool contain_auto_increment;
|
||||
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
|
||||
|
||||
void calc_md5(char *buffer);
|
||||
void set_ancestor();
|
||||
bool setup_ancestor(THD *thd, Item **conds);
|
||||
bool placeholder() {return derived || view; }
|
||||
void print(THD *thd, String *str);
|
||||
} TABLE_LIST;
|
||||
|
||||
class Item;
|
||||
|
||||
class Field_iterator: public Sql_alloc
|
||||
{
|
||||
public:
|
||||
virtual ~Field_iterator() {}
|
||||
virtual void set(TABLE_LIST *)= 0;
|
||||
virtual void next()= 0;
|
||||
virtual bool end()= 0;
|
||||
virtual const char *name()= 0;
|
||||
virtual Item *item(THD *)= 0;
|
||||
virtual Field *field()= 0;
|
||||
};
|
||||
|
||||
|
||||
class Field_iterator_table: public Field_iterator
|
||||
{
|
||||
Field **ptr;
|
||||
public:
|
||||
Field_iterator_table() :ptr(0) {}
|
||||
void set(TABLE_LIST *table) { ptr= table->table->field; }
|
||||
void set_table(TABLE *table) { ptr= table->field; }
|
||||
void next() { ptr++; }
|
||||
bool end() { return test(*ptr); }
|
||||
const char *name();
|
||||
Item *item(THD *thd);
|
||||
Field *field() { return *ptr; }
|
||||
};
|
||||
|
||||
|
||||
class Field_iterator_view: public Field_iterator
|
||||
{
|
||||
Item **ptr, **array_end;
|
||||
public:
|
||||
Field_iterator_view() :ptr(0), array_end(0) {}
|
||||
void set(TABLE_LIST *table);
|
||||
void next() { ptr++; }
|
||||
bool end() { return ptr < array_end; }
|
||||
const char *name();
|
||||
Item *item(THD *thd) { return *ptr; }
|
||||
Field *field() { return 0; }
|
||||
};
|
||||
|
||||
typedef struct st_nested_join
|
||||
{
|
||||
List<TABLE_LIST> join_list; /* list of elements in the nested join */
|
||||
|
Reference in New Issue
Block a user