MySQL  8.0.19
Source Code Documentation
collation_impl.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2018, 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__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 
37 namespace dd {
38 
39 ///////////////////////////////////////////////////////////////////////////
40 
41 class Object_table;
42 class Open_dictionary_tables_ctx;
43 
44 ///////////////////////////////////////////////////////////////////////////
45 
47  public:
50  m_sort_length(0),
52 
53  public:
54  virtual const Object_table &object_table() const;
55 
57 
58  virtual bool validate() const;
59 
60  virtual bool restore_attributes(const Raw_record &r);
61 
62  virtual bool store_attributes(Raw_record *r);
63 
64  public:
65  /////////////////////////////////////////////////////////////////////////
66  // Character set.
67  /////////////////////////////////////////////////////////////////////////
68 
69  virtual Object_id charset_id() const { return m_charset_id; }
70 
73  }
74 
75  /////////////////////////////////////////////////////////////////////////
76  // compiled
77  /////////////////////////////////////////////////////////////////////////
78 
79  virtual bool is_compiled() const { return m_is_compiled; }
80 
81  virtual void set_is_compiled(bool is_compiled) {
83  }
84 
85  /////////////////////////////////////////////////////////////////////////
86  // sort_length
87  /////////////////////////////////////////////////////////////////////////
88 
89  virtual uint sort_length() const { 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  DBUG_ASSERT(pad_attribute != PA_UNDEFINED);
101  m_pad_attribute = pad_attribute;
102  }
103 
104  // Fix "inherits ... via dominance" warnings
106  virtual const Entity_object_impl *impl() const {
107  return Entity_object_impl::impl();
108  }
109  virtual Object_id id() const { return Entity_object_impl::id(); }
110  virtual bool is_persistent() const {
112  }
113  virtual const String_type &name() const { return Entity_object_impl::name(); }
114  virtual void set_name(const String_type &name) {
116  }
117 
118  public:
119  virtual void debug_print(String_type &outb) const {
120  char outbuf[1024];
121  sprintf(outbuf,
122  "COLLATION OBJECT: id= {OID: %lld}, name= %s,"
123  "charset_id= {OID: %lld}, is_compiled= %d, sort_length= %u",
124  id(), name().c_str(), m_charset_id, m_is_compiled, m_sort_length);
125  outb = String_type(outbuf);
126  }
127 
128  private:
129  // Fields
133 
134  // References to other objects
136 
137  Collation *clone() const { return new Collation_impl(*this); }
138 };
139 
140 ///////////////////////////////////////////////////////////////////////////
141 
142 } // namespace dd
143 
144 #endif // DD__COLLATION_IMPL_INCLUDED
dd::Collation_impl::sort_length
virtual uint sort_length() const
Definition: collation_impl.h:89
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
dd::Entity_object_impl::name
virtual const String_type & name() const override
Definition: entity_object_impl.h:61
dd::Collation_impl::is_persistent
virtual bool is_persistent() const
Is dictionary object persistent in dictionary tables ?
Definition: collation_impl.h:110
dd::Collation::PA_UNDEFINED
@ PA_UNDEFINED
Definition: collation.h:58
dd::Collation_impl::name
virtual const String_type & name() const
Definition: collation_impl.h:113
dd::Collation_impl::object_table
virtual const Object_table & object_table() const
Definition: collation_impl.cc:120
raw_record.h
dd::Collation::enum_pad_attribute
enum_pad_attribute
Definition: collation.h:58
dd::Entity_object_impl::set_name
virtual void set_name(const String_type &name) override
Definition: entity_object_impl.h:63
dd::Collation_impl
Definition: collation_impl.h:46
collation.h
dd::Collation_impl::set_name
virtual void set_name(const String_type &name)
Definition: collation_impl.h:114
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
dd::Collation_impl::register_tables
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: collation_impl.cc:126
object_id.h
dd::Open_dictionary_tables_ctx
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
dd::Collation_impl::clone
Collation * clone() const
Allocate a new object and invoke the copy contructor.
Definition: collation_impl.h:137
dd::Raw_record
Definition: raw_record.h:53
dd::Entity_object_impl::id
virtual Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:48
dd::Collation_impl::m_is_compiled
bool m_is_compiled
Definition: collation_impl.h:130
dd::Collation_impl::impl
virtual const Entity_object_impl * impl() const
Definition: collation_impl.h:106
r
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
uint
unsigned int uint
Definition: uca-dump.cc:29
dd::Collation_impl::m_sort_length
uint m_sort_length
Definition: collation_impl.h:131
string_type.h
dd::Collation_impl::is_compiled
virtual bool is_compiled() const
Definition: collation_impl.h:79
dd::Collation_impl::set_charset_id
virtual void set_charset_id(Object_id charset_id)
Definition: collation_impl.h:71
dd::Collation_impl::Collation_impl
Collation_impl()
Definition: collation_impl.h:48
weak_object_impl.h
dd::Collation_impl::restore_attributes
virtual bool restore_attributes(const Raw_record &r)
Definition: collation_impl.cc:54
dd::Collation_impl::set_is_compiled
virtual void set_is_compiled(bool is_compiled)
Definition: collation_impl.h:81
dd::Collation_impl::id
virtual Object_id id() const
The unique dictionary object id.
Definition: collation_impl.h:109
dd::Collation_impl::charset_id
virtual Object_id charset_id() const
Definition: collation_impl.h:69
entity_object_impl.h
dd::Entity_object_impl::is_persistent
virtual bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:56
dd::Collation_impl::store_attributes
virtual bool store_attributes(Raw_record *r)
Definition: collation_impl.cc:82
dd::Object_id
unsigned long long Object_id
Definition: object_id.h:30
dd::INVALID_OBJECT_ID
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
DBUG_ASSERT
#define DBUG_ASSERT(A)
Definition: my_dbug.h:197
dd::Collation_impl::set_pad_attribute
virtual void set_pad_attribute(enum_pad_attribute pad_attribute)
Definition: collation_impl.h:99
dd::Entity_object_impl::impl
virtual Entity_object_impl * impl() override
Definition: entity_object_impl.h:71
dd::Object_table
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
dd::Collation_impl::impl
virtual Entity_object_impl * impl()
Definition: collation_impl.h:105
dd::Collation_impl::m_pad_attribute
enum_pad_attribute m_pad_attribute
Definition: collation_impl.h:132
dd::Entity_object_impl
Definition: entity_object_impl.h:42
dd::Collation_impl::set_sort_length
virtual void set_sort_length(uint sort_length)
Definition: collation_impl.h:91
dd::Collation_impl::validate
virtual bool validate() const
Definition: collation_impl.cc:42
dd::Collation_impl::debug_print
virtual void debug_print(String_type &outb) const
Definition: collation_impl.h:119
dd::Collation_impl::m_charset_id
Object_id m_charset_id
Definition: collation_impl.h:135
dd::Collation
Definition: collation.h:45
false
#define false
Definition: config_static.h:43