MySQL 8.0.40
Source Code Documentation
collation_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__COLLATION_IMPL_INCLUDED
25#define DD__COLLATION_IMPL_INCLUDED
26
27#include <stdio.h>
28#include <sys/types.h>
29#include <new>
30
32#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_impl
34#include "sql/dd/object_id.h"
35#include "sql/dd/string_type.h"
36#include "sql/dd/types/collation.h" // dd::Collation
37
38namespace dd {
39
40///////////////////////////////////////////////////////////////////////////
41
42class Object_table;
43class Open_dictionary_tables_ctx;
44
45///////////////////////////////////////////////////////////////////////////
46
48 public:
50 : m_is_compiled(false),
53
54 public:
55 const Object_table &object_table() const override;
56
58
59 bool validate() const override;
60
61 bool restore_attributes(const Raw_record &r) override;
62
63 bool store_attributes(Raw_record *r) override;
64
65 public:
66 /////////////////////////////////////////////////////////////////////////
67 // Character set.
68 /////////////////////////////////////////////////////////////////////////
69
70 Object_id charset_id() const override { return m_charset_id; }
71
74 }
75
76 /////////////////////////////////////////////////////////////////////////
77 // compiled
78 /////////////////////////////////////////////////////////////////////////
79
80 bool is_compiled() const override { return m_is_compiled; }
81
82 virtual void set_is_compiled(bool is_compiled) {
84 }
85
86 /////////////////////////////////////////////////////////////////////////
87 // sort_length
88 /////////////////////////////////////////////////////////////////////////
89
90 uint sort_length() const override { return m_sort_length; }
91
94 }
95
96 /////////////////////////////////////////////////////////////////////////
97 // pad_attribute
98 /////////////////////////////////////////////////////////////////////////
99
100 virtual void set_pad_attribute(enum_pad_attribute pad_attribute) {
101 assert(pad_attribute != PA_UNDEFINED);
102 m_pad_attribute = pad_attribute;
103 }
104
105 // Fix "inherits ... via dominance" warnings
107 const Entity_object_impl *impl() const override {
109 }
110 Object_id id() const override { return Entity_object_impl::id(); }
111 bool is_persistent() const override {
113 }
114 const String_type &name() const override {
116 }
117 void set_name(const String_type &name) override {
119 }
120
121 public:
122 void debug_print(String_type &outb) const override {
123 char outbuf[1024];
124 sprintf(outbuf,
125 "COLLATION OBJECT: id= {OID: %lld}, name= %s,"
126 "charset_id= {OID: %lld}, is_compiled= %d, sort_length= %u",
127 id(), name().c_str(), m_charset_id, m_is_compiled, m_sort_length);
128 outb = String_type(outbuf);
129 }
130
131 private:
132 // Fields
133 bool m_is_compiled{false};
136
137 // References to other objects
139
140 Collation *clone() const override { return new Collation_impl(*this); }
141
143 // Play simple. Proper placeholder will take the same memory as clone.
144 return clone();
145 }
146};
147
148///////////////////////////////////////////////////////////////////////////
149
150} // namespace dd
151
152#endif // DD__COLLATION_IMPL_INCLUDED
Definition: collation_impl.h:47
void set_charset_id(Object_id charset_id) override
Definition: collation_impl.h:72
uint sort_length() const override
Definition: collation_impl.h:90
const String_type & name() const override
Definition: collation_impl.h:114
Entity_object_impl * impl() override
Definition: collation_impl.h:106
bool store_attributes(Raw_record *r) override
Definition: collation_impl.cc:83
Object_id id() const override
The unique dictionary object id.
Definition: collation_impl.h:110
Collation * clone() const override
Allocate a new object and invoke the copy constructor.
Definition: collation_impl.h:140
Collation * clone_dropped_object_placeholder() const override
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Definition: collation_impl.h:142
bool restore_attributes(const Raw_record &r) override
Definition: collation_impl.cc:55
virtual void set_is_compiled(bool is_compiled)
Definition: collation_impl.h:82
virtual void set_pad_attribute(enum_pad_attribute pad_attribute)
Definition: collation_impl.h:100
virtual void set_sort_length(uint sort_length)
Definition: collation_impl.h:92
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: collation_impl.cc:127
bool validate() const override
Definition: collation_impl.cc:43
bool is_compiled() const override
Definition: collation_impl.h:80
uint m_sort_length
Definition: collation_impl.h:134
Collation_impl()
Definition: collation_impl.h:49
Object_id m_charset_id
Definition: collation_impl.h:138
enum_pad_attribute m_pad_attribute
Definition: collation_impl.h:135
Object_id charset_id() const override
Definition: collation_impl.h:70
void debug_print(String_type &outb) const override
Definition: collation_impl.h:122
const Object_table & object_table() const override
Definition: collation_impl.cc:121
const Entity_object_impl * impl() const override
Definition: collation_impl.h:107
void set_name(const String_type &name) override
Definition: collation_impl.h:117
bool m_is_compiled
Definition: collation_impl.h:133
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: collation_impl.h:111
Definition: collation.h:46
enum_pad_attribute
Definition: collation.h:59
@ PA_UNDEFINED
Definition: collation.h:59
Definition: entity_object_impl.h:44
void set_name(const String_type &name) override
Definition: entity_object_impl.h:62
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:49
const String_type & name() const override
Definition: entity_object_impl.h:60
Entity_object_impl * impl() override
Definition: entity_object_impl.h:68
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:57
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
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
const Object_id INVALID_OBJECT_ID
The default object ID which represents that the DD object is new and not persistent in dictionary tab...
Definition: object_id.h:37
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
unsigned int uint
Definition: uca9-dump.cc:75