1 #ifndef SQL_VIEW_INCLUDED
2 #define SQL_VIEW_INCLUDED
3 
4 /* -*- C++ -*- */
5 /* Copyright (c) 2004, 2021, Oracle and/or its affiliates.
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License, version 2.0,
9    as published by the Free Software Foundation.
10 
11    This program is also distributed with certain software (including
12    but not limited to OpenSSL) that is licensed under separate terms,
13    as designated in a particular file or component or in included license
14    documentation.  The authors of MySQL hereby grant you an additional
15    permission to link the program and your derivative works with the
16    separately licensed software that they have included with MySQL.
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 Foundation,
25    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
26 
27 #include "my_global.h"
28 #include "sql_lex.h"           // enum_view_create_mode
29 
30 /* Forward declarations */
31 
32 class File_parser;
33 
34 
35 /* Function declarations */
36 
37 bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
38                           enum_view_create_mode mode);
39 
40 bool mysql_create_view(THD *thd, TABLE_LIST *view,
41                        enum_view_create_mode mode);
42 
43 bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
44 
45 bool check_key_in_view(THD *thd, TABLE_LIST *view, const TABLE_LIST *table_ref);
46 
47 bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view);
48 
49 int view_checksum(THD *thd, TABLE_LIST *view);
50 
51 extern TYPELIB updatable_views_with_limit_typelib;
52 
53 bool check_duplicate_names(List<Item>& item_list, bool gen_unique_view_names);
54 bool mysql_rename_view(THD *thd, const char *new_db, const char *new_name,
55                        TABLE_LIST *view);
56 
57 bool open_and_read_view(THD *thd, TABLE_SHARE *share,
58                         TABLE_LIST *view_ref);
59 
60 bool parse_view_definition(THD *thd, TABLE_LIST *view_ref);
61 
62 #define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL)
63 
64 extern const LEX_STRING view_type;
65 
66 #endif /* SQL_VIEW_INCLUDED */
67