MySQL 8.0.30
Source Code Documentation
foreign_key_element_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2022, 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_IMPL_INCLUDED
24#define DD__FOREIGN_KEY_ELEMENT_IMPL_INCLUDED
25
26#include <stddef.h>
27#include <sys/types.h>
28#include <new>
29
30#include "sql/dd/impl/types/weak_object_impl.h" // dd::Weak_object_impl
31#include "sql/dd/sdi_fwd.h"
32#include "sql/dd/string_type.h"
33#include "sql/dd/types/foreign_key_element.h" // dd::Foreign_key_element
34
35namespace dd {
36
37///////////////////////////////////////////////////////////////////////////
38
39class Column;
40class Foreign_key;
41class Foreign_key_impl;
42class Object_key;
43class Object_table;
44class Open_dictionary_tables_ctx;
45class Raw_record;
46class Sdi_rcontext;
47class Sdi_wcontext;
48class Weak_object;
49
50///////////////////////////////////////////////////////////////////////////
51
53 public Foreign_key_element {
54 public:
57
60
63
64 ~Foreign_key_element_impl() override = default;
65
66 public:
67 const Object_table &object_table() const override;
68
70
71 bool validate() const override;
72
73 bool restore_attributes(const Raw_record &r) override;
74
75 bool store_attributes(Raw_record *r) override;
76
77 void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override;
78
79 bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override;
80
81 void debug_print(String_type &outb) const override;
82
85 }
86
87 public:
88 /////////////////////////////////////////////////////////////////////////
89 // Foreign key.
90 /////////////////////////////////////////////////////////////////////////
91
92 const Foreign_key &foreign_key() const override;
93
94 Foreign_key &foreign_key() override;
95
96 /////////////////////////////////////////////////////////////////////////
97 // column.
98 /////////////////////////////////////////////////////////////////////////
99
100 const Column &column() const override { return *m_column; }
101
102 void set_column(const Column *column) override { m_column = column; }
103
104 /////////////////////////////////////////////////////////////////////////
105 // ordinal_position.
106 /////////////////////////////////////////////////////////////////////////
107
108 uint ordinal_position() const override { return m_ordinal_position; }
109
112 }
113
114 /////////////////////////////////////////////////////////////////////////
115 // referenced column name.
116 /////////////////////////////////////////////////////////////////////////
117
118 const String_type &referenced_column_name() const override {
120 }
121
124 }
125
126 public:
128 return new (std::nothrow) Foreign_key_element_impl(fk);
129 }
130
132 Foreign_key_impl *fk);
133
134 public:
135 Object_key *create_primary_key() const override;
136 bool has_new_primary_key() const override;
137
138 private:
143};
144
145///////////////////////////////////////////////////////////////////////////
146
147} // namespace dd
148
149#endif // DD__FOREIGN_KEY_ELEMENT_IMPL_INCLUDED
Definition: column.h:86
Definition: foreign_key_element_impl.h:53
uint ordinal_position() const override
Definition: foreign_key_element_impl.h:108
static Foreign_key_element_impl * restore_item(Foreign_key_impl *fk)
Definition: foreign_key_element_impl.h:127
void set_ordinal_position(uint ordinal_position)
Definition: foreign_key_element_impl.h:83
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: foreign_key_element_impl.cc:133
const String_type & referenced_column_name() const override
Definition: foreign_key_element_impl.h:118
void set_column(const Column *column) override
Definition: foreign_key_element_impl.h:102
static Foreign_key_element_impl * clone(const Foreign_key_element_impl &other, Foreign_key_impl *fk)
Definition: foreign_key_element_impl.cc:179
void set_ordinal_position(int ordinal_position) override
Definition: foreign_key_element_impl.h:110
~Foreign_key_element_impl() override=default
Foreign_key_element_impl()
Definition: foreign_key_element_impl.h:55
const Object_table & object_table() const override
Definition: foreign_key_element_impl.cc:196
bool has_new_primary_key() const override
Indicates that object is guaranteed to have primary key value which doesn't exist in database (e....
Definition: foreign_key_element_impl.cc:173
Object_key * create_primary_key() const override
Definition: foreign_key_element_impl.cc:168
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: foreign_key_element_impl.cc:202
bool restore_attributes(const Raw_record &r) override
Definition: foreign_key_element_impl.cc:97
void debug_print(String_type &outb) const override
Definition: foreign_key_element_impl.cc:153
bool validate() const override
Definition: foreign_key_element_impl.cc:73
const Column * m_column
Definition: foreign_key_element_impl.h:140
const Foreign_key & foreign_key() const override
Definition: foreign_key_element_impl.cc:65
uint m_ordinal_position
Definition: foreign_key_element_impl.h:141
const Column & column() const override
Definition: foreign_key_element_impl.h:100
Foreign_key_element_impl(Foreign_key_impl *foreign_key)
Definition: foreign_key_element_impl.h:58
String_type m_referenced_column_name
Definition: foreign_key_element_impl.h:142
void referenced_column_name(const String_type &name) override
Definition: foreign_key_element_impl.h:122
bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override
Re-establishes the state of *this by reading sdi information from the rapidjson DOM subobject provide...
Definition: foreign_key_element_impl.cc:143
Foreign_key_impl * m_foreign_key
Definition: foreign_key_element_impl.h:139
bool store_attributes(Raw_record *r) override
Definition: foreign_key_element_impl.cc:118
Definition: foreign_key_element.h:44
Definition: foreign_key_impl.h:55
Definition: foreign_key.h:46
Definition: object_key.h:37
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
Definition: raw_record.h:45
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
Definition: weak_object_impl.h:47
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
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
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
This header provides Rapidjson Type Aliases.
case opt name
Definition: sslopt-case.h:32
unsigned int uint
Definition: uca-dump.cc:29