MySQL 8.0.39
Source Code Documentation
|
Data dictionary memory object creation. More...
#include <atomic>
#include <mysql_com.h>
#include "ha_prototypes.h"
#include "data0type.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "dict0mem.h"
#include "fts0priv.h"
#include "mach0data.h"
#include "my_dbug.h"
#include "rem0rec.h"
#include "ut0crc32.h"
#include <iostream>
#include "sync0sync.h"
Functions | |
std::ostream & | operator<< (std::ostream &s, const id_name_t &id_name) |
Display an identifier. More... | |
std::ostream & | operator<< (std::ostream &s, const table_name_t &table_name) |
Display a table name. More... | |
dict_v_col_t * | dict_mem_table_add_v_col (dict_table_t *table, mem_heap_t *heap, const char *name, ulint mtype, ulint prtype, ulint len, ulint pos, ulint num_base, bool is_visible) |
Adds a virtual column definition to a table. More... | |
void | dict_mem_table_add_s_col (dict_table_t *table, ulint num_base) |
Adds a stored column definition to a table. More... | |
static void | dict_mem_table_col_rename_low (dict_table_t *table, unsigned i, const char *to, const char *s, bool is_virtual) |
Renames a column of a table in the data dictionary cache. More... | |
void | dict_mem_table_col_rename (dict_table_t *table, ulint nth_col, const char *from, const char *to, bool is_virtual) |
Renames a column of a table in the data dictionary cache. More... | |
dict_foreign_t * | dict_mem_foreign_create (void) |
Creates and initializes a foreign constraint memory object. More... | |
void | dict_mem_foreign_table_name_lookup_set (dict_foreign_t *foreign, bool do_alloc) |
Sets the foreign_table_name_lookup pointer based on the value of lower_case_table_names. More... | |
void | dict_mem_referenced_table_name_lookup_set (dict_foreign_t *foreign, bool do_alloc) |
Sets the referenced_table_name_lookup pointer based on the value of lower_case_table_names. More... | |
static void | dict_mem_fill_vcol_has_index (const dict_index_t *index, dict_vcol_set **v_cols) |
Fill the virtual column set with virtual column information present in the given virtual index. More... | |
static void | dict_mem_fill_vcol_from_v_indexes (const char *col_name, const dict_table_t *table, dict_vcol_set **v_cols) |
Fill the virtual column set with virtual column of the index if the index contains the given column name. More... | |
static void | dict_mem_fill_vcol_set_for_base_col (const char *col_name, const dict_table_t *table, dict_vcol_set **v_cols) |
Fill the virtual column set with virtual columns which have base columns as the given col_name. More... | |
void | dict_mem_foreign_fill_vcol_set (dict_foreign_t *foreign) |
Fills the dependent virtual columns in a set. More... | |
void | dict_mem_table_fill_foreign_vcol_set (dict_table_t *table) |
Fill virtual columns set in each fk constraint present in the table. More... | |
void | dict_mem_table_free_foreign_vcol_set (dict_table_t *table) |
Free the vcol_set from all foreign key constraint on the table. More... | |
void | dict_mem_index_free (dict_index_t *index) |
Frees an index memory object. More... | |
char * | dict_mem_create_temporary_tablename (mem_heap_t *heap, const char *dbtab, table_id_t id) |
Create a temporary tablename like "#sql-ibtid-inc" where tid = the Table ID inc = a randomly initialized number that is incremented for each file The table ID is a 64 bit integer, can use up to 20 digits, and is initialized at bootstrap. More... | |
void | dict_mem_init (void) |
Initialize dict memory variables. More... | |
bool | dict_foreign_set_validate (const dict_foreign_set &fk_set) |
Validate the search order in the foreign key set. More... | |
bool | dict_foreign_set_validate (const dict_table_t &table) |
Validate the search order in the foreign key sets of the table (foreign_set and referenced_set). More... | |
std::ostream & | operator<< (std::ostream &out, const dict_foreign_t &foreign) |
std::ostream & | operator<< (std::ostream &out, const dict_foreign_set &fk_set) |
Variables | |
static std::atomic< uint32_t > | dict_temp_file_num |
An integer randomly initialized at startup used to make a temporary table name as unuique as possible. More... | |
Data dictionary memory object creation.
Created 1/8/1996 Heikki Tuuri
bool dict_foreign_set_validate | ( | const dict_foreign_set & | fk_set | ) |
Validate the search order in the foreign key set.
[in] | fk_set | the foreign key set to be validated |
bool dict_foreign_set_validate | ( | const dict_table_t & | table | ) |
Validate the search order in the foreign key sets of the table (foreign_set and referenced_set).
[in] | table | table whose foreign key sets are to be validated |
char * dict_mem_create_temporary_tablename | ( | mem_heap_t * | heap, |
const char * | dbtab, | ||
table_id_t | id | ||
) |
Create a temporary tablename like "#sql-ibtid-inc" where tid = the Table ID inc = a randomly initialized number that is incremented for each file The table ID is a 64 bit integer, can use up to 20 digits, and is initialized at bootstrap.
The second number is 32 bits, can use up to 10 digits, and is initialized at startup to a randomly distributed number. It is hoped that the combination of these two numbers will provide a reasonably unique temporary file name.
[in] | heap | A memory heap |
[in] | dbtab | Table name in the form database/table name |
[in] | id | Table id |
|
static |
Fill the virtual column set with virtual column of the index if the index contains the given column name.
[in] | col_name | column name |
[in] | table | innodb table object |
[out] | v_cols | set of virtual column information. |
|
static |
Fill the virtual column set with virtual column information present in the given virtual index.
[in] | index | virtual index |
[out] | v_cols | virtual column set. |
|
static |
Fill the virtual column set with virtual columns which have base columns as the given col_name.
[in] | col_name | column name |
[in] | table | table object |
[out] | v_cols | set of virtual columns. |
dict_foreign_t * dict_mem_foreign_create | ( | void | ) |
Creates and initializes a foreign constraint memory object.
void dict_mem_foreign_fill_vcol_set | ( | dict_foreign_t * | foreign | ) |
Fills the dependent virtual columns in a set.
Reason for being dependent are 1) FK can be present on base column of virtual columns 2) FK can be present on column which is a part of virtual index
[in,out] | foreign | foreign key information. |
FK can be present on base columns of virtual columns.
FK can be present on the columns which can be a part of virtual index.
void dict_mem_foreign_table_name_lookup_set | ( | dict_foreign_t * | foreign, |
bool | do_alloc | ||
) |
Sets the foreign_table_name_lookup pointer based on the value of lower_case_table_names.
If that is 0 or 1, foreign_table_name_lookup will point to foreign_table_name. If 2, then another string is allocated from foreign->heap and set to lower case.
foreign | in/out: foreign struct |
do_alloc | in: is an alloc needed |
void dict_mem_index_free | ( | dict_index_t * | index | ) |
Frees an index memory object.
in: index
index | in: index |
void dict_mem_init | ( | void | ) |
Initialize dict memory variables.
void dict_mem_referenced_table_name_lookup_set | ( | dict_foreign_t * | foreign, |
bool | do_alloc | ||
) |
Sets the referenced_table_name_lookup pointer based on the value of lower_case_table_names.
If that is 0 or 1, referenced_table_name_lookup will point to referenced_table_name. If 2, then another string is allocated from foreign->heap and set to lower case.
foreign | in/out: foreign struct |
do_alloc | in: is an alloc needed |
void dict_mem_table_add_s_col | ( | dict_table_t * | table, |
ulint | num_base | ||
) |
Adds a stored column definition to a table.
[in,out] | table | table |
[in] | num_base | number of base columns. |
dict_v_col_t * dict_mem_table_add_v_col | ( | dict_table_t * | table, |
mem_heap_t * | heap, | ||
const char * | name, | ||
ulint | mtype, | ||
ulint | prtype, | ||
ulint | len, | ||
ulint | pos, | ||
ulint | num_base, | ||
bool | is_visible | ||
) |
Adds a virtual column definition to a table.
[in,out] | table | table |
[in] | heap | temporary memory heap, or NULL. It is used to store name when we have not finished adding all columns. When all columns are added, the whole name will copy to memory from table->heap |
[in] | name | column name |
[in] | mtype | main datatype |
[in] | prtype | precise type |
[in] | len | length |
[in] | pos | position in a table |
[in] | num_base | number of base columns |
[in] | is_visible | True if virtual column is visible to user |
void dict_mem_table_col_rename | ( | dict_table_t * | table, |
ulint | nth_col, | ||
const char * | from, | ||
const char * | to, | ||
bool | is_virtual | ||
) |
Renames a column of a table in the data dictionary cache.
[in,out] | table | Table |
[in] | nth_col | Column index |
[in] | from | Old column name |
[in] | to | New column name |
[in] | is_virtual | If this is a virtual column |
|
static |
Renames a column of a table in the data dictionary cache.
table | in/out: table |
i | in: column offset corresponding to s |
to | in: new column name |
s | in: pointer to table->col_names |
is_virtual | in: if this is a virtual column |
void dict_mem_table_fill_foreign_vcol_set | ( | dict_table_t * | table | ) |
Fill virtual columns set in each fk constraint present in the table.
[in,out] | table | innodb table object. |
void dict_mem_table_free_foreign_vcol_set | ( | dict_table_t * | table | ) |
Free the vcol_set from all foreign key constraint on the table.
[in,out] | table | innodb table object. |
std::ostream & operator<< | ( | std::ostream & | out, |
const dict_foreign_set & | fk_set | ||
) |
std::ostream & operator<< | ( | std::ostream & | out, |
const dict_foreign_t & | foreign | ||
) |
std::ostream & operator<< | ( | std::ostream & | s, |
const id_name_t & | id_name | ||
) |
Display an identifier.
[in,out] | s | output stream |
[in] | id_name | SQL identifier (other than table name) |
std::ostream & operator<< | ( | std::ostream & | s, |
const table_name_t & | table_name | ||
) |
Display a table name.
[in,out] | s | output stream |
[in] | table_name | table name |
|
static |
An integer randomly initialized at startup used to make a temporary table name as unuique as possible.