MySQL 8.0.30
Source Code Documentation
charset_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2022, 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__CHARSET_IMPL_INCLUDED
24#define DD__CHARSET_IMPL_INCLUDED
25
26#include <stdio.h>
27#include <sys/types.h>
28#include <new>
29
30#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_object_imp
32#include "sql/dd/object_id.h"
33#include "sql/dd/string_type.h"
34#include "sql/dd/types/charset.h" // dd::Charset
35
36namespace dd {
37
38///////////////////////////////////////////////////////////////////////////
39
40class Object_table;
41class Open_dictionary_tables_ctx;
42class Raw_record;
43class Weak_object;
44class Object_table;
45
46///////////////////////////////////////////////////////////////////////////
47
48class Charset_impl : public Entity_object_impl, public Charset {
49 public:
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 // Default collation.
67 /////////////////////////////////////////////////////////////////////////
68
71 }
72
73 void set_default_collation_id(Object_id collation_id) override {
74 m_default_collation_id = collation_id;
75 }
76
77 /////////////////////////////////////////////////////////////////////////
78 // mb_max_length
79 /////////////////////////////////////////////////////////////////////////
80
81 uint mb_max_length() const override { return m_mb_max_length; }
82
85 }
86
87 /////////////////////////////////////////////////////////////////////////
88 // comment
89 /////////////////////////////////////////////////////////////////////////
90
91 const String_type &comment() const override { return m_comment; }
92
93 virtual void set_comment(const String_type &comment) { m_comment = comment; }
94
95 // Fix "inherits ... via dominance" warnings
97 const Entity_object_impl *impl() const override {
99 }
100 Object_id id() const override { return Entity_object_impl::id(); }
101 bool is_persistent() const override {
103 }
104 const String_type &name() const override {
106 }
107 void set_name(const String_type &name) override {
109 }
110
111 public:
112 void debug_print(String_type &outb) const override {
113 char outbuf[1024];
114 sprintf(outbuf,
115 "CHARSET OBJECT: {OID: %lld}, name= %s, "
116 "collation_id= {OID: %lld}, mb_max_length= %u, "
117 "comment= %s",
119 m_comment.c_str());
120 outb = String_type(outbuf);
121 }
122
123 private:
126
128
129 Charset *clone() const override { return new Charset_impl(*this); }
130
132 /*
133 Even though we don't drop charsets en masse we still create slimmed
134 down version for consistency sake.
135 */
136 Charset_impl *placeholder = new Charset_impl();
137 placeholder->set_id(id());
138 placeholder->set_name(name());
139 return placeholder;
140 }
141};
142
143///////////////////////////////////////////////////////////////////////////
144
145} // namespace dd
146
147#endif // DD__CHARSET_IMPL_INCLUDED
Definition: charset_impl.h:48
Charset_impl()
Definition: charset_impl.h:50
uint m_mb_max_length
Definition: charset_impl.h:124
bool store_attributes(Raw_record *r) override
Definition: charset_impl.cc:68
bool restore_attributes(const Raw_record &r) override
Definition: charset_impl.cc:53
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: charset_impl.cc:98
const String_type & comment() const override
Definition: charset_impl.h:91
void set_name(const String_type &name) override
Definition: charset_impl.h:107
const Entity_object_impl * impl() const override
Definition: charset_impl.h:97
Charset * 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: charset_impl.h:131
String_type m_comment
Definition: charset_impl.h:125
const String_type & name() const override
Definition: charset_impl.h:104
const Object_table & object_table() const override
Definition: charset_impl.cc:92
Object_id id() const override
The unique dictionary object id.
Definition: charset_impl.h:100
Charset * clone() const override
Allocate a new object and invoke the copy constructor.
Definition: charset_impl.h:129
uint mb_max_length() const override
Definition: charset_impl.h:81
void debug_print(String_type &outb) const override
Definition: charset_impl.h:112
void set_default_collation_id(Object_id collation_id) override
Definition: charset_impl.h:73
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: charset_impl.h:101
Object_id default_collation_id() const override
Definition: charset_impl.h:69
virtual void set_mb_max_length(uint mb_max_length)
Definition: charset_impl.h:83
bool validate() const override
Definition: charset_impl.cc:41
virtual void set_comment(const String_type &comment)
Definition: charset_impl.h:93
Entity_object_impl * impl() override
Definition: charset_impl.h:96
Object_id m_default_collation_id
Definition: charset_impl.h:127
Definition: charset.h:45
Definition: entity_object_impl.h:43
void set_name(const String_type &name) override
Definition: entity_object_impl.h:61
void set_id(Object_id id)
Definition: entity_object_impl.h:50
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: uca-dump.cc:29