MySQL 8.0.30
Source Code Documentation
index_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__INDEX_ELEMENT_IMPL_INCLUDED
24#define DD__INDEX_ELEMENT_IMPL_INCLUDED
25
26#include <stddef.h>
27#include <sys/types.h>
28#include <new>
29
30#include "sql/dd/impl/types/index_impl.h" // dd::Index_impl
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/index_element.h" // dd::Index_element
35
36namespace dd {
37
38///////////////////////////////////////////////////////////////////////////
39
40class Column;
41class Index;
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:
56 m_length(-1),
58 m_hidden(false),
61
64 m_length(-1),
66 m_hidden(false),
69
71 Column *column);
72
73 ~Index_element_impl() override = default;
74
75 public:
76 const Object_table &object_table() const override;
77
78 bool validate() const override;
79
80 bool store_attributes(Raw_record *r) override;
81
82 bool restore_attributes(const Raw_record &r) override;
83
84 void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override;
85
86 bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override;
87
90 }
91
92 public:
94
95 /////////////////////////////////////////////////////////////////////////
96 // index.
97 /////////////////////////////////////////////////////////////////////////
98
99 const Index &index() const override { return *m_index; }
100
101 Index &index() override { return *m_index; }
102
103 /////////////////////////////////////////////////////////////////////////
104 // column.
105 /////////////////////////////////////////////////////////////////////////
106
107 const Column &column() const override { return *m_column; }
108
109 Column &column() override { return *m_column; }
110
111 /////////////////////////////////////////////////////////////////////////
112 // ordinal_position.
113 /////////////////////////////////////////////////////////////////////////
114
115 uint ordinal_position() const override { return m_ordinal_position; }
116
117 /////////////////////////////////////////////////////////////////////////
118 // length.
119 /////////////////////////////////////////////////////////////////////////
120
121 uint length() const override { return m_length; }
122
123 void set_length(uint length) override { m_length = length; }
124
125 void set_length_null(bool) override { m_length = (uint)-1; }
126
127 bool is_length_null() const override { return m_length == (uint)-1; }
128
129 /////////////////////////////////////////////////////////////////////////
130 // is_hidden.
131 /////////////////////////////////////////////////////////////////////////
132
133 bool is_hidden() const override { return m_hidden; }
134
135 void set_hidden(bool hidden) override { m_hidden = hidden; }
136
137 /////////////////////////////////////////////////////////////////////////
138 // order.
139 /////////////////////////////////////////////////////////////////////////
140
141 enum_index_element_order order() const override { return m_order; }
142
144
145 bool is_prefix() const override;
146
147 public:
149 return new (std::nothrow) Index_element_impl(index, nullptr);
150 }
151
152 static Index_element_impl *clone(const Index_element_impl &other,
154
155 public:
156 void debug_print(String_type &outb) const override;
157
158 public:
159 Object_key *create_primary_key() const override;
160 bool has_new_primary_key() const override;
161
162 private:
163 // Fields
166
168
170
171 // References to other objects
174};
175
176///////////////////////////////////////////////////////////////////////////
177
178} // namespace dd
179
180#endif // DD__INDEX_ELEMENT_IMPL_INCLUDED
Definition: column.h:86
Definition: index_element_impl.h:52
bool m_hidden
Definition: index_element_impl.h:169
bool store_attributes(Raw_record *r) override
Definition: index_element_impl.cc:99
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: index_element_impl.cc:132
Column & column() override
Definition: index_element_impl.h:109
uint ordinal_position() const override
Definition: index_element_impl.h:115
void set_length(uint length) override
Definition: index_element_impl.h:123
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: index_element_impl.cc:221
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: index_element_impl.cc:165
Index_impl * m_index
Definition: index_element_impl.h:172
uint m_length
Definition: index_element_impl.h:165
const Index & index() const override
Definition: index_element_impl.h:99
Index & index() override
Definition: index_element_impl.h:101
bool is_hidden() const override
Definition: index_element_impl.h:133
void set_ordinal_position(uint ordinal_position)
Definition: index_element_impl.h:88
bool restore_attributes(const Raw_record &r) override
Definition: index_element_impl.cc:75
void set_order(enum_index_element_order order) override
Definition: index_element_impl.h:143
void set_length_null(bool) override
Definition: index_element_impl.h:125
uint length() const override
Definition: index_element_impl.h:121
Index_element_impl(Index_impl *index, Column *column)
Definition: index_element_impl.h:62
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: index_element_impl.cc:120
Column * m_column
Definition: index_element_impl.h:173
static Index_element_impl * restore_item(Index_impl *index)
Definition: index_element_impl.h:148
enum_index_element_order m_order
Definition: index_element_impl.h:167
uint m_ordinal_position
Definition: index_element_impl.h:164
bool is_length_null() const override
Definition: index_element_impl.h:127
bool validate() const override
Definition: index_element_impl.cc:63
Object_key * create_primary_key() const override
Definition: index_element_impl.cc:160
void debug_print(String_type &outb) const override
Definition: index_element_impl.cc:143
~Index_element_impl() override=default
const Object_table & object_table() const override
Definition: index_element_impl.cc:215
Index_element_impl()
Definition: index_element_impl.h:54
enum_index_element_order order() const override
Definition: index_element_impl.h:141
static Index_element_impl * clone(const Index_element_impl &other, Index_impl *index)
Definition: index_element_impl.cc:194
bool is_prefix() const override
Check if index element represents prefix key part on the column.
Definition: index_element_impl.cc:178
void set_hidden(bool hidden) override
Definition: index_element_impl.h:135
const Column & column() const override
Definition: index_element_impl.h:107
Definition: index_element.h:44
enum_index_element_order
Definition: index_element.h:50
@ ORDER_ASC
Definition: index_element.h:50
Definition: index_impl.h:58
Definition: index.h:50
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.
unsigned int uint
Definition: uca-dump.cc:29