MySQL 9.0.0
Source Code Documentation
partition_value_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__PARTITION_VALUE_IMPL_INCLUDED
25#define DD__PARTITION_VALUE_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/partition_value.h" // dd::Partition_value
35
36namespace dd {
37
38///////////////////////////////////////////////////////////////////////////
39
40class Object_key;
41class Object_table;
42class Open_dictionary_tables_ctx;
43class Partition;
44class Partition_impl;
45class Raw_record;
46class Sdi_rcontext;
47class Sdi_wcontext;
48class Weak_object;
49
50///////////////////////////////////////////////////////////////////////////
51
53 public:
55 : m_max_value(false),
56 m_null_value(false),
57 m_list_num(0),
58 m_column_num(0),
60
62 : m_max_value(false),
63 m_null_value(false),
64 m_list_num(0),
65 m_column_num(0),
67
69
70 ~Partition_value_impl() override = default;
71
72 public:
73 const Object_table &object_table() const override;
74
75 bool validate() const override;
76
77 bool store_attributes(Raw_record *r) override;
78
79 bool restore_attributes(const Raw_record &r) override;
80
81 void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override;
82
83 bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override;
84
86
87 virtual uint ordinal_position() const { return -1; }
88
89 public:
91
92 /////////////////////////////////////////////////////////////////////////
93 // index.
94 /////////////////////////////////////////////////////////////////////////
95
96 const Partition &partition() const override;
97
98 Partition &partition() override;
99
100 /////////////////////////////////////////////////////////////////////////
101 // list_num.
102 /////////////////////////////////////////////////////////////////////////
103
104 uint list_num() const override { return m_list_num; }
105
106 void set_list_num(uint list_num) override { m_list_num = list_num; }
107
108 /////////////////////////////////////////////////////////////////////////
109 // column_num.
110 /////////////////////////////////////////////////////////////////////////
111
112 uint column_num() const override { return m_column_num; }
113
115
116 /////////////////////////////////////////////////////////////////////////
117 // value.
118 /////////////////////////////////////////////////////////////////////////
119
120 const String_type &value_utf8() const override { return m_value_utf8; }
121
122 void set_value_utf8(const String_type &value) override {
123 m_value_utf8 = value;
124 }
125
126 ////////////////////////////////////////////////////////////////
127 // max_value.
128 /////////////////////////////////////////////////////////////////////////
129
130 bool max_value() const override { return m_max_value; }
131
132 void set_max_value(bool max_value) override { m_max_value = max_value; }
133
134 ////////////////////////////////////////////////////////////////
135 // null_value.
136 /////////////////////////////////////////////////////////////////////////
137
138 bool is_value_null() const override { return m_null_value; }
139
140 void set_value_null(bool is_null) override { m_null_value = is_null; }
141
142 /////////////////////////////////////////////////////////////////////////
143
144 public:
146 return new (std::nothrow) Partition_value_impl(partition);
147 }
148
151 return new (std::nothrow) Partition_value_impl(other, partition);
152 }
153
154 public:
155 void debug_print(String_type &outb) const override;
156
157 public:
158 Object_key *create_primary_key() const override;
159 bool has_new_primary_key() const override;
160
161 private:
162 // Fields
165
168
170
171 // References to other objects
173};
174
175///////////////////////////////////////////////////////////////////////////
176
177/**
178 Used to sort Partition_value objects for the same partition first
179 according to list number and then according to the column number.
180*/
181
184 const dd::Partition_value *pv2) const {
185 return ((pv1->list_num() < pv2->list_num()) ||
186 (pv1->list_num() == pv2->list_num() &&
187 pv1->column_num() < pv2->column_num()));
188 }
189};
190
191///////////////////////////////////////////////////////////////////////////
192
193} // namespace dd
194
195#endif // DD__PARTITION_VALUE_IMPL_INCLUDED
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
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: partition_impl.h:60
Definition: partition_value_impl.h:52
void set_value_utf8(const String_type &value) override
Definition: partition_value_impl.h:122
static Partition_value_impl * clone(const Partition_value_impl &other, Partition_impl *partition)
Definition: partition_value_impl.h:149
uint m_list_num
Definition: partition_value_impl.h:166
void debug_print(String_type &outb) const override
Definition: partition_value_impl.cc:147
~Partition_value_impl() override=default
bool m_max_value
Definition: partition_value_impl.h:163
String_type m_value_utf8
Definition: partition_value_impl.h:169
bool restore_attributes(const Raw_record &r) override
Definition: partition_value_impl.cc:83
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: partition_value_impl.cc:193
uint column_num() const override
Definition: partition_value_impl.h:112
bool is_value_null() const override
Definition: partition_value_impl.h:138
bool validate() const override
Definition: partition_value_impl.cc:71
bool max_value() const override
Definition: partition_value_impl.h:130
Partition_value_impl()
Definition: partition_value_impl.h:54
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: partition_value_impl.cc:124
uint list_num() const override
Definition: partition_value_impl.h:104
void set_value_null(bool is_null) override
Definition: partition_value_impl.h:140
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: partition_value_impl.cc:136
bool m_null_value
Definition: partition_value_impl.h:164
Object_key * create_primary_key() const override
Definition: partition_value_impl.cc:164
void set_list_num(uint list_num) override
Definition: partition_value_impl.h:106
const String_type & value_utf8() const override
Definition: partition_value_impl.h:120
void set_ordinal_position(uint)
Definition: partition_value_impl.h:85
void set_max_value(bool max_value) override
Definition: partition_value_impl.h:132
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: partition_value_impl.cc:169
static Partition_value_impl * restore_item(Partition_impl *partition)
Definition: partition_value_impl.h:145
void set_column_num(uint column_num) override
Definition: partition_value_impl.h:114
bool store_attributes(Raw_record *r) override
Definition: partition_value_impl.cc:109
const Object_table & object_table() const override
Definition: partition_value_impl.cc:187
virtual uint ordinal_position() const
Definition: partition_value_impl.h:87
const Partition & partition() const override
Definition: partition_value_impl.cc:63
uint m_column_num
Definition: partition_value_impl.h:167
Partition_value_impl(Partition_impl *partition)
Definition: partition_value_impl.h:61
Partition_impl * m_partition
Definition: partition_value_impl.h:172
Definition: partition_value.h:45
virtual uint column_num() const =0
virtual uint list_num() const =0
Definition: partition.h:51
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.
Used to sort Partition_value objects for the same partition first according to list number and then a...
Definition: partition_value_impl.h:182
bool operator()(const dd::Partition_value *pv1, const dd::Partition_value *pv2) const
Definition: partition_value_impl.h:183