MySQL 8.0.39
Source Code Documentation
catalogs.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_TABLES__CATALOGS_INCLUDED
25#define DD_TABLES__CATALOGS_INCLUDED
26
27#include "sql/dd/impl/tables/dd_properties.h" // TARGET_DD_VERSION
29
30namespace dd {
31
32namespace tables {
33
34///////////////////////////////////////////////////////////////////////////
35
37 public:
38 static const Catalogs &instance() {
39 static Catalogs *s_instance = new Catalogs();
40 return *s_instance;
41 }
42
43 static const CHARSET_INFO *name_collation() {
45 }
46
53 NUMBER_OF_FIELDS // Always keep this entry at the end of the enum
54 };
55
59 };
60
62 m_target_def.set_table_name("catalogs");
63
65 "id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT");
66 m_target_def.add_field(FIELD_NAME, "FIELD_NAME",
67 "name VARCHAR(64) NOT NULL COLLATE " +
68 String_type(name_collation()->m_coll_name));
69 m_target_def.add_field(FIELD_CREATED, "FIELD_CREATED",
70 "created TIMESTAMP NOT NULL");
71 m_target_def.add_field(FIELD_LAST_ALTERED, "FIELD_LAST_ALTERED",
72 "last_altered TIMESTAMP NOT NULL");
73 m_target_def.add_field(FIELD_OPTIONS, "FIELD_OPTIONS",
74 "options MEDIUMTEXT");
75
76 m_target_def.add_index(INDEX_PK_ID, "INDEX_PK_ID", "PRIMARY KEY (id)");
77 m_target_def.add_index(INDEX_UK_NAME, "INDEX_UK_NAME", "UNIQUE KEY (name)");
78
80 "INSERT INTO catalogs(id, name, options, created, last_altered) "
81 "VALUES (1, 'def', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)");
82 }
83};
84
85///////////////////////////////////////////////////////////////////////////
86
87} // namespace tables
88} // namespace dd
89
90#endif // DD_TABLES__CATALOGS_INCLUDED
void add_field(int field_number, const String_type &field_name, const String_type field_definition) override
Add a field to the object table definition.
Definition: object_table_definition_impl.h:216
void set_table_name(const String_type &name) override
Set the name of the table.
Definition: object_table_definition_impl.h:212
virtual void add_populate_statement(const String_type &statement)
Definition: object_table_definition_impl.h:243
static const CHARSET_INFO * fs_name_collation()
Get the collation which is used for names related to the file system (e.g.
Definition: object_table_definition_impl.h:161
void add_index(int index_number, const String_type &index_name, const String_type &index_definition) override
Add an index to the object table definition.
Definition: object_table_definition_impl.h:224
Definition: object_table_impl.h:36
Object_table_definition_impl m_target_def
Definition: object_table_impl.h:39
Definition: catalogs.h:36
static const Catalogs & instance()
Definition: catalogs.h:38
Catalogs()
Definition: catalogs.h:61
static const CHARSET_INFO * name_collation()
Definition: catalogs.h:43
enum_fields
Definition: catalogs.h:47
@ FIELD_LAST_ALTERED
Definition: catalogs.h:51
@ FIELD_ID
Definition: catalogs.h:48
@ NUMBER_OF_FIELDS
Definition: catalogs.h:53
@ FIELD_NAME
Definition: catalogs.h:49
@ FIELD_OPTIONS
Definition: catalogs.h:52
@ FIELD_CREATED
Definition: catalogs.h:50
enum_indexes
Definition: catalogs.h:56
@ INDEX_PK_ID
Definition: catalogs.h:57
@ INDEX_UK_NAME
Definition: catalogs.h:58
const dd::system_views::Columns_extensions * s_instance
Definition: columns_extensions.cc:41
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Definition: m_ctype.h:385
unsigned int uint
Definition: uca9-dump.cc:75