MySQL 8.0.29
Source Code Documentation
foreign_key_element.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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__FOREIGN_KEY_ELEMENT_INCLUDED
24#define DD__FOREIGN_KEY_ELEMENT_INCLUDED
25
26#include "my_inttypes.h"
27#include "sql/dd/sdi_fwd.h" // dd::Sdi_wcontext
28#include "sql/dd/types/weak_object.h" // dd::Weak_object
29
30namespace dd {
31
32///////////////////////////////////////////////////////////////////////////
33
34class Column;
35class Foreign_key;
36class Foreign_key_element_impl;
37
38namespace tables {
39class Foreign_key_column_usage;
40}
41
42///////////////////////////////////////////////////////////////////////////
43
44class Foreign_key_element : virtual public Weak_object {
45 public:
48
49 public:
50 ~Foreign_key_element() override = default;
51
52 /////////////////////////////////////////////////////////////////////////
53 // Foreign key.
54 /////////////////////////////////////////////////////////////////////////
55
56 virtual const Foreign_key &foreign_key() const = 0;
57
58 virtual Foreign_key &foreign_key() = 0;
59
60 /////////////////////////////////////////////////////////////////////////
61 // column.
62 /////////////////////////////////////////////////////////////////////////
63
64 virtual const Column &column() const = 0;
65
66 virtual void set_column(const Column *column) = 0;
67
68 /////////////////////////////////////////////////////////////////////////
69 // ordinal_position.
70 /////////////////////////////////////////////////////////////////////////
71
72 virtual uint ordinal_position() const = 0;
73
75
76 /////////////////////////////////////////////////////////////////////////
77 // referenced column name.
78 /////////////////////////////////////////////////////////////////////////
79
80 virtual const String_type &referenced_column_name() const = 0;
81 virtual void referenced_column_name(const String_type &name) = 0;
82
83 /**
84 Converts *this into json.
85
86 Converts all member variables that are to be included in the sdi
87 into json by transforming them appropriately and passing them to
88 the rapidjson writer provided.
89
90 @param wctx opaque context for data needed by serialization
91 @param w rapidjson writer which will perform conversion to json
92
93 */
94
95 virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const = 0;
96
97 /**
98 Re-establishes the state of *this by reading sdi information from
99 the rapidjson DOM subobject provided.
100
101 Cross-references encountered within this object are tracked in
102 sdictx, so that they can be updated when the entire object graph
103 has been established.
104
105 @param rctx stores book-keeping information for the
106 deserialization process
107 @param val subobject of rapidjson DOM containing json
108 representation of this object
109 @retval false success
110 @retval true failure
111 */
112
113 virtual bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) = 0;
114};
115
116///////////////////////////////////////////////////////////////////////////
117
118} // namespace dd
119
120#endif // DD__FOREIGN_KEY_ELEMENT_INCLUDED
Definition: column.h:86
Definition: foreign_key_element_impl.h:53
Definition: foreign_key_element.h:44
virtual const Column & column() const =0
virtual uint ordinal_position() const =0
virtual void referenced_column_name(const String_type &name)=0
Foreign_key_element_impl Impl
Definition: foreign_key_element.h:46
virtual void set_ordinal_position(int ordinal_position)=0
tables::Foreign_key_column_usage DD_table
Definition: foreign_key_element.h:47
virtual void set_column(const Column *column)=0
~Foreign_key_element() override=default
virtual const String_type & referenced_column_name() const =0
virtual bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val)=0
Re-establishes the state of *this by reading sdi information from the rapidjson DOM subobject provide...
virtual Foreign_key & foreign_key()=0
virtual const Foreign_key & foreign_key() const =0
virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const =0
Converts *this into json.
Definition: foreign_key.h:46
Opaque context which keeps reusable resoureces needed during deserialization.
Definition: sdi.cc:230
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:128
Base class for all data dictionary objects.
Definition: weak_object.h:41
Definition: foreign_key_column_usage.h:37
Some integer typedefs for easier portability.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
RJ_Writer Sdi_writer
Alias for the rapidjson Writer type to use in serialization.
Definition: sdi_fwd.h:63
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:48
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
This header provides Rapidjson Type Aliases.
case opt name
Definition: sslopt-case.h:32
unsigned int uint
Definition: uca-dump.cc:29