MySQL 8.0.29
Source Code Documentation
dd_view.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2021, Oracle and/or its affiliates.
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
26struct MEM_ROOT;
27class THD;
28struct TABLE_LIST;
29
30namespace dd {
31class Schema;
32class 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*/
50bool 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*/
68bool update_view(THD *thd, dd::View *new_view, TABLE_LIST *view);
69
70/** Read view metadata from dd.views into TABLE_LIST */
71bool 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*/
94bool 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
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
Definition: schema.h:62
Definition: view.h:38
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
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:610
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:693
bool create_view(THD *thd, const dd::Schema &schema, TABLE_LIST *view)
Store view metadata in the data-dictionary.
Definition: dd_view.cc:590
bool update_view(THD *thd, dd::View *new_view, TABLE_LIST *view)
Update view metadata in dd.views.
Definition: dd_view.cc:575
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:60
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: table.h:2684