MySQL 8.0.31
Source Code Documentation
dd_table_share.h
Go to the documentation of this file.
1#ifndef DD_TABLE_SHARE_INCLUDED
2#define DD_TABLE_SHARE_INCLUDED
3/* Copyright (c) 2014, 2022, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24
25#include <sys/types.h>
26
27#include "field_types.h"
28#include "m_ctype.h"
29#include "my_inttypes.h"
30#include "my_sys.h" // get_charset
31#include "sql/dd/object_id.h" // dd::Object_id
32
33class Field;
34class KEY_PART_INFO;
35class THD;
36struct TABLE_SHARE;
37
38namespace dd {
39class Table;
40
41enum class enum_column_types;
42} // namespace dd
43
44/**
45 Read the table definition from the data-dictionary.
46
47 @param thd Thread handler
48 @param share Fill this with table definition
49 @param table_def A data-dictionary Table-object describing
50 table to be used for opening, instead of reading
51 information from DD.
52
53 @note
54 This function is called when the table definition is not cached in
55 table_def_cache.
56 The data is returned in 'share', which is allocated by
57 alloc_table_share().. The code assumes that share is initialized.
58
59 @returns
60 false OK
61 true Error
62*/
63bool open_table_def(THD *thd, TABLE_SHARE *share, const dd::Table &table_def);
64
65/**
66 Read the table definition from the data-dictionary.
67
68 @param thd Thread handler
69 @param share Fill this with table definition
70 @param table_def A data-dictionary Table-object describing
71 table to be used for opening.
72
73 @note
74 This function is called from InnoDB, and will suppress errors
75 due to:
76 Invalid collations.
77 Missing FTS parser.
78
79 @returns
80 false OK
81 true Error
82*/
84 const dd::Table &table_def);
85
86/* Map from new to old field type. */
88
90 return get_charset(static_cast<uint>(dd_cs_id), MYF(0));
91}
92
93/**
94 Check if the given key_part is suitable to be promoted as part of
95 primary key.
96
97 @param key_part - pointer to KEY_PART_INTO which we are checking.
98 @param table_field - Pointer to Field of column used by key_part.
99
100 @returns
101 true - Is suitable for primary key.
102 false - if not.
103*/
104bool is_suitable_for_primary_key(KEY_PART_INFO *key_part, Field *table_field);
105
106#endif // DD_TABLE_SHARE_INCLUDED
Definition: field.h:574
Definition: key.h:56
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:922
Definition: table.h:46
A table definition from the master.
Definition: rpl_utility.h:247
enum_field_types dd_get_old_field_type(dd::enum_column_types type)
Definition: dd_table_share.cc:97
bool open_table_def_suppress_invalid_meta_data(THD *thd, TABLE_SHARE *share, const dd::Table &table_def)
Read the table definition from the data-dictionary.
Definition: dd_table_share.cc:2323
static CHARSET_INFO * dd_get_mysql_charset(dd::Object_id dd_cs_id)
Definition: dd_table_share.h:89
bool is_suitable_for_primary_key(KEY_PART_INFO *key_part, Field *table_field)
Check if the given key_part is suitable to be promoted as part of primary key.
Definition: dd_table_share.cc:229
bool open_table_def(THD *thd, TABLE_SHARE *share, const dd::Table &table_def)
Read the table definition from the data-dictionary.
Definition: dd_table_share.cc:2282
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:52
CHARSET_INFO * get_charset(uint cs_number, myf flags)
Definition: charset.cc:574
A better implementation of the UNIX ctype(3) library.
Some integer typedefs for easier portability.
#define MYF(v)
Definition: my_inttypes.h:96
Common header for many mysys elements.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
enum_column_types
Definition: column.h:52
required string type
Definition: replication_group_member_actions.proto:33
Definition: m_ctype.h:382
This structure is shared between different table objects.
Definition: table.h:689
unsigned int uint
Definition: uca-dump.cc:29