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