MySQL 8.4.2
Source Code Documentation
dd_view.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef DD_VIEW_INCLUDED
25#define DD_VIEW_INCLUDED
26
27struct MEM_ROOT;
28class THD;
29class Table_ref;
30
31namespace dd {
32class Schema;
33class View;
34
35/**
36 Store view metadata in the data-dictionary.
37
38 @param thd Thread handle.
39 @param schema Schema where the view should be created.
40 @param view Table_ref element describing the view.
41
42 @note The caller must rollback both statement and transaction on failure,
43 before any further accesses to DD. This is because such a failure
44 might be caused by a deadlock, which requires rollback before any
45 other operations on SE (including reads using attachable transactions)
46 can be done.
47
48 @retval false On Success.
49 @retval true On Failure.
50*/
51bool create_view(THD *thd, const dd::Schema &schema, Table_ref *view);
52
53/**
54 Update view metadata in dd.views.
55
56 @param thd Thread handle.
57 @param new_view View object that should be updated.
58 @param view Table_ref element describing the new view.
59
60 @note The caller must rollback both statement and transaction on failure,
61 before any further accesses to DD. This is because such a failure
62 might be caused by a deadlock, which requires rollback before any
63 other operations on SE (including reads using attachable transactions)
64 can be done.
65
66 @retval false On success.
67 @retval true On failure.
68*/
69bool update_view(THD *thd, dd::View *new_view, Table_ref *view);
70
71/** Read view metadata from dd.views into Table_ref */
72bool read_view(Table_ref *view, const dd::View &view_ref, MEM_ROOT *mem_root);
73
74/**
75 Update view status(valid/invalid) value in dd.views.options.
76
77 @param thd Thread handle.
78 @param schema_name Schema name.
79 @param view_name View name.
80 @param status View status(valid/invalid).
81 @param commit_dd_changes Indicates whether changes to DD need to be
82 committed.
83
84 @note In case when commit_dd_changes is false, the caller must rollback
85 both statement and transaction on failure, before any further
86 accesses to DD. This is because such a failure might be caused by
87 a deadlock, which requires rollback before any other operations on
88 SE (including reads using attachable transactions) can be done.
89 If case when commit_dd_changes is true this function will handle
90 transaction rollback itself.
91
92 @retval false On Success.
93 @retval true On Failure.
94*/
95bool update_view_status(THD *thd, const char *schema_name,
96 const char *view_name, bool status,
97 bool commit_dd_changes);
98
99} // namespace dd
100#endif // DD_VIEW_INCLUDED
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:2864
Definition: schema.h:63
Definition: view.h:39
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
borrowable::session_track::Schema< true > Schema
Definition: classic_protocol_session_track.h:288
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
bool update_view(THD *thd, dd::View *new_view, Table_ref *view)
Update view metadata in dd.views.
Definition: dd_view.cc:578
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:696
bool read_view(Table_ref *view, const dd::View &view_obj, MEM_ROOT *mem_root)
Read view metadata from dd.views into Table_ref.
Definition: dd_view.cc:613
bool create_view(THD *thd, const dd::Schema &schema, Table_ref *view)
Store view metadata in the data-dictionary.
Definition: dd_view.cc:593
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83