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