MySQL 8.4.0
Source Code Documentation
column_type_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__COLUMN_TYPE_ELEMENT_IMPL_INCLUDED
25#define DD__COLUMN_TYPE_ELEMENT_IMPL_INCLUDED
26
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/column_type_element.h" // dd::Column_type_element
34
35namespace dd {
36
37///////////////////////////////////////////////////////////////////////////
38
39class Column;
40class Column_impl;
41class Object_key;
42class Object_table;
43class Open_dictionary_tables_ctx;
44class Raw_record;
45class Sdi_rcontext;
46class Sdi_wcontext;
47class Weak_object;
48
49///////////////////////////////////////////////////////////////////////////
50
52 public Column_type_element {
53 public:
55
57 : m_index(0), m_column(column) {}
58
60 Column_impl *parent);
61
62 ~Column_type_element_impl() override = default;
63
64 public:
65 const Object_table &object_table() const override;
66
68
69 bool validate() const override;
70
71 bool store_attributes(Raw_record *r) override;
72
73 bool restore_attributes(const Raw_record &r) override;
74
77 }
78
79 virtual uint ordinal_position() const { return index(); }
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
85 public:
87 return new (std::nothrow) Column_type_element_impl(column);
88 }
89
92 return new (std::nothrow) Column_type_element_impl(other, column);
93 }
94
95 public:
96 /////////////////////////////////////////////////////////////////////////
97 // Name.
98 /////////////////////////////////////////////////////////////////////////
99
100 const String_type &name() const override { return m_name; }
101
102 void set_name(const String_type &name) override { m_name = name; }
103
104 /////////////////////////////////////////////////////////////////////////
105 // Column
106 /////////////////////////////////////////////////////////////////////////
107
108 const Column &column() const override;
109
110 /////////////////////////////////////////////////////////////////////////
111 // index.
112 /////////////////////////////////////////////////////////////////////////
113
114 uint index() const override { return m_index; }
115
116 public:
117 void debug_print(String_type &outb) const override;
118
119 protected:
120 Object_key *create_primary_key() const override;
121 bool has_new_primary_key() const override;
122
123 protected:
124 // Fields
127
128 // References to other objects
130};
131
132///////////////////////////////////////////////////////////////////////////
133
134} // namespace dd
135
136#endif // DD__COLUMN_TYPE_ELEMENT_IMPL_INCLUDED
Definition: column_impl.h:62
Definition: column_type_element_impl.h:52
Column_type_element_impl(Column_impl *column)
Definition: column_type_element_impl.h:56
virtual uint ordinal_position() const
Definition: column_type_element_impl.h:79
void set_name(const String_type &name) override
Definition: column_type_element_impl.h:102
uint m_index
Definition: column_type_element_impl.h:126
Object_key * create_primary_key() const override
Definition: column_type_element_impl.cc:148
const String_type & name() const override
Definition: column_type_element_impl.h:100
void set_ordinal_position(uint ordinal_position)
Definition: column_type_element_impl.h:75
bool store_attributes(Raw_record *r) override
Definition: column_type_element_impl.cc:105
uint index() const override
Definition: column_type_element_impl.h:114
const Column & column() const override
Definition: column_type_element_impl.cc:66
~Column_type_element_impl() override=default
Column_type_element_impl()
Definition: column_type_element_impl.h:54
void debug_print(String_type &outb) const override
Definition: column_type_element_impl.cc:136
bool restore_attributes(const Raw_record &r) override
Definition: column_type_element_impl.cc:90
const Object_table & object_table() const override
Definition: column_type_element_impl.cc:167
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: column_type_element_impl.cc:173
Column_impl * m_column
Definition: column_type_element_impl.h:129
bool validate() const override
Definition: column_type_element_impl.cc:68
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: column_type_element_impl.cc:116
static Column_type_element_impl * clone(const Column_type_element_impl &other, Column_impl *column)
Definition: column_type_element_impl.h:90
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: column_type_element_impl.cc:152
static Column_type_element_impl * restore_item(Column_impl *column)
Definition: column_type_element_impl.h:86
String_type m_name
Definition: column_type_element_impl.h:125
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: column_type_element_impl.cc:127
Definition: column_type_element.h:44
Definition: column.h:87
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
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.