MySQL 8.3.0
Source Code Documentation
index_element.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2023, 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_INCLUDED
24#define DD__INDEX_ELEMENT_INCLUDED
25
26#include "m_string.h"
27#include "my_inttypes.h"
28#include "sql/dd/sdi_fwd.h" // dd::Sdi_wcontext
29#include "sql/dd/types/weak_object.h" // dd::Weak_object
30
31namespace dd {
32
33///////////////////////////////////////////////////////////////////////////
34
35class Column;
36class Index;
37class Index_element_impl;
38
39namespace tables {
40class Index_column_usage;
41}
42
43///////////////////////////////////////////////////////////////////////////
44
45class Index_element : virtual public Weak_object {
46 public:
49
50 public:
52
53 public:
54 ~Index_element() override = default;
55
56 /////////////////////////////////////////////////////////////////////////
57 // index.
58 /////////////////////////////////////////////////////////////////////////
59
60 virtual const Index &index() const = 0;
61
62 virtual Index &index() = 0;
63
64 /////////////////////////////////////////////////////////////////////////
65 // column.
66 /////////////////////////////////////////////////////////////////////////
67
68 virtual const Column &column() const = 0;
69
70 virtual Column &column() = 0;
71
72 /////////////////////////////////////////////////////////////////////////
73 // ordinal_position.
74 /////////////////////////////////////////////////////////////////////////
75
76 virtual uint ordinal_position() const = 0;
77
78 /////////////////////////////////////////////////////////////////////////
79 // length.
80 /////////////////////////////////////////////////////////////////////////
81
82 virtual uint length() const = 0;
83 virtual void set_length(uint length) = 0;
84 virtual void set_length_null(bool is_null) = 0;
85 virtual bool is_length_null() const = 0;
86
87 /////////////////////////////////////////////////////////////////////////
88 // order.
89 /////////////////////////////////////////////////////////////////////////
90
91 virtual enum_index_element_order order() const = 0;
93
94 /////////////////////////////////////////////////////////////////////////
95 // hidden.
96 /////////////////////////////////////////////////////////////////////////
97
98 virtual bool is_hidden() const = 0;
99 virtual void set_hidden(bool hidden) = 0;
100
101 /**
102 Converts *this into json.
103
104 Converts all member variables that are to be included in the sdi
105 into json by transforming them appropriately and passing them to
106 the rapidjson writer provided.
107
108 @param wctx opaque context for data needed by serialization
109 @param w rapidjson writer which will perform conversion to json
110
111 */
112
113 virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const = 0;
114
115 /**
116 Re-establishes the state of *this by reading sdi information from
117 the rapidjson DOM subobject provided.
118
119 Cross-references encountered within this object are tracked in
120 sdictx, so that they can be updated when the entire object graph
121 has been established.
122
123 @param rctx stores book-keeping information for the
124 deserialization process
125 @param val subobject of rapidjson DOM containing json
126 representation of this object
127 */
128
129 virtual bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) = 0;
130
131 /**
132 Check if index element (a.k.a. key part) is a prefix of the column used.
133 */
134 virtual bool is_prefix() const = 0;
135};
136
137///////////////////////////////////////////////////////////////////////////
138
139} // namespace dd
140
141#endif // DD__INDEX_ELEMENT_INCLUDED
Definition: column.h:86
Definition: index_element_impl.h:53
Definition: index_element.h:45
virtual uint ordinal_position() const =0
virtual bool is_length_null() const =0
virtual void set_length(uint length)=0
virtual enum_index_element_order order() const =0
virtual Column & column()=0
virtual const Index & index() const =0
enum_index_element_order
Definition: index_element.h:51
@ ORDER_ASC
Definition: index_element.h:51
@ ORDER_UNDEF
Definition: index_element.h:51
@ ORDER_DESC
Definition: index_element.h:51
virtual bool is_prefix() const =0
Check if index element (a.k.a.
virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const =0
Converts *this into json.
virtual void set_order(enum_index_element_order order)=0
Index_element_impl Impl
Definition: index_element.h:47
virtual void set_length_null(bool is_null)=0
virtual Index & index()=0
virtual bool is_hidden() 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...
tables::Index_column_usage DD_table
Definition: index_element.h:48
virtual const Column & column() const =0
virtual void set_hidden(bool hidden)=0
~Index_element() override=default
virtual uint length() const =0
Definition: index.h:50
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: index_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
This header provides Rapidjson Type Aliases.