MySQL  8.0.17
Source Code Documentation
dd_view.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef DD_VIEW_INCLUDED
24 #define DD_VIEW_INCLUDED
25 
26 struct MEM_ROOT;
27 class THD;
28 struct TABLE_LIST;
29 
30 namespace dd {
31 class Schema;
32 class View;
33 
34 /**
35  Store view metadata in the data-dictionary.
36 
37  @param thd Thread handle.
38  @param schema Schema where the view should be created.
39  @param view TABLE_LIST element describing the view.
40 
41  @note The caller must rollback both statement and transaction on failure,
42  before any further accesses to DD. This is because such a failure
43  might be caused by a deadlock, which requires rollback before any
44  other operations on SE (including reads using attachable transactions)
45  can be done.
46 
47  @retval false On Success.
48  @retval true On Failure.
49 */
50 bool create_view(THD *thd, const dd::Schema &schema, TABLE_LIST *view);
51 
52 /**
53  Update view metadata in dd.views.
54 
55  @param thd Thread handle.
56  @param new_view View object that should be updated.
57  @param view TABLE_LIST element describing the new view.
58 
59  @note The caller must rollback both statement and transaction on failure,
60  before any further accesses to DD. This is because such a failure
61  might be caused by a deadlock, which requires rollback before any
62  other operations on SE (including reads using attachable transactions)
63  can be done.
64 
65  @retval false On success.
66  @retval true On failure.
67 */
68 bool update_view(THD *thd, dd::View *new_view, TABLE_LIST *view);
69 
70 /** Read view metadata from dd.views into TABLE_LIST */
71 bool read_view(TABLE_LIST *view, const dd::View &view_ref, MEM_ROOT *mem_root);
72 
73 /**
74  Update view status(valid/invalid) value in dd.views.options.
75 
76  @param thd Thread handle.
77  @param schema_name Schema name.
78  @param view_name View name.
79  @param status View status(valid/invalid).
80  @param commit_dd_changes Indicates whether changes to DD need to be
81  committed.
82 
83  @note In case when commit_dd_changes is false, the caller must rollback
84  both statement and transaction on failure, before any further
85  accesses to DD. This is because such a failure might be caused by
86  a deadlock, which requires rollback before any other operations on
87  SE (including reads using attachable transactions) can be done.
88  If case when commit_dd_changes is true this function will handle
89  transaction rollback itself.
90 
91  @retval false On Success.
92  @retval true On Failure.
93 */
94 bool update_view_status(THD *thd, const char *schema_name,
95  const char *view_name, bool status,
96  bool commit_dd_changes);
97 
98 } // namespace dd
99 #endif // DD_VIEW_INCLUDED
Definition: view.h:38
bool update_view(THD *thd, dd::View *new_view, TABLE_LIST *view)
Update view metadata in dd.views.
Definition: dd_view.cc:570
bool create_view(THD *thd, const dd::Schema &schema, TABLE_LIST *view)
Store view metadata in the data-dictionary.
Definition: dd_view.cc:585
bool read_view(TABLE_LIST *view, const dd::View &view_obj, MEM_ROOT *mem_root)
Read view metadata from dd.views into TABLE_LIST.
Definition: dd_view.cc:605
bool update_view_status(THD *thd, const char *schema_name, const char *view_name, bool status, bool commit_dd_changes)
Update view status(valid/invalid) value in dd.views.options.
Definition: dd_view.cc:686
static MEM_ROOT mem_root
Definition: client_plugin.cc:107
Definition: schema.h:61
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
static STATUS status
Definition: mysql.cc:191
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
Definition: table.h:2442
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777