MySQL 9.1.0
Source Code Documentation
sql_view.h
Go to the documentation of this file.
1#ifndef SQL_VIEW_INCLUDED
2#define SQL_VIEW_INCLUDED
3
4/* Copyright (c) 2004, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include "lex_string.h"
28#include "sql/auth/auth_acls.h"
29#include "sql/mem_root_array.h"
30
31class Item;
32class THD;
33struct LEX;
34class Table_ref;
35struct TABLE_SHARE;
36template <class T>
37class List;
38template <class T>
39class mem_root_deque;
40
41enum class enum_view_create_mode;
42
43bool create_view_precheck(THD *thd, Table_ref *tables, Table_ref *view,
45
47
49 bool *use_existing_view);
50
51bool mysql_drop_view(THD *thd, Table_ref *view);
52
53bool check_key_in_view(THD *thd, Table_ref *view, const Table_ref *table_ref);
54
56
59 const mem_root_deque<Item *> &item_list,
60 bool gen_unique_view_names);
62
63bool open_and_read_view(THD *thd, TABLE_SHARE *share, Table_ref *view_ref);
64
65bool parse_view_definition(THD *thd, Table_ref *view_ref);
66
67/*
68 Check if view is updatable.
69
70 @param thd Thread Handle.
71 @param view View description.
72
73 @retval true View is updatable.
74 @retval false Otherwise.
75*/
76bool is_updatable_view(THD *thd, Table_ref *view);
77
78#define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL)
79
80#endif /* SQL_VIEW_INCLUDED */
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
Definition: sql_list.h:494
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: table.h:2900
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
enum_view_create_mode
Definition: sql_lex.h:277
static bool column_names
Definition: mysql.cc:171
mode
Definition: file_handle.h:61
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2880
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 uni...
Definition: sql_view.cc:178
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
Definition: sql_view.cc:1928
Mem_root_array_YY< LEX_CSTRING > Create_col_name_list
Definition: sql_view.h:57
bool insert_view_fields(mem_root_deque< Item * > *list, Table_ref *view)
Definition: sql_view.cc:2035
bool mysql_create_view(THD *thd, Table_ref *view, enum_view_create_mode mode)
Creating/altering VIEW procedure.
Definition: sql_view.cc:440
bool parse_view_definition(THD *thd, Table_ref *view_ref)
Parse a view definition.
Definition: sql_view.cc:1218
bool is_updatable_view(THD *thd, Table_ref *view)
Definition: sql_view.cc:781
bool create_view_precheck(THD *thd, Table_ref *tables, Table_ref *view, enum_view_create_mode mode)
CREATE VIEW privileges pre-check.
Definition: sql_view.cc:331
bool mysql_register_view(THD *thd, Table_ref *view, enum_view_create_mode mode, bool *use_existing_view)
Register view by writing its definition to the data-dictionary.
Definition: sql_view.cc:863
bool open_and_read_view(THD *thd, TABLE_SHARE *share, Table_ref *view_ref)
Open and read a view definition.
Definition: sql_view.cc:1103
void make_valid_column_names(LEX *lex)
Check if auto generated column names are conforming and possibly generate a conforming name for them ...
Definition: sql_view.cc:231
bool mysql_drop_view(THD *thd, Table_ref *view)
Drop view.
Definition: sql_view.cc:1762
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3844
This structure is shared between different table objects.
Definition: table.h:704