MySQL 9.1.0
Source Code Documentation
foreign_key_element_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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__FOREIGN_KEY_ELEMENT_IMPL_INCLUDED
25#define DD__FOREIGN_KEY_ELEMENT_IMPL_INCLUDED
26
27#include <stddef.h>
28#include <sys/types.h>
29#include <new>
30
31#include "sql/dd/impl/types/weak_object_impl.h" // dd::Weak_object_impl
32#include "sql/dd/sdi_fwd.h"
33#include "sql/dd/string_type.h"
34#include "sql/dd/types/foreign_key_element.h" // dd::Foreign_key_element
35
36namespace dd {
37
38///////////////////////////////////////////////////////////////////////////
39
40class Column;
41class Foreign_key;
42class Foreign_key_impl;
43class Object_key;
44class Object_table;
45class Open_dictionary_tables_ctx;
46class Raw_record;
47class Sdi_rcontext;
48class Sdi_wcontext;
49class Weak_object;
50
51///////////////////////////////////////////////////////////////////////////
52
54 public Foreign_key_element {
55 public:
58
61
64
65 ~Foreign_key_element_impl() override = default;
66
67 public:
68 const Object_table &object_table() const override;
69
71
72 bool validate() const override;
73
74 bool restore_attributes(const Raw_record &r) override;
75
76 bool store_attributes(Raw_record *r) override;
77
78 void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override;
79
80 bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override;
81
82 void debug_print(String_type &outb) const override;
83
86 }
87
88 public:
89 /////////////////////////////////////////////////////////////////////////
90 // Foreign key.
91 /////////////////////////////////////////////////////////////////////////
92
93 const Foreign_key &foreign_key() const override;
94
95 Foreign_key &foreign_key() override;
96
97 /////////////////////////////////////////////////////////////////////////
98 // column.
99 /////////////////////////////////////////////////////////////////////////
100
101 const Column &column() const override { return *m_column; }
102
103 void set_column(const Column *column) override { m_column = column; }
104
105 /////////////////////////////////////////////////////////////////////////
106 // ordinal_position.
107 /////////////////////////////////////////////////////////////////////////
108
109 uint ordinal_position() const override { return m_ordinal_position; }
110
113 }
114
115 /////////////////////////////////////////////////////////////////////////
116 // referenced column name.
117 /////////////////////////////////////////////////////////////////////////
118
119 const String_type &referenced_column_name() const override {
121 }
122
125 }
126
127 public:
129 return new (std::nothrow) Foreign_key_element_impl(fk);
130 }
131
133 Foreign_key_impl *fk);
134
135 public:
136 Object_key *create_primary_key() const override;
137 bool has_new_primary_key() const override;
138
139 private:
144};
145
146///////////////////////////////////////////////////////////////////////////
147
148} // namespace dd
149
150#endif // DD__FOREIGN_KEY_ELEMENT_IMPL_INCLUDED
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Definition: column.h:88
Definition: foreign_key_element_impl.h:54
uint ordinal_position() const override
Definition: foreign_key_element_impl.h:109
static Foreign_key_element_impl * restore_item(Foreign_key_impl *fk)
Definition: foreign_key_element_impl.h:128
void set_ordinal_position(uint ordinal_position)
Definition: foreign_key_element_impl.h:84
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: foreign_key_element_impl.cc:135
const String_type & referenced_column_name() const override
Definition: foreign_key_element_impl.h:119
void set_column(const Column *column) override
Definition: foreign_key_element_impl.h:103
static Foreign_key_element_impl * clone(const Foreign_key_element_impl &other, Foreign_key_impl *fk)
Definition: foreign_key_element_impl.cc:181
void set_ordinal_position(int ordinal_position) override
Definition: foreign_key_element_impl.h:111
~Foreign_key_element_impl() override=default
Foreign_key_element_impl()
Definition: foreign_key_element_impl.h:56
const Object_table & object_table() const override
Definition: foreign_key_element_impl.cc:198
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:175
Object_key * create_primary_key() const override
Definition: foreign_key_element_impl.cc:170
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: foreign_key_element_impl.cc:204
bool restore_attributes(const Raw_record &r) override
Definition: foreign_key_element_impl.cc:99
void debug_print(String_type &outb) const override
Definition: foreign_key_element_impl.cc:155
bool validate() const override
Definition: foreign_key_element_impl.cc:75
const Column * m_column
Definition: foreign_key_element_impl.h:141
const Foreign_key & foreign_key() const override
Definition: foreign_key_element_impl.cc:67
uint m_ordinal_position
Definition: foreign_key_element_impl.h:142
const Column & column() const override
Definition: foreign_key_element_impl.h:101
Foreign_key_element_impl(Foreign_key_impl *foreign_key)
Definition: foreign_key_element_impl.h:59
String_type m_referenced_column_name
Definition: foreign_key_element_impl.h:143
void referenced_column_name(const String_type &name) override
Definition: foreign_key_element_impl.h:123
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:145
Foreign_key_impl * m_foreign_key
Definition: foreign_key_element_impl.h:140
bool store_attributes(Raw_record *r) override
Definition: foreign_key_element_impl.cc:120
Definition: foreign_key_element.h:45
Definition: foreign_key_impl.h:57
Definition: foreign_key.h:47
Definition: object_key.h:38
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:76
Definition: raw_record.h:46
Opaque context which keeps reusable resoureces needed during deserialization.
Definition: sdi.cc:231
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:129
Definition: weak_object_impl.h:48
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
RJ_Writer Sdi_writer
Alias for the rapidjson Writer type to use in serialization.
Definition: sdi_fwd.h:64
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:49
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
This header provides Rapidjson Type Aliases.
case opt name
Definition: sslopt-case.h:29