Go to the source code of this file.
|
bool | create_view_precheck (THD *thd, Table_ref *tables, Table_ref *view, enum_view_create_mode mode) |
| CREATE VIEW privileges pre-check. More...
|
|
bool | mysql_create_view (THD *thd, Table_ref *view, enum_view_create_mode mode) |
| Creating/altering VIEW procedure. More...
|
|
bool | mysql_register_view (THD *thd, Table_ref *view, enum_view_create_mode mode) |
| Register view by writing its definition to the data-dictionary. More...
|
|
bool | mysql_drop_view (THD *thd, Table_ref *view) |
| Drop view. More...
|
|
bool | check_key_in_view (THD *thd, Table_ref *view, const Table_ref *table_ref) |
| check of key (primary or unique) presence in updatable view More...
|
|
bool | insert_view_fields (mem_root_deque< Item * > *list, Table_ref *view) |
|
bool | check_duplicate_names (const Create_col_name_list *column_names, const mem_root_deque< Item * > &item_list, bool gen_unique_view_names) |
| When creating a derived table, check if duplicate column names are present, and possibly generate unique names instead. More...
|
|
void | make_valid_column_names (LEX *lex) |
| Check if auto generated column names are conforming and possibly generate a conforming name for them if not. More...
|
|
bool | open_and_read_view (THD *thd, TABLE_SHARE *share, Table_ref *view_ref) |
| Open and read a view definition. More...
|
|
bool | parse_view_definition (THD *thd, Table_ref *view_ref) |
| Parse a view definition. More...
|
|
bool | is_updatable_view (THD *thd, Table_ref *view) |
|
◆ VIEW_ANY_ACL
◆ Create_col_name_list
◆ check_duplicate_names()
When creating a derived table, check if duplicate column names are present, and possibly generate unique names instead.
- Parameters
-
column_names | User-provided list of column names, NULL if none |
item_list | SELECT list of underlying query expression |
gen_unique_view_name | See description. |
- If a list of column names has been provided: it is simply searched for duplicates (which cause an error).
- otherwise, column names are derived from the underlying query expression's SELECT list elements; if two of those elements have duplicate autogenerated names: if gen_unique_view_name is false: error it it is true: we generate a unique name using make_unique_view_field_name()
- Returns
- true if error.
◆ check_key_in_view()
check of key (primary or unique) presence in updatable view
If the table to be checked is a view and the query has LIMIT clause, then check that the view fulfills one of the following constraints: 1) it contains the primary key of the underlying updatable table. 2) it contains a unique key of the underlying updatable table whose columns are all non-nullable. 3) it contains all columns of the underlying updatable table.
- Parameters
-
thd | thread handler |
view | view for check with opened table |
table_ref | underlying updatable table of the view |
- Returns
- false is success, true if error
◆ create_view_precheck()
CREATE VIEW privileges pre-check.
- Parameters
-
thd | thread handler |
tables | tables used in the view |
view | views to create |
mode | VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE |
- Return values
-
false | Operation was a success. |
true | An error occurred. |
◆ insert_view_fields()
◆ is_updatable_view()
- See also
- Query_block::merge_derived()
◆ make_valid_column_names()
void make_valid_column_names |
( |
LEX * |
lex | ) |
|
Check if auto generated column names are conforming and possibly generate a conforming name for them if not.
- Parameters
-
◆ mysql_create_view()
Creating/altering VIEW procedure.
Atomicity: The operation to create, alter and create_or_replace a view is atomic/crash-safe. Changes to the Data-dictionary and writing event to binlog are part of the same transaction. All the changes are done as part of the same transaction or do not have any side effects on the operation failure. Data-dictionary and table definition caches are in sync with operation state. Cache do not contain any stale/incorrect data in case of failure. In case of crash, there won't be any discrepancy between the data-dictionary table and the binary log.
- Parameters
-
thd | thread handler |
views | views to create |
mode | VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE |
- Note
- This function handles both create and alter view commands.
- Return values
-
false | Operation was a success. |
true | An error occurred. |
◆ mysql_drop_view()
Drop view.
Atomicity: The operation to drop a view is atomic/crash-safe. Changes to the Data-dictionary and writing event to binlog are part of the same transaction. All the changes are done as part of the same transaction or do not have any side effects on the operation failure. Data-dictionary and table definition caches are in sync with operation state. Cache do not contain any stale/incorrect data in case of failure. In case of crash, there won't be any discrepancy between the data-dictionary table and the binary log. The partial execution of a drop view statement is not supported any more with atomic drop view implementation.
- Parameters
-
[in] | thd | thread handler |
[in] | views | views to delete |
- Return values
-
◆ mysql_register_view()
Register view by writing its definition to the data-dictionary.
- Parameters
-
thd | Thread handler. |
view | View description |
mode | VIEW_CREATE_NEW, VIEW_ALTER or VIEW_CREATE_OR_REPLACE. |
- Note
- The caller must rollback both statement and transaction on failure, before any further accesses to DD. This is because such a failure might be caused by a deadlock, which requires rollback before any other operations on SE (including reads using attachable transactions) can be done.
- Return values
-
- See also
- Item::print_for_order()
◆ open_and_read_view()
Open and read a view definition.
- Parameters
-
[in] | thd | Thread handler |
[in] | share | Share object of view |
[in,out] | view_ref | Table_ref structure for view reference |
- Returns
- false-in case of success, true-in case of error.
- Note
- In case true value returned an error has been already set in DA.
◆ parse_view_definition()
bool parse_view_definition |
( |
THD * |
thd, |
|
|
Table_ref * |
view_ref |
|
) |
| |
Parse a view definition.
Among other effects, it adds underlying tables to the global list of tables, so the next iteration in open_tables() will open them.
- Parameters
-
[in] | thd | Thread handler |
[in,out] | view_ref | Table_ref structure for view reference |
- Returns
- false-in case of success, true-in case of error.
- Note
- In case true value returned an error has been already set in DA.