MySQL 9.5.0
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, 2025, 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 designed to work 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 either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26#include <sys/types.h>
27
28#include "field_types.h"
29#include "my_inttypes.h"
30#include "my_sys.h" // get_charset
32#include "sql/dd/object_id.h" // dd::Object_id
33
34class Field;
35class KEY_PART_INFO;
36class THD;
37struct TABLE_SHARE;
38
39namespace dd {
40class Table;
41class Abstract_table;
42
43enum class enum_column_types;
44} // namespace dd
45
46/**
47 Read the table definition from the data-dictionary.
48
49 @param thd Thread handler
50 @param share Fill this with table definition
51 @param table_def A data-dictionary Table-object describing
52 table to be used for opening, instead of reading
53 information from DD.
54
55 @note
56 This function is called when the table definition is not cached in
57 table_def_cache.
58 The data is returned in 'share', which is allocated by
59 alloc_table_share().. The code assumes that share is initialized.
60
61 @returns
62 false OK
63 true Error
64*/
66
67/**
68 Read the table definition from the data-dictionary.
69
70 @param thd Thread handler
71 @param share Fill this with table definition
72 @param table_def A data-dictionary Table-object describing
73 table to be used for opening.
74
75 @note
76 This function is called from InnoDB, and will suppress errors
77 due to:
78 Invalid collations.
79 Missing FTS parser.
80
81 @returns
82 false OK
83 true Error
84*/
86 const dd::Table &table_def);
87
88/* Map from new to old field type. */
90
92 return get_charset(static_cast<uint>(dd_cs_id), MYF(0));
93}
94
95/**
96 Check if the given key_part is suitable to be promoted as part of
97 primary key.
98
99 @param key_part - pointer to KEY_PART_INTO which we are checking.
100 @param table_field - Pointer to Field of column used by key_part.
101
102 @returns
103 true - Is suitable for primary key.
104 false - if not.
105*/
106bool is_suitable_for_primary_key(KEY_PART_INFO *key_part, Field *table_field);
107
108/**
109 Read the view definition from the data-dictionary.
110
111 @param thd Thread handler
112 @param share Fill this with table definition
113 @param abstract_table A data-dictionary Table-object describing
114 the view to be used for opening, instead of reading
115 information from DD.
116
117 @note
118 This function is called when the view definition is not cached in
119 table_def_cache.
120 The data is returned in 'share', which is allocated by
121 alloc_table_share().. The code assumes that share is initialized.
122
123 @returns
124 false OK
125 true Error
126*/
128 const dd::Abstract_table *abstract_table);
129
130#endif // DD_TABLE_SHARE_INCLUDED
Definition: field.h:570
Definition: key.h:57
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Abstract base class for tables and views.
Definition: abstract_table.h:69
Definition: table.h:47
A table definition from the master.
Definition: rpl_utility.h:249
enum_field_types dd_get_old_field_type(dd::enum_column_types type)
Definition: dd_table_share.cc:104
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:2419
static CHARSET_INFO * dd_get_mysql_charset(dd::Object_id dd_cs_id)
Definition: dd_table_share.h:91
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:239
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:2340
bool open_view_def(THD *thd, TABLE_SHARE *share, const dd::Abstract_table *abstract_table)
Read the view definition from the data-dictionary.
Definition: dd_table_share.cc:2369
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
CHARSET_INFO * get_charset(uint cs_number, myf flags)
Definition: charset.cc:243
A better implementation of the UNIX ctype(3) library.
Some integer typedefs for easier portability.
#define MYF(v)
Definition: my_inttypes.h:97
Common header for many mysys elements.
static PFS_engine_table_share_proxy share
Definition: connection_control_pfs_table.cc:92
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
unsigned long long Object_id
Definition: object_id.h:31
enum_column_types
Definition: column.h:53
entry::Table Table
Definition: select.h:51
required string type
Definition: replication_group_member_actions.proto:34
Definition: m_ctype.h:421
This structure is shared between different table objects.
Definition: table.h:716