MySQL 8.4.3
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, 2024, 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;
41
42enum class enum_column_types;
43} // namespace dd
44
45/**
46 Read the table definition from the data-dictionary.
47
48 @param thd Thread handler
49 @param share Fill this with table definition
50 @param table_def A data-dictionary Table-object describing
51 table to be used for opening, instead of reading
52 information from DD.
53
54 @note
55 This function is called when the table definition is not cached in
56 table_def_cache.
57 The data is returned in 'share', which is allocated by
58 alloc_table_share().. The code assumes that share is initialized.
59
60 @returns
61 false OK
62 true Error
63*/
64bool open_table_def(THD *thd, TABLE_SHARE *share, const dd::Table &table_def);
65
66/**
67 Read the table definition from the data-dictionary.
68
69 @param thd Thread handler
70 @param share Fill this with table definition
71 @param table_def A data-dictionary Table-object describing
72 table to be used for opening.
73
74 @note
75 This function is called from InnoDB, and will suppress errors
76 due to:
77 Invalid collations.
78 Missing FTS parser.
79
80 @returns
81 false OK
82 true Error
83*/
85 const dd::Table &table_def);
86
87/* Map from new to old field type. */
89
91 return get_charset(static_cast<uint>(dd_cs_id), MYF(0));
92}
93
94/**
95 Check if the given key_part is suitable to be promoted as part of
96 primary key.
97
98 @param key_part - pointer to KEY_PART_INTO which we are checking.
99 @param table_field - Pointer to Field of column used by key_part.
100
101 @returns
102 true - Is suitable for primary key.
103 false - if not.
104*/
105bool is_suitable_for_primary_key(KEY_PART_INFO *key_part, Field *table_field);
106
107#endif // DD_TABLE_SHARE_INCLUDED
Definition: field.h:575
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
Definition: table.h:47
A table definition from the master.
Definition: rpl_utility.h:248
enum_field_types dd_get_old_field_type(dd::enum_column_types type)
Definition: dd_table_share.cc:101
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:2330
static CHARSET_INFO * dd_get_mysql_charset(dd::Object_id dd_cs_id)
Definition: dd_table_share.h:90
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:233
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:2288
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:231
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.
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
required string type
Definition: replication_group_member_actions.proto:34
Definition: m_ctype.h:423
This structure is shared between different table objects.
Definition: table.h:701