MySQL  8.0.19
Source Code Documentation
partition_value_impl.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
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__PARTITION_VALUE_IMPL_INCLUDED
24 #define DD__PARTITION_VALUE_IMPL_INCLUDED
25 
26 #include <stddef.h>
27 #include <sys/types.h>
28 #include <new>
29 
30 #include "sql/dd/impl/types/weak_object_impl.h" // dd::Weak_object_impl
31 #include "sql/dd/sdi_fwd.h"
32 #include "sql/dd/string_type.h"
33 #include "sql/dd/types/partition_value.h" // dd::Partition_value
34 
35 namespace dd {
36 
37 ///////////////////////////////////////////////////////////////////////////
38 
39 class Object_key;
40 class Object_table;
41 class Open_dictionary_tables_ctx;
42 class Partition;
43 class Partition_impl;
44 class Raw_record;
45 class Sdi_rcontext;
46 class Sdi_wcontext;
47 class Weak_object;
48 
49 ///////////////////////////////////////////////////////////////////////////
50 
52  public:
54  : m_max_value(false),
56  m_list_num(0),
57  m_column_num(0),
58  m_partition(NULL) {}
59 
61  : m_max_value(false),
63  m_list_num(0),
64  m_column_num(0),
66 
68 
69  virtual ~Partition_value_impl() {}
70 
71  public:
72  virtual const Object_table &object_table() const;
73 
74  virtual bool validate() const;
75 
76  virtual bool store_attributes(Raw_record *r);
77 
78  virtual bool restore_attributes(const Raw_record &r);
79 
80  void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const;
81 
82  bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val);
83 
85 
86  virtual uint ordinal_position() const { return -1; }
87 
88  public:
90 
91  /////////////////////////////////////////////////////////////////////////
92  // index.
93  /////////////////////////////////////////////////////////////////////////
94 
95  virtual const Partition &partition() const;
96 
97  virtual Partition &partition();
98 
99  /////////////////////////////////////////////////////////////////////////
100  // list_num.
101  /////////////////////////////////////////////////////////////////////////
102 
103  virtual uint list_num() const { return m_list_num; }
104 
106 
107  /////////////////////////////////////////////////////////////////////////
108  // column_num.
109  /////////////////////////////////////////////////////////////////////////
110 
111  virtual uint column_num() const { return m_column_num; }
112 
114 
115  /////////////////////////////////////////////////////////////////////////
116  // value.
117  /////////////////////////////////////////////////////////////////////////
118 
119  virtual const String_type &value_utf8() const { return m_value_utf8; }
120 
121  virtual void set_value_utf8(const String_type &value) {
123  }
124 
125  ////////////////////////////////////////////////////////////////
126  // max_value.
127  /////////////////////////////////////////////////////////////////////////
128 
129  virtual bool max_value() const { return m_max_value; }
130 
131  virtual void set_max_value(bool max_value) { m_max_value = max_value; }
132 
133  ////////////////////////////////////////////////////////////////
134  // null_value.
135  /////////////////////////////////////////////////////////////////////////
136 
137  virtual bool is_value_null() const { return m_null_value; }
138 
139  virtual void set_value_null(bool is_null) { m_null_value = is_null; }
140 
141  /////////////////////////////////////////////////////////////////////////
142 
143  public:
145  return new (std::nothrow) Partition_value_impl(partition);
146  }
147 
150  return new (std::nothrow) Partition_value_impl(other, partition);
151  }
152 
153  public:
154  virtual void debug_print(String_type &outb) const;
155 
156  public:
157  virtual Object_key *create_primary_key() const;
158  virtual bool has_new_primary_key() const;
159 
160  private:
161  // Fields
164 
167 
169 
170  // References to other objects
172 };
173 
174 ///////////////////////////////////////////////////////////////////////////
175 
176 /**
177  Used to sort Partition_value objects for the same partition first
178  according to list number and then according to the column number.
179 */
180 
183  const dd::Partition_value *pv2) const {
184  return ((pv1->list_num() < pv2->list_num()) ||
185  (pv1->list_num() == pv2->list_num() &&
186  pv1->column_num() < pv2->column_num()));
187  }
188 };
189 
190 ///////////////////////////////////////////////////////////////////////////
191 
192 } // namespace dd
193 
194 #endif // DD__PARTITION_VALUE_IMPL_INCLUDED
dd::Partition_value_impl::value_utf8
virtual const String_type & value_utf8() const
Definition: partition_value_impl.h:119
dd::Partition_value_impl::set_value_utf8
virtual void set_value_utf8(const String_type &value)
Definition: partition_value_impl.h:121
dd::Partition_value_impl::partition
virtual const Partition & partition() const
Definition: partition_value_impl.cc:61
dd::Weak_object_impl
Definition: weak_object_impl.h:43
dd::Partition_impl
Definition: partition_impl.h:59
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
NULL
#define NULL
Definition: types.h:55
dd::RJ_Value
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:48
dd::Partition_value
Definition: partition_value.h:44
dd::Partition_value_impl::~Partition_value_impl
virtual ~Partition_value_impl()
Definition: partition_value_impl.h:69
dd::Partition_value_impl::set_list_num
virtual void set_list_num(uint list_num)
Definition: partition_value_impl.h:105
dd::Partition_value_impl
Definition: partition_value_impl.h:51
dd::Partition_value_impl::restore_attributes
virtual bool restore_attributes(const Raw_record &r)
Definition: partition_value_impl.cc:81
dd::Partition_value_impl::is_value_null
virtual bool is_value_null() const
Definition: partition_value_impl.h:137
dd::Partition_value_impl::serialize
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const
Converts *this into json.
Definition: partition_value_impl.cc:122
value
const string value("\"Value\"")
dd::Sdi_rcontext
Opaque context which keeps reusable resoureces needed during deserialization.
Definition: sdi.cc:229
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
dd::Partition_value_impl::set_max_value
virtual void set_max_value(bool max_value)
Definition: partition_value_impl.h:131
dd::Partition_value_impl::has_new_primary_key
virtual bool has_new_primary_key() const
Indicates that object is guaranteed to have primary key value which doesn't exist in database (e....
Definition: partition_value_impl.cc:167
dd::Partition_value_order_comparator::operator()
bool operator()(const dd::Partition_value *pv1, const dd::Partition_value *pv2) const
Definition: partition_value_impl.h:182
dd::Partition_value_impl::debug_print
virtual void debug_print(String_type &outb) const
Definition: partition_value_impl.cc:145
dd::Open_dictionary_tables_ctx
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
dd::Partition_value_impl::m_value_utf8
String_type m_value_utf8
Definition: partition_value_impl.h:168
dd::Partition_value_impl::restore_item
static Partition_value_impl * restore_item(Partition_impl *partition)
Definition: partition_value_impl.h:144
dd::Raw_record
Definition: raw_record.h:53
r
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
dd::Partition_value_impl::m_max_value
bool m_max_value
Definition: partition_value_impl.h:162
uint
unsigned int uint
Definition: uca-dump.cc:29
dd::Partition_value::column_num
virtual uint column_num() const =0
dd::Sdi_writer
RJ_Writer Sdi_writer
Alias for the rapidjson Writer type to use in serialization.
Definition: sdi_fwd.h:63
dd::Partition_value_impl::store_attributes
virtual bool store_attributes(Raw_record *r)
Definition: partition_value_impl.cc:107
string_type.h
dd::Partition_value_impl::m_null_value
bool m_null_value
Definition: partition_value_impl.h:163
weak_object_impl.h
dd::Partition_value_impl::register_tables
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: partition_value_impl.cc:191
dd::Sdi_wcontext
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:126
dd::Partition_value_impl::column_num
virtual uint column_num() const
Definition: partition_value_impl.h:111
dd::Partition_value_impl::m_partition
Partition_impl * m_partition
Definition: partition_value_impl.h:171
sdi_fwd.h
dd::Partition_value_impl::m_column_num
uint m_column_num
Definition: partition_value_impl.h:166
dd::Partition_value_impl::validate
virtual bool validate() const
Definition: partition_value_impl.cc:69
dd::Partition_value_impl::m_list_num
uint m_list_num
Definition: partition_value_impl.h:165
dd::Partition_value_impl::list_num
virtual uint list_num() const
Definition: partition_value_impl.h:103
dd::Partition_value_impl::deserialize
bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val)
Re-establishes the state of *this by reading sdi information from the rapidjson DOM subobject provide...
Definition: partition_value_impl.cc:134
dd::Partition_value_impl::Partition_value_impl
Partition_value_impl(Partition_impl *partition)
Definition: partition_value_impl.h:60
dd::Object_key
Definition: object_key.h:37
dd::Partition_value_impl::object_table
virtual const Object_table & object_table() const
Definition: partition_value_impl.cc:185
dd::Partition_value_impl::Partition_value_impl
Partition_value_impl()
Definition: partition_value_impl.h:53
dd::Partition_value_impl::ordinal_position
virtual uint ordinal_position() const
Definition: partition_value_impl.h:86
dd::Object_table
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
dd::Partition_value::list_num
virtual uint list_num() const =0
partition_value.h
dd::Partition_value_impl::create_primary_key
virtual Object_key * create_primary_key() const
Definition: partition_value_impl.cc:162
dd::Partition
Definition: partition.h:50
dd::Partition_value_impl::max_value
virtual bool max_value() const
Definition: partition_value_impl.h:129
dd::Partition_value_impl::set_ordinal_position
void set_ordinal_position(uint)
Definition: partition_value_impl.h:84
dd::Partition_value_order_comparator
Used to sort Partition_value objects for the same partition first according to list number and then a...
Definition: partition_value_impl.h:181
dd::Partition_value_impl::set_value_null
virtual void set_value_null(bool is_null)
Definition: partition_value_impl.h:139
dd::Partition_value_impl::set_column_num
virtual void set_column_num(uint column_num)
Definition: partition_value_impl.h:113
false
#define false
Definition: config_static.h:43
dd::Partition_value_impl::clone
static Partition_value_impl * clone(const Partition_value_impl &other, Partition_impl *partition)
Definition: partition_value_impl.h:148