MySQL 8.0.40
Source Code Documentation
|
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <string>
#include "field_types.h"
#include "lex_string.h"
#include "libbinlogevents/include/table_id.h"
#include "m_ctype.h"
#include "map_helpers.h"
#include "mem_root_deque.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "mysql/components/services/bits/mysql_mutex_bits.h"
#include "mysql/components/services/bits/psi_table_bits.h"
#include "sql/auth/auth_acls.h"
#include "sql/dd/types/foreign_key.h"
#include "sql/enum_query_type.h"
#include "sql/key.h"
#include "sql/key_spec.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/opt_costmodel.h"
#include "sql/partition_info.h"
#include "sql/record_buffer.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_const.h"
#include "sql/sql_list.h"
#include "sql/sql_plist.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_sort.h"
#include "thr_lock.h"
#include "typelib.h"
Go to the source code of this file.
Classes | |
class | Object_creation_ctx |
Object_creation_ctx – interface for creation context of database objects (views, stored routines, events, triggers). More... | |
class | Default_object_creation_ctx |
Default_object_creation_ctx – default implementation of Object_creation_ctx. More... | |
class | View_creation_ctx |
View_creation_ctx – creation context of view objects. More... | |
struct | ORDER |
struct | GRANT_INTERNAL_INFO |
State information for internal tables grants. More... | |
struct | GRANT_INFO |
The current state of the privilege checking process for the current user, SQL statement and SQL object. More... | |
struct | TABLE_FIELD_TYPE |
struct | TABLE_FIELD_DEF |
class | Table_check_intact |
class | Wait_for_flush |
Class representing the fact that some thread waits for table share to be flushed. More... | |
struct | Table_share_foreign_key_info |
struct | Table_share_foreign_key_parent_info |
struct | Key_name |
Definition of name for generated keys, owned by TABLE_SHARE. More... | |
struct | TABLE_SHARE |
This structure is shared between different table objects. More... | |
class | Blob_mem_storage |
Class is used as a BLOB field value storage for intermediate GROUP_CONCAT results. More... | |
class | Binary_diff |
Class that represents a single change to a column value in partial update of a JSON column. More... | |
struct | TABLE |
struct | ST_FIELD_INFO |
struct | ST_SCHEMA_TABLE |
struct | Field_translator |
Struct that describes an expression selected from a derived table or view. More... | |
class | Natural_join_column |
struct | LEX_MFA |
struct | LEX_ALTER |
struct | LEX_USER |
class | Derived_key |
This structure is used to keep info about possible key for the result table of a derived table/view. More... | |
class | Table_ref |
class | Field_iterator |
class | Field_iterator_table |
class | Field_iterator_view |
Iterator over the fields of a merged derived table or view. More... | |
class | Field_iterator_natural_join |
class | Field_iterator_table_ref |
Generic iterator over the fields of an arbitrary table reference. More... | |
struct | OPEN_TABLE_LIST |
class | Common_table_expr |
After parsing, a Common Table Expression is accessed through a Table_ref. More... | |
class | Derived_refs_iterator |
This iterates on those references to a derived table / view / CTE which are materialized. More... | |
class | Autoinc_field_has_explicit_non_null_value_reset_guard |
RAII class to reset TABLE::autoinc_field_has_explicit_non_null_value after processing individual row in INSERT or LOAD DATA statements. More... | |
class | FRM_context |
These members were removed from TABLE_SHARE as they are not used in in the code. More... | |
Namespaces | |
namespace | histograms |
namespace | dd |
The version of the current data dictionary table definitions. | |
Macros | |
#define | store_record(A, B) memcpy((A)->B, (A)->record[0], (size_t)(A)->s->reclength) |
#define | restore_record(A, B) memcpy((A)->record[0], (A)->B, (size_t)(A)->s->reclength) |
#define | cmp_record(A, B) memcmp((A)->record[0], (A)->B, (size_t)(A)->s->reclength) |
#define | tmp_file_prefix "#sql" |
Prefix for tmp tables. More... | |
#define | tmp_file_prefix_length 4 |
#define | TMP_TABLE_KEY_EXTRA 8 |
#define | PLACEHOLDER_TABLE_ROW_ESTIMATE 2 |
#define | STATUS_NOT_STARTED 1 |
Flags for TABLE::m_status (maximum 8 bits). More... | |
#define | STATUS_NOT_FOUND 2 |
Means we were searching for a row and didn't find it. More... | |
#define | STATUS_UPDATED 16 |
Reserved for use by multi-table update. Means the row has been updated. More... | |
#define | STATUS_NULL_ROW 32 |
Means that table->null_row is set. More... | |
#define | STATUS_DELETED 64 |
Reserved for use by multi-table delete. Means the row has been deleted. More... | |
#define | MY_I_S_MAYBE_NULL 1 |
#define | MY_I_S_UNSIGNED 2 |
#define | VIEW_SUID_INVOKER 0 |
#define | VIEW_SUID_DEFINER 1 |
#define | VIEW_SUID_DEFAULT 2 |
#define | VIEW_CHECK_NONE 0 |
#define | VIEW_CHECK_LOCAL 1 |
#define | VIEW_CHECK_CASCADED 2 |
#define | VIEW_CHECK_OK 0 |
#define | VIEW_CHECK_ERROR 1 |
#define | VIEW_CHECK_SKIP 2 |
#define | MAX_TDC_BLOB_SIZE 65536 |
The threshold size a blob field buffer before it is freed. More... | |
Typedefs | |
using | plan_idx = int |
using | Sql_table_check_constraint_list = Mem_root_array< Sql_table_check_constraint > |
using | Sql_check_constraint_share_list = Mem_root_array< Sql_check_constraint_share > |
typedef Mem_root_array_YY< LEX_CSTRING > | Create_col_name_list |
typedef int64 | query_id_t |
typedef enum enum_table_category | TABLE_CATEGORY |
typedef I_P_List< Wait_for_flush, I_P_List_adapter< Wait_for_flush, &Wait_for_flush::next_in_share, &Wait_for_flush::prev_in_share > > | Wait_for_flush_list |
typedef struct Table_share_foreign_key_info | TABLE_SHARE_FOREIGN_KEY_INFO |
typedef struct Table_share_foreign_key_parent_info | TABLE_SHARE_FOREIGN_KEY_PARENT_INFO |
using | Binary_diff_vector = Mem_root_array< Binary_diff > |
Vector of Binary_diff objects. More... | |
typedef Bitmap< MAX_FIELDS > | Field_map |
Functions | |
bool | assert_ref_count_is_locked (const TABLE_SHARE *) |
Assert that the LOCK_open mutex is held when the reference count of a TABLE_SHARE is accessed. More... | |
bool | assert_invalid_dict_is_locked (const TABLE *) |
Assert that LOCK_thd_data is held when TABLE::m_invalid_dict is accessed. More... | |
bool | assert_invalid_stats_is_locked (const TABLE *) |
Assert that caller holds lock on the table cache when TABLE::m_invalid_stats is accessed. More... | |
static void | empty_record (TABLE *table) |
enum enum_mdl_type | mdl_type_for_dml (enum thr_lock_type lock_type) |
Derive type of metadata lock to be requested for table used by a DML statement from the type of THR_LOCK lock requested for this table. More... | |
static my_bitmap_map * | tmp_use_all_columns (TABLE *table, MY_BITMAP *bitmap) |
static void | tmp_restore_column_map (MY_BITMAP *bitmap, my_bitmap_map *old) |
static my_bitmap_map * | dbug_tmp_use_all_columns (TABLE *table, MY_BITMAP *bitmap) |
static void | dbug_tmp_restore_column_map (MY_BITMAP *bitmap, my_bitmap_map *old) |
static void | dbug_tmp_use_all_columns (TABLE *table, my_bitmap_map **save, MY_BITMAP *read_set, MY_BITMAP *write_set) |
static void | dbug_tmp_restore_column_maps (MY_BITMAP *read_set, MY_BITMAP *write_set, my_bitmap_map **old) |
void | init_mdl_requests (Table_ref *table_list) |
Helper function which allows to allocate metadata lock request objects for all elements of table list. More... | |
bool | unpack_value_generator (THD *thd, TABLE *table, Value_generator **val_generator, Value_generator_source source, const char *source_name, Field *field, bool is_create_table, bool *error_reported) |
Unpacks the definition of a value generator in all its forms: generated column, default expression or checked constraint. More... | |
bool | unpack_partition_info (THD *thd, TABLE *outparam, TABLE_SHARE *share, handlerton *engine_type, bool is_create_table) |
Unpack the partition expression. More... | |
int | open_table_from_share (THD *thd, TABLE_SHARE *share, const char *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, bool is_create_table, const dd::Table *table_def_param) |
Open a table based on a TABLE_SHARE. More... | |
TABLE_SHARE * | alloc_table_share (const char *db, const char *table_name, const char *key, size_t key_length, bool open_secondary) |
Allocate and setup a TABLE_SHARE structure. More... | |
void | init_tmp_table_share (THD *thd, TABLE_SHARE *share, const char *key, size_t key_length, const char *table_name, const char *path, MEM_ROOT *mem_root) |
Initialize share for temporary tables. More... | |
void | free_table_share (TABLE_SHARE *share) |
Free table share and memory used by it. More... | |
void | update_create_info_from_table (HA_CREATE_INFO *info, TABLE *form) |
Ident_name_check | check_db_name (const char *name, size_t length) |
Check if database name is valid. More... | |
Ident_name_check | check_and_convert_db_name (LEX_STRING *db, bool preserve_lettercase) |
Check if database name is valid, and convert to lower case if necessary. More... | |
bool | check_column_name (const char *name) |
Ident_name_check | check_table_name (const char *name, size_t length) |
Function to check if table name is valid or not. More... | |
int | rename_file_ext (const char *from, const char *to, const char *ext) |
char * | get_field (MEM_ROOT *mem, Field *field) |
Allocate string field in MEM_ROOT and return it as NULL-terminated string. More... | |
bool | get_field (MEM_ROOT *mem, Field *field, class String *res) |
Allocate string field in MEM_ROOT and return it as String. More... | |
int | closefrm (TABLE *table, bool free_share) |
Free information allocated by openfrm. More... | |
void | free_blobs (TABLE *table) |
void | free_blob_buffers_and_reset (TABLE *table, uint32 size) |
Reclaims temporary blob storage which is bigger than a threshold. More... | |
int | set_zone (int nr, int min_zone, int max_zone) |
void | append_unescaped (String *res, const char *pos, size_t length) |
Store an SQL quoted string. More... | |
char * | fn_rext (char *name) |
Returns pointer to '.frm' extension of the file name. More... | |
TABLE_CATEGORY | get_table_category (const LEX_CSTRING &db, const LEX_CSTRING &name) |
bool | is_infoschema_db (const char *name, size_t len) |
bool | is_infoschema_db (const char *name) |
bool | is_perfschema_db (const char *name, size_t len) |
bool | is_perfschema_db (const char *name) |
bool | belongs_to_p_s (Table_ref *tl) |
Check if the table belongs to the P_S, excluding setup and threads tables. More... | |
bool | is_user_table (TABLE *table) |
return true if the table was created explicitly. More... | |
bool | is_simple_order (ORDER *order) |
Test if the order list consists of simple field expressions. More... | |
uint | add_pk_parts_to_sk (KEY *sk, uint sk_n, KEY *pk, uint pk_n, TABLE_SHARE *share, handler *handler_file, uint *usable_parts, bool use_extended_sk) |
Generate extended secondary keys by adding primary key parts to the existing secondary key. More... | |
void | setup_key_part_field (TABLE_SHARE *share, handler *handler_file, uint primary_key_n, KEY *keyinfo, uint key_n, uint key_part_n, uint *usable_parts, bool part_of_key_not_extended) |
Setup key-related fields of Field object for given key and key part. More... | |
const uchar * | get_field_name (const uchar *arg, size_t *length) |
void | repoint_field_to_record (TABLE *table, uchar *old_rec, uchar *new_rec) |
Repoint a table's fields from old_rec to new_rec. More... | |
bool | update_generated_write_fields (const MY_BITMAP *bitmap, TABLE *table) |
Calculate data for each generated field marked for write in the corresponding column map. More... | |
bool | update_generated_read_fields (uchar *buf, TABLE *table, uint active_index=MAX_KEY) |
Evaluate necessary virtual generated columns. More... | |
bool | is_temporary_table (const Table_ref *tl) |
Check if a Table_ref instance represents a pre-opened temporary table. More... | |
bool | can_call_position (const TABLE *table) |
int | create_table_share_for_upgrade (THD *thd, const char *path, TABLE_SHARE *share, FRM_context *frm_context, const char *db, const char *table, bool is_fix_view_cols_and_deps) |
Create TABLE_SHARE from .frm file. More... | |
bool | create_key_part_field_with_prefix_length (TABLE *table, MEM_ROOT *root) |
Create a copy of the key_info from TABLE_SHARE object to TABLE object. More... | |
#define MAX_TDC_BLOB_SIZE 65536 |
The threshold size a blob field buffer before it is freed.
#define MY_I_S_MAYBE_NULL 1 |
#define MY_I_S_UNSIGNED 2 |
#define PLACEHOLDER_TABLE_ROW_ESTIMATE 2 |
#define STATUS_DELETED 64 |
Reserved for use by multi-table delete. Means the row has been deleted.
#define STATUS_NOT_FOUND 2 |
Means we were searching for a row and didn't find it.
This is used by storage engines (
#define STATUS_NOT_STARTED 1 |
Flags for TABLE::m_status (maximum 8 bits).
The flags define the state of the row buffer in TABLE::record[0]. STATUS_NOT_STARTED is set when table is not accessed yet. Neither STATUS_NOT_FOUND nor STATUS_NULL_ROW can be set when this flag is set.
#define STATUS_NULL_ROW 32 |
Means that table->null_row is set.
This is an artificial NULL-filled row (one example: in outer join, if no match has been found in inner table).
#define STATUS_UPDATED 16 |
Reserved for use by multi-table update. Means the row has been updated.
#define tmp_file_prefix "#sql" |
Prefix for tmp tables.
#define tmp_file_prefix_length 4 |
#define TMP_TABLE_KEY_EXTRA 8 |
#define VIEW_CHECK_CASCADED 2 |
#define VIEW_CHECK_ERROR 1 |
#define VIEW_CHECK_LOCAL 1 |
#define VIEW_CHECK_NONE 0 |
#define VIEW_CHECK_OK 0 |
#define VIEW_CHECK_SKIP 2 |
#define VIEW_SUID_DEFAULT 2 |
#define VIEW_SUID_DEFINER 1 |
#define VIEW_SUID_INVOKER 0 |
using Binary_diff_vector = Mem_root_array<Binary_diff> |
Vector of Binary_diff objects.
The Binary_diff objects in the vector should be ordered on offset, and none of the diffs should be overlapping or adjacent.
typedef Bitmap<MAX_FIELDS> Field_map |
using plan_idx = int |
typedef int64 query_id_t |
typedef enum enum_table_category TABLE_CATEGORY |
typedef struct Table_share_foreign_key_info TABLE_SHARE_FOREIGN_KEY_INFO |
typedef I_P_List< Wait_for_flush, I_P_List_adapter<Wait_for_flush, &Wait_for_flush::next_in_share, &Wait_for_flush::prev_in_share> > Wait_for_flush_list |
enum enum_open_type |
enum enum_table_category |
Category of table found in the table share.
enum enum_table_ref_type |
Enumerate possible types of a table from re-execution standpoint.
Table_ref class has a member of this type. At prepared statement prepare, this member is assigned a value as of the current state of the database. Before (re-)execution of a prepared statement, we check that the value recorded at prepare matches the type of the object we obtained from the table definition cache.
Enumerator | |
---|---|
TABLE_REF_NULL | Initial value set by the parser. |
TABLE_REF_VIEW | |
TABLE_REF_BASE_TABLE | |
TABLE_REF_I_S_TABLE | |
TABLE_REF_TMP_TABLE |
enum enum_view_algorithm |
|
strong |
enum index_hint_type |
|
strong |
enum tmp_table_type |
uint add_pk_parts_to_sk | ( | KEY * | sk, |
uint | sk_n, | ||
KEY * | pk, | ||
uint | pk_n, | ||
TABLE_SHARE * | share, | ||
handler * | handler_file, | ||
uint * | usable_parts, | ||
bool | use_extended_sk | ||
) |
Generate extended secondary keys by adding primary key parts to the existing secondary key.
A primary key part is added if such part doesn't present in the secondary key or the part in the secondary key is a prefix of the key field. Key parts are added till: .) all parts were added .) number of key parts became bigger that MAX_REF_PARTS .) total key length became longer than MAX_REF_LENGTH depending on what occurs first first. Unlike existing secondary key parts which are initialized at open_binary_frm(), newly added ones are initialized here by copying KEY_PART_INFO structure from primary key part and calling setup_key_part_field().
Function updates sk->actual/unused_key_parts and sk->actual_flags.
[in] | sk | Secondary key |
[in] | sk_n | Secondary key number |
[in] | pk | Primary key |
[in] | pk_n | Primary key number |
[in] | share | Pointer to TABLE_SHARE |
[in] | handler_file | Pointer to handler |
[in,out] | usable_parts | Pointer to usable_parts variable |
[in] | use_extended_sk | TRUE if use_index_extensions is ON |
Number | of added key parts |
TABLE_SHARE * alloc_table_share | ( | const char * | db, |
const char * | table_name, | ||
const char * | key, | ||
size_t | key_length, | ||
bool | open_secondary | ||
) |
Allocate and setup a TABLE_SHARE structure.
db | schema name. |
table_name | table name. |
key | table cache key (db \0 table_name \0...) |
key_length | length of the key |
open_secondary | true if the TABLE_SHARE represents a table in a secondary storage engine |
NULL | error (out of memory, too long path name) |
void append_unescaped | ( | String * | res, |
const char * | pos, | ||
size_t | length | ||
) |
Store an SQL quoted string.
res | result String |
pos | string to be quoted |
length | it's length |
NOTE This function works correctly with utf8 or single-byte charset strings. May fail with some multibyte charsets though.
bool assert_invalid_dict_is_locked | ( | const TABLE * | table | ) |
Assert that LOCK_thd_data is held when TABLE::m_invalid_dict is accessed.
table | pointer to TABLE object |
bool assert_invalid_stats_is_locked | ( | const TABLE * | table | ) |
Assert that caller holds lock on the table cache when TABLE::m_invalid_stats is accessed.
table | pointer to TABLE object |
bool assert_ref_count_is_locked | ( | const TABLE_SHARE * | share | ) |
Assert that the LOCK_open mutex is held when the reference count of a TABLE_SHARE is accessed.
share | the TABLE_SHARE |
|
inline |
Check if the table belongs to the P_S, excluding setup and threads tables.
|
inline |
Ident_name_check check_and_convert_db_name | ( | LEX_STRING * | org_name, |
bool | preserve_lettercase | ||
) |
Check if database name is valid, and convert to lower case if necessary.
org_name | Name of database and length |
preserve_lettercase | Preserve lettercase if true |
Ident_name_check::OK | Identifier name is Ok (Success) |
Ident_name_check::WRONG | Identifier name is Wrong (ER_WRONG_TABLE_NAME) |
Ident_name_check::TOO_LONG | Identifier name is too long if it is greater than 64 characters (ER_TOO_LONG_IDENT) |
bool check_column_name | ( | const char * | name | ) |
Ident_name_check check_db_name | ( | const char * | name, |
size_t | length | ||
) |
Check if database name is valid.
name | Name of database |
length | Length of name |
Ident_name_check::OK | Identifier name is Ok (Success) |
Ident_name_check::WRONG | Identifier name is Wrong (ER_WRONG_TABLE_NAME) |
Ident_name_check::TOO_LONG | Identifier name is too long if it is greater than 64 characters (ER_TOO_LONG_IDENT) |
Ident_name_check check_table_name | ( | const char * | name, |
size_t | length | ||
) |
Function to check if table name is valid or not.
If it is invalid, return appropriate error in each case to the caller.
name | Table name |
length | Length of table name |
Ident_name_check::OK | Identifier name is Ok (Success) |
Ident_name_check::WRONG | Identifier name is Wrong (ER_WRONG_TABLE_NAME) |
Ident_name_check::TOO_LONG | Identifier name is too long if it is greater than 64 characters (ER_TOO_LONG_IDENT) |
int closefrm | ( | TABLE * | table, |
bool | free_share | ||
) |
Free information allocated by openfrm.
table | TABLE object to free |
free_share | Is 1 if we also want to free table_share |
Create a copy of the key_info from TABLE_SHARE object to TABLE object.
Wherever prefix key is present, allocate a new Field object, having its field_length set to the prefix key length, and point the table's matching key_part->field to this new Field object.
This ensures that unpack_partition_info() reads the correct prefix length of partitioned fields
table | Table for which key_info is to be allocated |
root | MEM_ROOT in which to allocate key_info |
false | Success |
true | Failed to allocate memory for table.key_info in root |
Wherever prefix key is present, allocate a new Field object, having its field_length set to the prefix key length, and point the table's matching key_part->field to this new Field object.
This ensures that unpack_partition_info() reads the correct prefix length of partitioned fields
int create_table_share_for_upgrade | ( | THD * | thd, |
const char * | path, | ||
TABLE_SHARE * | share, | ||
FRM_context * | frm_context, | ||
const char * | db, | ||
const char * | table, | ||
bool | is_fix_view_cols_and_deps | ||
) |
Create TABLE_SHARE from .frm file.
FRM_context object is used to store the value removed from TABLE_SHARE. These values are used only for .frm file parsing.
[in] | thd | Thread handle. |
[in] | path | Path of the frm file. |
[out] | share | TABLE_SHARE to be populated. |
[out] | frm_context | FRM_context object. |
[in] | db | Database name. |
[in] | table | Table name. |
[in] | is_fix_view_cols_and_deps | Fix view column data, table and routine dependency. |
0 | ON SUCCESS |
-1 | ON FAILURE |
-2 | ON LESS SEVER FAILURE (see read_frm_file) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
char * fn_rext | ( | char * | name | ) |
Returns pointer to '.frm' extension of the file name.
name | file name |
Checks file name part starting with the rightmost '.' character, and returns it if it is equal to '.frm'.
Reclaims temporary blob storage which is bigger than a threshold.
Resets blob pointer. Unsets m_keep_old_value.
table | A handle to the TABLE object containing blob fields |
size | The threshold value. |
void free_blobs | ( | TABLE * | table | ) |
void free_table_share | ( | TABLE_SHARE * | share | ) |
Free table share and memory used by it.
share | Table share |
Allocate string field in MEM_ROOT and return it as NULL-terminated string.
mem | MEM_ROOT for allocating |
field | Field for retrieving of string |
NullS | string is empty |
other | pointer to NULL-terminated string value of field |
Allocate string field in MEM_ROOT and return it as String.
mem | MEM_ROOT for allocating |
field | Field for retrieving of string |
res | result String |
1 | string is empty |
0 | all ok |
TABLE_CATEGORY get_table_category | ( | const LEX_CSTRING & | db, |
const LEX_CSTRING & | name | ||
) |
void init_mdl_requests | ( | Table_ref * | table_list | ) |
Helper function which allows to allocate metadata lock request objects for all elements of table list.
void init_tmp_table_share | ( | THD * | thd, |
TABLE_SHARE * | share, | ||
const char * | key, | ||
size_t | key_length, | ||
const char * | table_name, | ||
const char * | path, | ||
MEM_ROOT * | mem_root | ||
) |
Initialize share for temporary tables.
thd | thread handle |
share | Share to fill |
key | Table_cache_key, as generated from create_table_def_key. must start with db name. |
key_length | Length of key |
table_name | Table name |
path | Path to file (possible in lower case) without .frm |
mem_root | MEM_ROOT to transfer (move) to the TABLE_SHARE; if NULL a new one is initialized. |
If table is not put in thd->temporary_tables (happens only when one uses OPEN TEMPORARY) then one can specify 'db' as key and use key_length= 0 as neither table_cache_key or key_length will be used).
|
inline |
|
inline |
|
inline |
|
inline |
bool is_simple_order | ( | ORDER * | order | ) |
Test if the order list consists of simple field expressions.
order | Linked list of ORDER BY arguments |
|
inline |
Check if a Table_ref instance represents a pre-opened temporary table.
|
inline |
return true if the table was created explicitly.
|
inline |
Derive type of metadata lock to be requested for table used by a DML statement from the type of THR_LOCK lock requested for this table.
int open_table_from_share | ( | THD * | thd, |
TABLE_SHARE * | share, | ||
const char * | alias, | ||
uint | db_stat, | ||
uint | prgflag, | ||
uint | ha_open_flags, | ||
TABLE * | outparam, | ||
bool | is_create_table, | ||
const dd::Table * | table_def_param | ||
) |
Open a table based on a TABLE_SHARE.
thd | Thread handler |
share | Table definition |
alias | Alias for table |
db_stat | Open flags (for example HA_OPEN_KEYFILE| HA_OPEN_RNDFILE..) can be 0 (example in ha_example_table) |
prgflag | READ_ALL etc.. |
ha_open_flags | HA_OPEN_ABORT_IF_LOCKED etc.. |
outparam | Result table. |
is_create_table | Indicates that table is opened as part of CREATE or ALTER and does not yet exist in SE. |
table_def_param | dd::Table object describing the table to be opened in SE. Can be nullptr, which case this function will try to retrieve such object from the data-dictionary before opening table in SE. |
0 | ok |
1 | Error (see open_table_error) |
2 | Error (see open_table_error) |
4 | Error (see open_table_error) |
7 | Table definition has changed in engine |
8 | Table row format has changed in engine |
int rename_file_ext | ( | const char * | from, |
const char * | to, | ||
const char * | ext | ||
) |
Repoint a table's fields from old_rec to new_rec.
table | the table of fields needed to be repointed |
old_rec | the original record buffer fields point to |
new_rec | the target record buff fields need to repoint |
int set_zone | ( | int | nr, |
int | min_zone, | ||
int | max_zone | ||
) |
void setup_key_part_field | ( | TABLE_SHARE * | share, |
handler * | handler_file, | ||
uint | primary_key_n, | ||
KEY * | keyinfo, | ||
uint | key_n, | ||
uint | key_part_n, | ||
uint * | usable_parts, | ||
bool | part_of_key_not_extended | ||
) |
Setup key-related fields of Field object for given key and key part.
[in] | share | Pointer to TABLE_SHARE |
[in] | handler_file | Pointer to handler |
[in] | primary_key_n | Primary key number |
[in] | keyinfo | Pointer to processed key |
[in] | key_n | Processed key number |
[in] | key_part_n | Processed key part number |
[in,out] | usable_parts | Pointer to usable_parts variable |
[in] | part_of_key_not_extended | Set when column is part of the Key and not appended by the storage engine from primary key columns. |
|
inlinestatic |
|
inlinestatic |
bool unpack_partition_info | ( | THD * | thd, |
TABLE * | outparam, | ||
TABLE_SHARE * | share, | ||
handlerton * | engine_type, | ||
bool | is_create_table | ||
) |
Unpack the partition expression.
Parse the partition expression to produce an Item.
[in] | thd | Thread handler |
[in] | outparam | Table object |
[in] | share | TABLE_SHARE object |
[in] | engine_type | Engine type of the partitions. |
[in] | is_create_table | Indicates that table is opened as part of CREATE or ALTER and does not yet exist in SE |
true | Failure. |
false | Success. |
bool unpack_value_generator | ( | THD * | thd, |
TABLE * | table, | ||
Value_generator ** | val_generator, | ||
Value_generator_source | source, | ||
const char * | source_name, | ||
Field * | field, | ||
bool | is_create_table, | ||
bool * | error_reported | ||
) |
Unpacks the definition of a value generator in all its forms: generated column, default expression or checked constraint.
The function parses the text definition of this expression, resolves its items and runs validation and calculates the base_columns_map which is used for tracking the columns the expression depends on.
[in] | thd | Thread handler |
[in] | table | Table having the value generator to be unpacked |
[in,out] | val_generator | Contains the expression in string format, and, if successful will be replaced by the parser with a new one having the unpacked expression. |
[in] | source | Source of value generator(a generated column, a regular column with generated default value or a check constraint). |
[in] | source_name | Name of the source (generated column, a regular column with generated default value or a check constraint). |
[in] | field | The column the value generator depends on. Can be null for checked constraints which do not depend on a single column. |
[in] | is_create_table | Indicates that table is opened as part of CREATE or ALTER and does not yet exist in SE |
[out] | error_reported | updated flag for the caller that no other error messages are to be generated. |
true | Failure. |
false | Success. |
void update_create_info_from_table | ( | HA_CREATE_INFO * | info, |
TABLE * | form | ||
) |
Evaluate necessary virtual generated columns.
This is used right after reading a row from the storage engine.
[in,out] | buf | the buffer to store data |
table | the TABLE object | |
active_index | the number of key for index scan (MAX_KEY is default) |
Calculate data for each generated field marked for write in the corresponding column map.
bitmap | Bitmap over fields to update |
table | the TABLE object |
false | Success |
true | Error occurred during the generation/calculation of a generated field value |
|
extern |
|
extern |
|
extern |
|
static |
|
extern |
|
static |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |