MySQL  8.0.18
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, 2019, Oracle and/or its affiliates. All rights reserved.
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 "m_ctype.h"
28 #include "my_inttypes.h"
29 #include "my_sys.h" // get_charset
30 #include "sql/dd/object_id.h" // dd::Object_id
31 
32 class Field;
33 class KEY_PART_INFO;
34 class THD;
35 struct TABLE_SHARE;
36 enum enum_field_types : int;
37 
38 namespace dd {
39 class Table;
40 
41 enum 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 alloced by
57  alloc_table_share().. The code assumes that share is initialized.
58 
59  @returns
60  false OK
61  true Error
62 */
63 bool 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 */
104 bool is_suitable_for_primary_key(KEY_PART_INFO *key_part, Field *table_field);
105 
106 #endif // DD_TABLE_SHARE_INCLUDED
This structure is shared between different table objects.
Definition: table.h:653
Some integer typedefs for easier portability.
Definition: field.h:700
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:2319
enum_column_types
Definition: column.h:52
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
static CHARSET_INFO * dd_get_mysql_charset(dd::Object_id dd_cs_id)
Definition: dd_table_share.h:89
CHARSET_INFO * get_charset(uint cs_number, myf flags)
Definition: charset.cc:576
Definition: key.h:55
enum_field_types
Column types for MySQL.
Definition: field_types.h:52
#define MYF(v)
Definition: my_inttypes.h:114
unsigned long long Object_id
Definition: object_id.h:30
Definition: m_ctype.h:359
Common header for many mysys elements.
int type
Definition: http_common.h:411
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:2278
A better implementation of the UNIX ctype(3) library.
Definition: test_sql_stmt.cc:150
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
A table definition from the master.
Definition: rpl_utility.h:245
Definition: table.h:43
enum_field_types dd_get_old_field_type(dd::enum_column_types type)
Definition: dd_table_share.cc:97
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:778