MySQL 8.4.3
Source Code Documentation
|
#include "sql/dd_table_share.h"
#include "my_config.h"
#include <string.h>
#include <algorithm>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include "lex_string.h"
#include "m_string.h"
#include "map_helpers.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_compare.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_macros.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/my_loglevel.h"
#include "mysql/plugin.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/m_ctype.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/aggregated_stats.h"
#include "sql/dd/collection.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/dd_tablespace.h"
#include "sql/dd/impl/utils.h"
#include "sql/dd/properties.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/check_constraint.h"
#include "sql/dd/types/column.h"
#include "sql/dd/types/column_type_element.h"
#include "sql/dd/types/foreign_key.h"
#include "sql/dd/types/foreign_key_element.h"
#include "sql/dd/types/index.h"
#include "sql/dd/types/index_element.h"
#include "sql/dd/types/partition.h"
#include "sql/dd/types/partition_value.h"
#include "sql/dd/types/table.h"
#include "sql/default_values.h"
#include "sql/error_handler.h"
#include "sql/field.h"
#include "sql/gis/srid.h"
#include "sql/handler.h"
#include "sql/histograms/table_histograms.h"
#include "sql/key.h"
#include "sql/log.h"
#include "sql/partition_element.h"
#include "sql/partition_info.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_check_constraint.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/sql_list.h"
#include "sql/sql_partition.h"
#include "sql/sql_plugin.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_table.h"
#include "sql/strfunc.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "typelib.h"
Classes | |
class | Open_table_error_handler |
Functions | |
enum_field_types | dd_get_old_field_type (dd::enum_column_types type) |
static enum ha_key_alg | dd_get_old_index_algorithm_type (dd::Index::enum_index_algorithm type) |
For enum in dd::Index. More... | |
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. More... | |
static bool | prepare_share (THD *thd, TABLE_SHARE *share, const dd::Table *table_def) |
Finalize preparation of TABLE_SHARE from dd::Table object by filling in remaining info about columns and keys. More... | |
static bool | fill_tablespace_from_dd (THD *thd, TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill tablespace name from dd::Tablespace. More... | |
static row_type | dd_get_old_row_format (dd::Table::enum_row_format new_format) |
Convert row format value used in DD to corresponding value in old row_type enum. More... | |
static bool | fill_share_from_dd (THD *thd, TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill TABLE_SHARE from dd::Table object. More... | |
static uint | column_preamble_bits (const dd::Column *col_obj) |
Calculate number of bits used for the column in the record preamble (aka null bits number). More... | |
void | get_auto_flags (const dd::Column &col_obj, uint &auto_flags) |
static Field * | make_field (const dd::Column &col_obj, const CHARSET_INFO *charset, TABLE_SHARE *share, uchar *ptr, uchar *null_pos, size_t null_bit) |
static bool | fill_column_from_dd (THD *thd, TABLE_SHARE *share, const dd::Column *col_obj, uchar *null_pos, uint null_bit_pos, uchar *rec_pos, uint field_nr) |
Add Field constructed according to column metadata from dd::Column object to TABLE_SHARE. More... | |
static bool | fill_columns_from_dd (THD *thd, TABLE_SHARE *share, const dd::Table *tab_obj) |
Populate TABLE_SHARE::field array according to column metadata from dd::Table object. More... | |
static void | fill_index_element_from_dd (TABLE_SHARE *share, const dd::Index_element *idx_elem_obj, KEY_PART_INFO *keypart) |
Fill KEY_INFO_PART from dd::Index_element object. More... | |
static void | fill_index_elements_from_dd (TABLE_SHARE *share, const dd::Index *idx_obj, int key_nr) |
Fill KEY::key_part array according to metadata from dd::Index object. More... | |
static bool | fill_index_from_dd (THD *thd, TABLE_SHARE *share, const dd::Index *idx_obj, uint key_nr) |
Add KEY constructed according to index metadata from dd::Index object to the TABLE_SHARE. More... | |
static bool | is_spatial_index_usable (const dd::Index &index) |
Check if this is a spatial index that can be used. More... | |
static bool | fill_indexes_from_dd (THD *thd, TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill TABLE_SHARE::key_info array according to index metadata from dd::Table object. More... | |
static char * | copy_option_string (MEM_ROOT *mem_root, const dd::Properties &options, const dd::String_type &key) |
static void | get_partition_options (MEM_ROOT *mem_root, partition_element *part_elem, const dd::Properties &part_options) |
static bool | get_part_column_values (MEM_ROOT *mem_root, partition_info *part_info, partition_element *part_elem, const dd::Partition *part_obj) |
static bool | setup_partition_from_dd (THD *thd, MEM_ROOT *mem_root, partition_info *part_info, partition_element *part_elem, const dd::Partition *part_obj, bool is_subpart) |
static bool | set_field_list (MEM_ROOT *mem_root, dd::String_type &str, List< char > *field_list) |
Set field_list. More... | |
static bool | fill_partitioning_from_dd (THD *thd, TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill TABLE_SHARE with partitioning details from dd::Partition. More... | |
static bool | fill_foreign_keys_from_dd (TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill TABLE_SHARE with information about foreign keys from dd::Table. More... | |
static bool | fill_check_constraints_from_dd (TABLE_SHARE *share, const dd::Table *tab_obj) |
Fill check constraints from dd::Table object to the TABLE_SHARE. More... | |
bool | open_table_def (THD *thd, TABLE_SHARE *share, const dd::Table &table_def) |
Read the table definition from the data-dictionary. More... | |
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. More... | |
Variables | |
struct aggregated_stats | global_aggregated_stats |
|
static |
Calculate number of bits used for the column in the record preamble (aka null bits number).
|
static |
enum_field_types dd_get_old_field_type | ( | dd::enum_column_types | type | ) |
|
static |
For enum in dd::Index.
|
static |
Convert row format value used in DD to corresponding value in old row_type enum.
|
static |
Fill check constraints from dd::Table object to the TABLE_SHARE.
[in,out] | share | TABLE_SHARE instance. |
[in] | tab_obj | Table instance. |
false | On Success. |
true | On failure. |
|
static |
Add Field constructed according to column metadata from dd::Column object to TABLE_SHARE.
|
static |
Populate TABLE_SHARE::field array according to column metadata from dd::Table object.
|
static |
Fill TABLE_SHARE with information about foreign keys from dd::Table.
|
static |
Fill KEY_INFO_PART from dd::Index_element object.
|
static |
Fill KEY::key_part array according to metadata from dd::Index object.
|
static |
Add KEY constructed according to index metadata from dd::Index object to the TABLE_SHARE.
|
static |
Fill TABLE_SHARE::key_info array according to index metadata from dd::Table object.
|
static |
Fill TABLE_SHARE with partitioning details from dd::Partition.
Set up as much as possible to ease creating new TABLE instances by copying from the TABLE_SHARE.
Also to prevent future memory duplication partition definitions (names etc) are stored on the TABLE_SHARE and can be referenced from each TABLE instance.
Note that [sub]part_expr still needs to be parsed from [sub]part_func_string for each TABLE instance to use the correct mem_root etc. To be as compatible with the .frm way to open a table as possible we currently generate the full partitioning clause which will be parsed for each new TABLE instance. TODO-PARTITION:
thd | Thread context. |
share | Share to be updated with partitioning details. |
tab_obj | dd::Table object to get partition info from. |
|
static |
Fill TABLE_SHARE from dd::Table object.
|
static |
Fill tablespace name from dd::Tablespace.
|
inline |
|
static |
|
static |
|
static |
Check if this is a spatial index that can be used.
That is, if there is a spatial index on a geometry column without the SRID specified, we will hide the index so that the optimizer won't consider the index during optimization/execution.
index | The index to verify |
true | if the index is an usable spatial index, or if it isn't a spatial index. |
false | if the index is a spatial index on a geometry column without an SRID specified. |
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.
key_part | - pointer to KEY_PART_INTO which we are checking. |
table_field | - Pointer to Field of column used by key_part. |
|
static |
bool open_table_def | ( | THD * | thd, |
TABLE_SHARE * | share, | ||
const dd::Table & | table_def | ||
) |
Read the table definition from the data-dictionary.
thd | Thread handler |
share | Fill this with table definition |
table_def | A data-dictionary Table-object describing table to be used for opening, instead of reading information from DD. |
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.
thd | Thread handler |
share | Fill this with table definition |
table_def | A data-dictionary Table-object describing table to be used for opening. |
|
static |
Finalize preparation of TABLE_SHARE from dd::Table object by filling in remaining info about columns and keys.
This code similar to code in open_binary_frm(). Can be re-written independent to other efforts later.
|
static |
Set field_list.
To append each field to the field_list it will parse the submitted partition_expression string.
Must be in sync with get_field_list_str!
[in] | mem_root | Where to allocate the memory for the list entries. |
[in] | str | String object containing the column names. |
[in,out] | field_list | List to add field names to. |
|
static |
|
extern |