1#ifndef SQL_VIEW_INCLUDED
2#define SQL_VIEW_INCLUDED
3
4/* -*- C++ -*- */
5/* Copyright (c) 2004, 2010, Oracle and/or its affiliates.
6 Copyright (c) 2015, MariaDB
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; version 2 of the License.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
22#include "sql_class.h" /* Required by sql_lex.h */
23#include "sql_lex.h" /* enum_view_create_mode, enum_drop_mode */
24
25/* Forward declarations */
26
27class File_parser;
28
29
30/* Function declarations */
31
32bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
33 enum_view_create_mode mode);
34
35bool mysql_create_view(THD *thd, TABLE_LIST *view,
36 enum_view_create_mode mode);
37
38bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
39 bool open_view_no_parse);
40
41
42bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
43
44bool check_key_in_view(THD *thd, TABLE_LIST * view);
45
46bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view);
47
48int view_checksum(THD *thd, TABLE_LIST *view);
49int view_check(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt);
50int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt);
51
52extern TYPELIB updatable_views_with_limit_typelib;
53
54bool check_duplicate_names(THD *thd, List<Item>& item_list,
55 bool gen_unique_view_names);
56bool mysql_rename_view(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name,
57 TABLE_LIST *view);
58
59void make_valid_column_names(THD *thd, List<Item> &item_list);
60
61#define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL)
62
63extern const LEX_CSTRING view_type;
64
65void make_valid_column_names(List<Item> &item_list);
66
67#endif /* SQL_VIEW_INCLUDED */
68