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