MySQL 9.1.0
Source Code Documentation
|
Namespaces | |
namespace | anonymous_namespace{item_create.cc} |
Classes | |
class | Create_sp_func |
Function builder for stored functions. More... | |
class | Create_func |
Public function builder interface. More... | |
class | Create_qfunc |
Function builder for qualified functions. More... | |
class | Create_udf_func |
Function builder for User Defined Functions. More... | |
class | Table_ident |
struct | LEX_SOURCE_INFO |
Structure to hold parameters for CHANGE REPLICATION SOURCE, START REPLICA, and STOP REPLICA. More... | |
struct | LEX_RESET_REPLICA |
class | Index_hint |
class | Query_expression |
This class represents a query expression (one query block or several query blocks combined with UNION). More... | |
class | Query_block |
This class represents a query block, aka a query specification, which is a query consisting of a SELECT keyword, followed by a table list, optionally followed by a WHERE clause, a GROUP BY, etc. More... | |
class | Condition_context |
Utility RAII class to save/modify/restore the condition_context information of a query block. More... | |
class | Secondary_engine_execution_context |
Base class for secondary engine execution context objects. More... | |
struct | struct_replica_connection |
struct | st_sp_chistics |
struct | st_trg_chistics |
class | Query_tables_list |
struct | st_parsing_options |
class | Lex_input_stream |
This class represents the character input stream consumed during lexical analysis. More... | |
class | LEX_COLUMN |
class | LEX_GRANT_AS |
struct | LEX |
The LEX object currently serves three different purposes: More... | |
class | Prepare_error_tracker |
RAII class to ease the call of LEX::mark_broken() if error. More... | |
class | Yacc_state |
The internal state of the syntax parser. More... | |
struct | Parser_input |
Input parameters to the parser. More... | |
class | Parser_state |
Internal state of the parser. More... | |
class | Partition_expr_parser_state |
Parser state for partition expression parser (.frm/DD stuff) More... | |
class | Gcol_expr_parser_state |
Parser state for generated column expression parser (.frm/DD stuff) More... | |
class | Expression_parser_state |
Parser state for single expression parser (.frm/DD stuff) More... | |
class | Common_table_expr_parser_state |
Parser state for CTE subquery parser. More... | |
class | Derived_expr_parser_state |
Parser state for Derived table's condition parser. More... | |
struct | st_lex_local |
class | Command_names |
Map from enumeration values of type enum_server_command to descriptions of type std::string. More... | |
Macros | |
#define | SQL_FN(F, N) &Function_factory<Instantiator<F, N>>::s_singleton |
Shorthand macro to reference the singleton instance. More... | |
#define | SQL_FACTORY(INSTANTIATOR) &Function_factory<INSTANTIATOR>::s_singleton |
Shorthand macro to reference the singleton instance when there is a specialized instantiator. More... | |
#define | SQL_FN_V(F, MIN, MAX) &Function_factory<Instantiator<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, args[0], ..., args[MAX]) More... | |
#define | SQL_FN_V_THD(F, MIN, MAX) &Function_factory<Instantiator_with_thd<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(thd, pos, args[0], ..., args[MAX]) More... | |
#define | SQL_FN_V_LIST(F, MIN, MAX) &Function_factory<List_instantiator<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, item_list) More... | |
#define | SQL_FN_LIST(F, N) &Function_factory<List_instantiator<F, N>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, item_list) More... | |
#define | SQL_FN_V_LIST_THD(F, MIN, MAX) &Function_factory<List_instantiator_with_thd<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(thd, pos, item_list) More... | |
#define | SQL_FN_ODD(F, MIN, MAX) |
Just like SQL_FN_V_THD, but enforces a check that the argument count is odd. More... | |
#define | SQL_FN_EVEN(F, MIN, MAX) |
Just like SQL_FN_V_THD, but enforces a check that the argument count is even. More... | |
#define | SQL_FN_INTERNAL(F, N) &Internal_function_factory<Instantiator<F, N>>::s_singleton |
Like SQL_FN, but for functions that may only be referenced from system views. More... | |
#define | SQL_FN_INTERNAL_V(F, MIN, MAX) &Internal_function_factory<Instantiator<F, MIN, MAX>>::s_singleton |
Just like SQL_FN_INTERNAL, but enforces a check that the argument count is even. More... | |
#define | SQL_FN_LIST_INTERNAL(F, N) &Internal_function_factory<List_instantiator<F, N>>::s_singleton |
Like SQL_FN_LIST, but for functions that may only be referenced from system views. More... | |
#define | SQL_FN_LIST_INTERNAL_V(F, MIN, MAX) &Internal_function_factory<List_instantiator<F, MIN, MAX>>::s_singleton |
Like SQL_FN_LIST, but enforces a check that the argument count is within the range specified. More... | |
#define | TYPE_ENUM_FUNCTION 1 |
#define | TYPE_ENUM_PROCEDURE 2 |
#define | TYPE_ENUM_TRIGGER 3 |
#define | TYPE_ENUM_PROXY 4 |
#define | TL_OPTION_UPDATING 0x01 |
#define | TL_OPTION_IGNORE_LEAVES 0x02 |
#define | TL_OPTION_ALIAS 0x04 |
#define | INDEX_HINT_MASK_JOIN (1) |
#define | INDEX_HINT_MASK_GROUP (1 << 1) |
#define | INDEX_HINT_MASK_ORDER (1 << 2) |
#define | INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | INDEX_HINT_MASK_ORDER) |
#define | CF_CHANGES_DATA (1U << 0) |
#define | CF_STATUS_COMMAND (1U << 2) |
#define | CF_SHOW_TABLE_COMMAND (1U << 3) |
#define | CF_WRITE_LOGS_COMMAND (1U << 4) |
#define | CF_REEXECUTION_FRAGILE (1U << 5) |
Must be set for SQL statements that may contain Item expressions and/or use joins and tables. More... | |
#define | CF_IMPLICIT_COMMIT_BEGIN (1U << 6) |
Implicitly commit before the SQL statement is executed. More... | |
#define | CF_IMPLICIT_COMMIT_END (1U << 7) |
Implicitly commit after the SQL statement. More... | |
#define | CF_AUTO_COMMIT_TRANS (CF_IMPLICIT_COMMIT_BEGIN | CF_IMPLICIT_COMMIT_END) |
CF_IMPLICIT_COMMIT_BEGIN and CF_IMPLICIT_COMMIT_END are used to ensure that the active transaction is implicitly committed before and after every DDL statement and any statement that modifies our currently non-transactional system tables. More... | |
#define | CF_DIAGNOSTIC_STMT (1U << 8) |
Diagnostic statement. More... | |
#define | CF_CAN_GENERATE_ROW_EVENTS (1U << 9) |
Identifies statements that may generate row events and that may end up in the binary log. More... | |
#define | CF_PREOPEN_TMP_TABLES (1U << 10) |
Identifies statements which may deal with temporary tables and for which temporary tables should be pre-opened to simplify privilege checks. More... | |
#define | CF_HA_CLOSE (1U << 11) |
Identifies statements for which open handlers should be closed in the beginning of the statement. More... | |
#define | CF_CAN_BE_EXPLAINED (1U << 12) |
Identifies statements that can be explained with EXPLAIN. More... | |
#define | CF_OPTIMIZER_TRACE (1U << 14) |
Identifies statements which may generate an optimizer trace. More... | |
#define | CF_DISALLOW_IN_RO_TRANS (1U << 15) |
Identifies statements that should always be disallowed in read only transactions. More... | |
#define | CF_ALLOW_PROTOCOL_PLUGIN (1U << 16) |
Identifies statements and commands that can be used with Protocol Plugin. More... | |
#define | CF_NEEDS_AUTOCOMMIT_OFF (1U << 17) |
Identifies statements (typically DDL) which needs auto-commit mode temporarily turned off. More... | |
#define | CF_HAS_RESULT_SET (1U << 18) |
Identifies statements which can return rows of data columns (SELECT, SHOW ...) More... | |
#define | CF_POTENTIAL_ATOMIC_DDL (1U << 19) |
Identifies DDL statements which can be atomic. More... | |
#define | CF_REQUIRE_ACL_CACHE (1U << 20) |
Statement is depending on the ACL cache, which can be disabled by the –skip-grant-tables server option. More... | |
#define | CF_SHOW_USES_SYSTEM_VIEW (1U << 21) |
Identifies statements as SHOW commands using INFORMATION_SCHEMA system views. More... | |
#define | CF_SKIP_QUERY_ID (1U << 0) |
Skip the increase of the global query id counter. More... | |
#define | CF_SKIP_QUESTIONS (1U << 1) |
Skip the increase of the number of statements that clients have sent to the server. More... | |
Typedefs | |
using | Native_functions_hash = std::unordered_map< std::string, Create_func * > |
using | List_item = mem_root_deque< Item * > |
using | Group_list_ptrs = Mem_root_array< ORDER * > |
typedef uchar | index_clause_map |
typedef Bounds_checked_array< Item * > | Ref_item_array |
typedef struct struct_replica_connection | LEX_REPLICA_CONNECTION |
Functions | |
bool | item_create_init () |
Load the hash table for native functions. More... | |
void | item_create_cleanup () |
Empty the hash table for native functions. More... | |
Create_func * | find_native_function_builder (const LEX_STRING &name) |
Find the native function builder associated with a given function name. More... | |
Create_qfunc * | find_qualified_function_builder (THD *thd) |
Find the function builder for qualified functions. More... | |
Item * | create_func_cast (THD *thd, const POS &pos, Item *a, Cast_target cast_target, const CHARSET_INFO *cs) |
static bool | validate_cast_type_and_extract_length (const THD *thd, Item *arg, const Cast_type &cast_type, bool as_array, int64_t *length, uint *precision) |
Validates a cast target type and extracts the specified length and precision of the target type. More... | |
Item * | create_func_cast (THD *thd, const POS &pos, Item *arg, const Cast_type &type, bool as_array) |
This function does not store the reference to type . More... | |
Item * | create_func_json_value (THD *thd, const POS &pos, Item *arg, Item *path, const Cast_type &type, Json_on_response_type on_empty_type, Item *on_empty_default, Json_on_response_type on_error_type, Item *on_error_default) |
Creates an Item that represents a JSON_VALUE expression. More... | |
Item * | create_temporal_literal (THD *thd, const char *str, size_t length, const CHARSET_INFO *cs, enum_field_types type, bool send_error) |
Builder for datetime literals: TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'. More... | |
void | binlog_unsafe_map_init () |
enum_sp_type | to_sp_type (longlong val) |
longlong | to_longlong (enum_sp_type val) |
uint | to_uint (enum_sp_type val) |
bool | walk_join_list (mem_root_deque< Table_ref * > &list, std::function< bool(Table_ref *)> action) |
void | lex_free (void) |
bool | lex_start (THD *thd) |
Call lex_start() before every query that is to be prepared and executed. More... | |
void | lex_end (LEX *lex) |
Call this function after preparation and execution of a query. More... | |
int | my_sql_parser_lex (MY_SQL_PARSER_STYPE *, POS *, class THD *) |
yylex() function implementation for the main parser More... | |
void | trim_whitespace (const CHARSET_INFO *cs, LEX_STRING *str) |
bool | is_lex_native_function (const LEX_STRING *name) |
Check if name is a sql function. More... | |
bool | is_keyword (const char *name, size_t len) |
bool | db_is_default_db (const char *db, size_t db_len, const THD *thd) |
bool | check_select_for_locking_clause (THD *) |
void | print_derived_column_names (const THD *thd, String *str, const Create_col_name_list *column_names) |
Prints into 'str' a comma-separated list of column names, enclosed in parenthesis. More... | |
int | test_if_data_home_dir (const char *dir) |
bool | stmt_causes_implicit_commit (const THD *thd, uint mask) |
Returns whether the command in thd->lex->sql_command should cause an implicit commit. More... | |
void | turn_parser_debug_on () |
bool | parse_sql (THD *thd, Parser_state *parser_state, Object_creation_ctx *creation_ctx) |
Transform an SQL statement into an AST that is ready for resolving, using the supplied parser state and object creation context. More... | |
void | free_items (Item *item) |
void | cleanup_items (Item *item) |
This works because items are allocated with (*THR_MALLOC)->Alloc(). More... | |
void | bind_fields (Item *first) |
Bind Item fields to Field objects. More... | |
Comp_creator * | comp_eq_creator (bool invert) |
Comp_creator * | comp_equal_creator (bool invert) |
Comp_creator * | comp_ge_creator (bool invert) |
Comp_creator * | comp_gt_creator (bool invert) |
Comp_creator * | comp_le_creator (bool invert) |
Comp_creator * | comp_lt_creator (bool invert) |
Comp_creator * | comp_ne_creator (bool invert) |
int | prepare_schema_table (THD *thd, LEX *lex, Table_ident *table_ident, enum enum_schema_tables schema_table_idx) |
Create a Table_ref object for an INFORMATION_SCHEMA table. More... | |
void | get_default_definer (THD *thd, LEX_USER *definer) |
Set the specified definer to the default value, which is the current user in the thread. More... | |
LEX_USER * | create_default_definer (THD *thd) |
Create default definer for the specified THD. More... | |
LEX_USER * | get_current_user (THD *thd, LEX_USER *user) |
Returns information about user or current user. More... | |
bool | check_string_char_length (const LEX_CSTRING &str, const char *err_msg, size_t max_char_length, const CHARSET_INFO *cs, bool no_error) |
bool | merge_charset_and_collation (const CHARSET_INFO *charset, const CHARSET_INFO *collation, const CHARSET_INFO **to) |
(end of group Runtime_Environment) More... | |
bool | merge_sp_var_charset_and_collation (const CHARSET_INFO *charset, const CHARSET_INFO *collation, const CHARSET_INFO **to) |
bool | check_host_name (const LEX_CSTRING &str) |
Check that host name string is valid. More... | |
bool | mysql_test_parse_for_slave (THD *thd) |
Usable by the replication SQL thread only: just parse a query to know if it can be ignored because of replicate-*-table rules. More... | |
bool | is_update_query (enum enum_sql_command command) |
bool | is_explainable_query (enum enum_sql_command command) |
bool | is_log_table_write_query (enum enum_sql_command command) |
Check if a sql command is allowed to write to log tables. More... | |
bool | alloc_query (THD *thd, const char *packet, size_t packet_length) |
Read query from packet and store in thd->query. More... | |
void | dispatch_sql_command (THD *thd, Parser_state *parser_state, bool is_retry=false) |
Parse an SQL command from a text string and pass the resulting AST to the query executor. More... | |
void | mysql_reset_thd_for_next_command (THD *thd) |
Reset the part of THD responsible for the state of command processing. More... | |
void | create_table_set_open_action_and_adjust_tables (LEX *lex) |
Set proper open mode and table type for element representing target table of CREATE TABLE statement, also adjust statement table list if necessary. More... | |
int | mysql_execute_command (THD *thd, bool first_level=false) |
Execute command saved in thd and lex->sql_command. More... | |
bool | do_command (THD *thd) |
Read one command from connection and execute it (query or simple command). More... | |
bool | dispatch_command (THD *thd, const COM_DATA *com_data, enum enum_server_command command) |
Perform one connection-level (COM_XXXX) command. More... | |
bool | prepare_index_and_data_dir_path (THD *thd, const char **data_file_name, const char **index_file_name, const char *table_name) |
prepares the index and data directory path. More... | |
int | append_file_to_dir (THD *thd, const char **filename_ptr, const char *table_name) |
If pointer is not a null pointer, append filename to it. More... | |
void | execute_init_command (THD *thd, LEX_STRING *init_command, mysql_rwlock_t *var_lock) |
void | add_to_list (SQL_I_List< ORDER > &list, ORDER *order) |
save order by and tables in own lists. More... | |
void | add_join_on (Table_ref *b, Item *expr) |
Add an ON condition to the second operand of a JOIN ... ON. More... | |
bool | push_new_name_resolution_context (Parse_context *pc, Table_ref *left_op, Table_ref *right_op) |
Push a new name resolution context for a JOIN ... ON clause to the context stack of a query block. More... | |
void | init_sql_command_flags (void) |
const CHARSET_INFO * | get_bin_collation (const CHARSET_INFO *cs) |
void | killall_non_super_threads (THD *thd) |
bool | shutdown (THD *thd, enum mysql_enum_shutdown_level level) |
Shutdown the mysqld server. More... | |
bool | show_precheck (THD *thd, LEX *lex, bool lock) |
Do special checking for SHOW statements. More... | |
void | statement_id_to_session (THD *thd) |
bool | sqlcom_can_generate_row_events (enum enum_sql_command command) |
bool | is_normal_transaction_boundary_stmt (enum enum_sql_command command) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of a transaction. More... | |
bool | is_xa_transaction_boundary_stmt (enum enum_sql_command command) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of an XA transaction. More... | |
bool | all_tables_not_ok (THD *thd, Table_ref *tables) |
Returns true if all tables should be ignored. More... | |
bool | some_non_temp_table_to_be_updated (THD *thd, Table_ref *tables) |
bool | set_default_charset (HA_CREATE_INFO *create_info, const CHARSET_INFO *value) |
bool | set_default_collation (HA_CREATE_INFO *create_info, const CHARSET_INFO *value) |
bool | sp_process_definer (THD *) |
Item * | Create_qfunc::create_func (THD *thd, LEX_STRING name, PT_item_list *item_list) override |
The builder create method, for unqualified functions. More... | |
Item * | Create_udf_func::create_func (THD *thd, LEX_STRING name, PT_item_list *item_list) override |
The builder create method. More... | |
Item * | Create_udf_func::create (THD *thd, udf_func *fct, PT_item_list *item_list) |
The builder create method, for User Defined Functions. More... | |
Item * | Create_sp_func::create (THD *thd, LEX_STRING db, LEX_STRING name, bool use_explicit_name, PT_item_list *item_list) override |
The builder create method, for qualified functions. More... | |
bool | Query_expression::is_union () const |
bool | Query_expression::is_set_operation () const |
Variables | |
static const std::pair< const char *, Create_func * > | func_array [] |
MySQL native functions. More... | |
static const Native_functions_hash * | native_functions_hash |
const size_t | INITIAL_LEX_PLUGIN_LIST_SIZE = 16 |
constexpr const int | MAX_SELECT_NESTING {sizeof(nesting_map) * 8 - 1} |
uint | binlog_unsafe_map [256] |
const LEX_CSTRING | sp_data_access_name [] |
const char * | index_hint_type_name [] |
const LEX_STRING | null_lex_str |
LEX_STRING constant for null-string to be used in parser and other places. More... | |
uint | sql_command_flags [] |
Mark all commands that somehow changes a table. More... | |
static Create_udf_func | Create_udf_func::s_singleton |
Singleton. More... | |
static Create_sp_func | Create_sp_func::s_singleton |
#define CF_ALLOW_PROTOCOL_PLUGIN (1U << 16) |
Identifies statements and commands that can be used with Protocol Plugin.
#define CF_AUTO_COMMIT_TRANS (CF_IMPLICIT_COMMIT_BEGIN | CF_IMPLICIT_COMMIT_END) |
CF_IMPLICIT_COMMIT_BEGIN and CF_IMPLICIT_COMMIT_END are used to ensure that the active transaction is implicitly committed before and after every DDL statement and any statement that modifies our currently non-transactional system tables.
#define CF_CAN_BE_EXPLAINED (1U << 12) |
Identifies statements that can be explained with EXPLAIN.
#define CF_CAN_GENERATE_ROW_EVENTS (1U << 9) |
Identifies statements that may generate row events and that may end up in the binary log.
#define CF_CHANGES_DATA (1U << 0) |
#define CF_DIAGNOSTIC_STMT (1U << 8) |
Diagnostic statement.
Diagnostic statements:
#define CF_DISALLOW_IN_RO_TRANS (1U << 15) |
Identifies statements that should always be disallowed in read only transactions.
#define CF_HA_CLOSE (1U << 11) |
Identifies statements for which open handlers should be closed in the beginning of the statement.
#define CF_HAS_RESULT_SET (1U << 18) |
Identifies statements which can return rows of data columns (SELECT, SHOW ...)
#define CF_IMPLICIT_COMMIT_BEGIN (1U << 6) |
Implicitly commit before the SQL statement is executed.
Statements marked with this flag will cause any active transaction to end (commit) before proceeding with the command execution.
This flag should be set for statements that probably can't be rolled back or that do not expect any previously metadata locked tables.
#define CF_IMPLICIT_COMMIT_END (1U << 7) |
Implicitly commit after the SQL statement.
Statements marked with this flag are automatically committed at the end of the statement.
This flag should be set for statements that will implicitly open and take metadata locks on system tables that should not be carried for the whole duration of a active transaction.
#define CF_NEEDS_AUTOCOMMIT_OFF (1U << 17) |
Identifies statements (typically DDL) which needs auto-commit mode temporarily turned off.
#define CF_OPTIMIZER_TRACE (1U << 14) |
Identifies statements which may generate an optimizer trace.
#define CF_POTENTIAL_ATOMIC_DDL (1U << 19) |
Identifies DDL statements which can be atomic.
Having the bit ON does not yet define an atomic. The property is used both on the master and slave. On the master atomicity infers the binlog and gtid_executed system table. On the slave it more involves the slave info table.
#define CF_PREOPEN_TMP_TABLES (1U << 10) |
Identifies statements which may deal with temporary tables and for which temporary tables should be pre-opened to simplify privilege checks.
#define CF_REEXECUTION_FRAGILE (1U << 5) |
Must be set for SQL statements that may contain Item expressions and/or use joins and tables.
Indicates that the parse tree of such statement may contain rule-based optimizations that depend on metadata (i.e. number of columns in a table), and consequently that the statement must be re-prepared whenever referenced metadata changes. Must not be set for statements that themselves change metadata, e.g. RENAME, ALTER and other DDL, since otherwise will trigger constant reprepare. Consequently, complex item expressions and joins are currently prohibited in these statements.
#define CF_REQUIRE_ACL_CACHE (1U << 20) |
Statement is depending on the ACL cache, which can be disabled by the –skip-grant-tables server option.
#define CF_SHOW_TABLE_COMMAND (1U << 3) |
#define CF_SHOW_USES_SYSTEM_VIEW (1U << 21) |
Identifies statements as SHOW commands using INFORMATION_SCHEMA system views.
#define CF_SKIP_QUERY_ID (1U << 0) |
Skip the increase of the global query id counter.
Commonly set for commands that are stateless (won't cause any change on the server internal states). This is made obsolete as query id is incremented for ping and statistics commands as well because of race condition (Bug#58785).
#define CF_SKIP_QUESTIONS (1U << 1) |
Skip the increase of the number of statements that clients have sent to the server.
Commonly used for commands that will cause a statement to be executed but the statement might have not been sent by the user (ie: stored procedure).
#define CF_STATUS_COMMAND (1U << 2) |
#define CF_WRITE_LOGS_COMMAND (1U << 4) |
#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | INDEX_HINT_MASK_ORDER) |
#define INDEX_HINT_MASK_GROUP (1 << 1) |
#define INDEX_HINT_MASK_JOIN (1) |
#define INDEX_HINT_MASK_ORDER (1 << 2) |
#define SQL_FACTORY | ( | INSTANTIATOR | ) | &Function_factory<INSTANTIATOR>::s_singleton |
Shorthand macro to reference the singleton instance when there is a specialized instantiator.
INSTANTIATOR | The instantiator class. |
#define SQL_FN | ( | F, | |
N | |||
) | &Function_factory<Instantiator<F, N>>::s_singleton |
Shorthand macro to reference the singleton instance.
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
N | Number of arguments that the function accepts. |
Just like SQL_FN_V_THD, but enforces a check that the argument count is even.
#define SQL_FN_INTERNAL | ( | F, | |
N | |||
) | &Internal_function_factory<Instantiator<F, N>>::s_singleton |
Like SQL_FN, but for functions that may only be referenced from system views.
F | The Item_func that the factory should make. |
N | Number of arguments that the function accepts. |
#define SQL_FN_INTERNAL_V | ( | F, | |
MIN, | |||
MAX | |||
) | &Internal_function_factory<Instantiator<F, MIN, MAX>>::s_singleton |
Just like SQL_FN_INTERNAL, but enforces a check that the argument count is even.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
#define SQL_FN_LIST | ( | F, | |
N | |||
) | &Function_factory<List_instantiator<F, N>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, item_list)
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
N | Number of arguments that the function accepts. |
#define SQL_FN_LIST_INTERNAL | ( | F, | |
N | |||
) | &Internal_function_factory<List_instantiator<F, N>>::s_singleton |
Like SQL_FN_LIST, but for functions that may only be referenced from system views.
F | The Item_func that the factory should make. |
N | Number of arguments that the function accepts. |
#define SQL_FN_LIST_INTERNAL_V | ( | F, | |
MIN, | |||
MAX | |||
) | &Internal_function_factory<List_instantiator<F, MIN, MAX>>::s_singleton |
Like SQL_FN_LIST, but enforces a check that the argument count is within the range specified.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
Just like SQL_FN_V_THD, but enforces a check that the argument count is odd.
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, args[0], ..., args[MAX])
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
#define SQL_FN_V_LIST | ( | F, | |
MIN, | |||
MAX | |||
) | &Function_factory<List_instantiator<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(pos, item_list)
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
#define SQL_FN_V_LIST_THD | ( | F, | |
MIN, | |||
MAX | |||
) | &Function_factory<List_instantiator_with_thd<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(thd, pos, item_list)
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
#define SQL_FN_V_THD | ( | F, | |
MIN, | |||
MAX | |||
) | &Function_factory<Instantiator_with_thd<F, MIN, MAX>>::s_singleton |
Use this macro if you want to instantiate the Item_func object like Item_func_xxx::Item_func_xxx(thd, pos, args[0], ..., args[MAX])
This also instantiates the Function_factory and Instantiator templates.
F | The Item_func that the factory should make. |
MIN | Number of arguments that the function accepts. |
MAX | Number of arguments that the function accepts. |
#define TL_OPTION_ALIAS 0x04 |
#define TL_OPTION_IGNORE_LEAVES 0x02 |
#define TL_OPTION_UPDATING 0x01 |
#define TYPE_ENUM_FUNCTION 1 |
#define TYPE_ENUM_PROCEDURE 2 |
#define TYPE_ENUM_PROXY 4 |
#define TYPE_ENUM_TRIGGER 3 |
using Group_list_ptrs = Mem_root_array<ORDER *> |
typedef uchar index_clause_map |
typedef struct struct_replica_connection LEX_REPLICA_CONNECTION |
using List_item = mem_root_deque<Item *> |
using Native_functions_hash = std::unordered_map<std::string, Create_func *> |
typedef Bounds_checked_array<Item *> Ref_item_array |
|
strong |
|
strong |
|
strong |
enum enum_comment_state |
The state of the lexical parser, when parsing comments.
|
strong |
Query_block type enum.
enum enum_sp_data_access |
|
strong |
enum_sp_type defines type codes of stored programs.
Enumerator | |
---|---|
FUNCTION | |
PROCEDURE | |
TRIGGER | |
EVENT | |
INVALID_SP_TYPE |
|
strong |
enum sub_select_type |
Add an ON condition to the second operand of a JOIN ... ON.
Add an ON condition to the right operand of a JOIN ... ON clause.
b | the second operand of a JOIN ... ON |
expr | the condition to be added to the ON clause |
void add_to_list | ( | SQL_I_List< ORDER > & | list, |
ORDER * | order | ||
) |
save order by and tables in own lists.
Returns true if all tables should be ignored.
bool alloc_query | ( | THD * | thd, |
const char * | packet, | ||
size_t | packet_length | ||
) |
Read query from packet and store in thd->query.
Used in COM_QUERY and COM_STMT_PREPARE.
Sets the following THD variables:
false | ok |
true | error; In this case thd->fatal_error is set |
int append_file_to_dir | ( | THD * | thd, |
const char ** | filename_ptr, | ||
const char * | table_name | ||
) |
If pointer is not a null pointer, append filename to it.
void bind_fields | ( | Item * | first | ) |
Bind Item fields to Field objects.
first | Pointer to first item, follow "next" chain to visit all items |
void binlog_unsafe_map_init | ( | ) |
bool check_host_name | ( | const LEX_CSTRING & | str | ) |
Check that host name string is valid.
[in] | str | string to be checked |
false | host name is ok |
true | host name string is longer than max_length or has invalid symbols |
bool check_select_for_locking_clause | ( | THD * | ) |
bool check_string_char_length | ( | const LEX_CSTRING & | str, |
const char * | err_msg, | ||
size_t | max_char_length, | ||
const CHARSET_INFO * | cs, | ||
bool | no_error | ||
) |
void cleanup_items | ( | Item * | item | ) |
This works because items are allocated with (*THR_MALLOC)->Alloc().
Comp_creator * comp_eq_creator | ( | bool | invert | ) |
Comp_creator * comp_equal_creator | ( | bool | invert | ) |
Comp_creator * comp_ge_creator | ( | bool | invert | ) |
Comp_creator * comp_gt_creator | ( | bool | invert | ) |
Comp_creator * comp_le_creator | ( | bool | invert | ) |
Comp_creator * comp_lt_creator | ( | bool | invert | ) |
Comp_creator * comp_ne_creator | ( | bool | invert | ) |
|
overridevirtual |
The builder create method, for qualified functions.
thd | The current thread |
db | The database name or NULL_STR to use the default db name |
name | The function name |
use_explicit_name | Should the function be represented as 'db.name'? |
item_list | The list of arguments to the function, can be NULL |
Implements Create_qfunc.
Item * Create_udf_func::create | ( | THD * | thd, |
udf_func * | fct, | ||
PT_item_list * | item_list | ||
) |
The builder create method, for User Defined Functions.
thd | The current thread |
fct | The User Defined Function metadata |
item_list | The list of arguments to the function, can be NULL |
Create default definer for the specified THD.
[in] | thd | thread handler |
|
overridevirtual |
The builder create method, for unqualified functions.
This builder will use the current database for the database name.
thd | The current thread |
name | The function name |
item_list | The list of arguments to the function, can be NULL |
Implements Create_func.
|
overridevirtual |
The builder create method.
Given the function name and list or arguments, this method creates an Item
that represents the function call. In case or errors, a NULL item is returned, and an error is reported. Note that the thd
object may be modified by the builder. In particular, the following members/methods can be set/called, depending on the function called and the function possible side effects.
thd->lex->binlog_row_based_if_mixed
thd->lex->current_context()
thd->lex->safe_to_cache_query
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT)
thd->lex->uncacheable(UNCACHEABLE_RAND)
thd->lex->add_time_zone_tables_to_query_tables(thd)
thd | The current thread |
name | The function name |
item_list | The list of arguments to the function, can be NULL |
Implements Create_func.
Item * create_func_cast | ( | THD * | thd, |
const POS & | pos, | ||
Item * | a, | ||
Cast_target | cast_target, | ||
const CHARSET_INFO * | cs | ||
) |
Item * create_func_cast | ( | THD * | thd, |
const POS & | pos, | ||
Item * | arg, | ||
const Cast_type & | type, | ||
bool | as_array | ||
) |
This function does not store the reference to type
.
Builder for cast expressions.
thd | The current thread |
pos | Location of casting expression |
arg | The item to cast |
type | the type casted into |
as_array | Cast to array |
Item * create_func_json_value | ( | THD * | thd, |
const POS & | pos, | ||
Item * | arg, | ||
Item * | path, | ||
const Cast_type & | type, | ||
Json_on_response_type | on_empty_type, | ||
Item * | on_empty_default, | ||
Json_on_response_type | on_error_type, | ||
Item * | on_error_default | ||
) |
Creates an Item that represents a JSON_VALUE expression.
thd | thread handler |
pos | the location of the expression |
arg | the JSON input argument to the JSON_VALUE expression |
path | the path to extract from the JSON document |
type | the target type of the JSON_VALUE expression |
on_empty_type | the type of the ON EMPTY clause |
on_empty_default | the default value specified in ON EMPTY, if any |
on_error_type | the type of the ON ERROR clause |
on_error_default | the default value specified in ON ERROR, if any |
void create_table_set_open_action_and_adjust_tables | ( | LEX * | lex | ) |
Set proper open mode and table type for element representing target table of CREATE TABLE statement, also adjust statement table list if necessary.
Item * create_temporal_literal | ( | THD * | thd, |
const char * | str, | ||
size_t | length, | ||
const CHARSET_INFO * | cs, | ||
enum_field_types | type, | ||
bool | send_error | ||
) |
Builder for datetime literals: TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'.
thd | The current thread |
str | Character literal |
length | Length of str |
cs | Character set of str |
type | Type of literal (TIME, DATE or DATETIME) |
send_error | Whether to generate an error on failure |
bool db_is_default_db | ( | const char * | db, |
size_t | db_len, | ||
const THD * | thd | ||
) |
bool dispatch_command | ( | THD * | thd, |
const COM_DATA * | com_data, | ||
enum enum_server_command | command | ||
) |
Perform one connection-level (COM_XXXX) command.
thd | connection handle |
command | type of command to perform |
com_data | com_data union to store the generated command |
0 | ok |
1 | request of thread shutdown, i. e. if command is COM_QUIT |
Clear the set of flags that are expected to be cleared at the beginning of each command.
Enforce password expiration for all RPC commands, except the following:
COM_QUERY/COM_STMT_PREPARE and COM_STMT_EXECUTE do a more fine-grained check later. COM_STMT_CLOSE and COM_STMT_SEND_LONG_DATA don't return anything. COM_PING only discloses information that the server is running, and that's available through other means. COM_QUIT should work even for expired statements.
void dispatch_sql_command | ( | THD * | thd, |
Parser_state * | parser_state, | ||
bool | is_retry | ||
) |
Parse an SQL command from a text string and pass the resulting AST to the query executor.
thd | Current session. |
parser_state | Parser state. |
is_retry | True if this is a retry of the statement in a different storage engine. Some logging (general log and performance schema) should be skipped in that case, as the query was already logged in the first round. |
bool do_command | ( | THD * | thd | ) |
Read one command from connection and execute it (query or simple command).
This function is called in loop from thread function.
For profiling to work, it must never be called recursively.
0 | success |
1 | request of thread shutdown (see dispatch_command() description) |
void execute_init_command | ( | THD * | thd, |
LEX_STRING * | init_command, | ||
mysql_rwlock_t * | var_lock | ||
) |
Create_func * find_native_function_builder | ( | const LEX_STRING & | name | ) |
Find the native function builder associated with a given function name.
name | The native function name |
Create_qfunc * find_qualified_function_builder | ( | THD * | thd | ) |
Find the function builder for qualified functions.
thd | The current thread |
void free_items | ( | Item * | item | ) |
const CHARSET_INFO * get_bin_collation | ( | const CHARSET_INFO * | cs | ) |
Returns information about user or current user.
[in] | thd | thread handler |
[in] | user | user |
Set the specified definer to the default value, which is the current user in the thread.
[in] | thd | thread handler |
[out] | definer | definer |
void init_sql_command_flags | ( | void | ) |
ACL DDLs do not access data-dictionary tables. However, they still need to be marked to avoid autocommit. This is necessary because code which saves GTID state or slave state in the system tables at commit time does statement commit on low-level (see System_table_access::close_table()) and thus can pre-maturely commit DDL otherwise.
Some statements doesn't if the ACL CACHE is disabled using the –skip-grant-tables server option.
bool is_explainable_query | ( | enum enum_sql_command | command | ) |
bool is_keyword | ( | const char * | name, |
size_t | len | ||
) |
bool is_lex_native_function | ( | const LEX_STRING * | name | ) |
Check if name is a sql function.
name | checked name |
0 | name is a function |
1 | name isn't a function |
bool is_log_table_write_query | ( | enum enum_sql_command | command | ) |
Check if a sql command is allowed to write to log tables.
command | The SQL command |
bool is_normal_transaction_boundary_stmt | ( | enum enum_sql_command | command | ) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of a transaction.
command | The parsed SQL_COMM to check. |
|
inline |
|
inline |
bool is_update_query | ( | enum enum_sql_command | command | ) |
bool is_xa_transaction_boundary_stmt | ( | enum enum_sql_command | command | ) |
This function checks if the sql_command is one that identifies the boundaries (begin, end or savepoint) of an XA transaction.
It does not consider PREPARE statements.
command | The parsed SQL_COMM to check. |
void item_create_cleanup | ( | ) |
Empty the hash table for native functions.
Note: this code is not thread safe, and is intended to be used at server shutdown only (after thread requests have been executed).
bool item_create_init | ( | ) |
Load the hash table for native functions.
Note: this code is not thread safe, and is intended to be used at server startup only (before going multi-threaded)
false | OK. |
true | An exception was caught. |
void killall_non_super_threads | ( | THD * | thd | ) |
void lex_end | ( | LEX * | lex | ) |
Call this function after preparation and execution of a query.
void lex_free | ( | void | ) |
bool lex_start | ( | THD * | thd | ) |
Call lex_start() before every query that is to be prepared and executed.
Because of this, it's critical not to do too many things here. (We already do too much)
The function creates a query_block and a query_block_query_expression object. These objects should rather be created by the parser bottom-up.
bool merge_charset_and_collation | ( | const CHARSET_INFO * | charset, |
const CHARSET_INFO * | collation, | ||
const CHARSET_INFO ** | to | ||
) |
(end of group Runtime_Environment)
Check and merge "[ CHARACTER SET charset ] [ COLLATE collation ]" clause
[in] | charset | Character set pointer or NULL. |
[in] | collation | Collation pointer or NULL. |
[out] | to | Resulting character set/collation/NULL on success, untouched on failure. |
Check if collation "collation" is applicable to character set "charset".
If "collation" is NULL (e.g. when COLLATE clause is not specified), then simply "charset" is returned in "to". And vice versa, if "charset" is NULL, "collation" is returned in "to".
bool merge_sp_var_charset_and_collation | ( | const CHARSET_INFO * | charset, |
const CHARSET_INFO * | collation, | ||
const CHARSET_INFO ** | to | ||
) |
int my_sql_parser_lex | ( | MY_SQL_PARSER_STYPE * | yacc_yylval, |
POS * | yylloc, | ||
THD * | thd | ||
) |
yylex() function implementation for the main parser
[out] | yacc_yylval | semantic value of the token being parsed (yylval) |
[out] | yylloc | "location" of the token being parsed (yylloc) |
thd | THD |
int mysql_execute_command | ( | THD * | thd, |
bool | first_level | ||
) |
Execute command saved in thd and lex->sql_command.
thd | Thread handle |
first_level | whether invocation of the mysql_execute_command() is a top level query or sub query. At the highest level, first_level value is true. Stored procedures can execute sub queries. In such cases first_level (recursive mysql_execute_command() call) will be false. |
false | OK |
true | Error |
void mysql_reset_thd_for_next_command | ( | THD * | thd | ) |
Reset the part of THD responsible for the state of command processing.
This needs to be called before execution of every statement (prepared or conventional). It is not called by substatements of routines.
bool mysql_test_parse_for_slave | ( | THD * | thd | ) |
Usable by the replication SQL thread only: just parse a query to know if it can be ignored because of replicate-*-table rules.
0 | cannot be ignored |
1 | can be ignored |
bool parse_sql | ( | THD * | thd, |
Parser_state * | parser_state, | ||
Object_creation_ctx * | creation_ctx | ||
) |
Transform an SQL statement into an AST that is ready for resolving, using the supplied parser state and object creation context.
This is a wrapper() for THD::sql_parser() and should generally be used for AST construction.
The function may optionally generate a query digest, invoke this function as follows:
THD *thd = ...; const char *query_text = ...; uint query_length = ...; Object_creation_ctx *ctx = ...; bool rc; Parser_state parser_state; if (parser_state.init(thd, query_text, query_length) { ... handle error } parser_state.m_input.m_has_digest= true; parser_state.m_input.m_compute_digest= true; rc= parse_sql(the, &parser_state, ctx); if (! rc) { unsigned char md5[MD5_HASH_SIZE]; char digest_text[1024]; bool truncated; const sql_digest_storage *digest= & thd->m_digest->m_digest_storage; compute_digest_md5(digest, & md5[0]); compute_digest_text(digest, & digest_text[0], sizeof(digest_text), & truncated); }
thd | Thread context. |
parser_state | Parser state. |
creation_ctx | Object creation context. |
false | on success. |
true | on parsing error. |
bool prepare_index_and_data_dir_path | ( | THD * | thd, |
const char ** | data_file_name, | ||
const char ** | index_file_name, | ||
const char * | table_name | ||
) |
prepares the index and data directory path.
thd | Thread handle |
data_file_name | Pathname for data directory |
index_file_name | Pathname for index directory |
table_name | Table name to be appended to the pathname specified |
int prepare_schema_table | ( | THD * | thd, |
LEX * | lex, | ||
Table_ident * | table_ident, | ||
enum enum_schema_tables | schema_table_idx | ||
) |
Create a Table_ref object for an INFORMATION_SCHEMA table.
This function is used in the parser to convert a SHOW or DESCRIBE table_name command to a SELECT from INFORMATION_SCHEMA. It prepares a Query_block and a Table_ref object to represent the given command as a SELECT parse tree.
thd | thread handle |
lex | current lex |
table_ident | table alias if it's used |
schema_table_idx | the type of the INFORMATION_SCHEMA table to be created |
0 | success |
1 | out of memory or SHOW commands are not allowed in this version of the server. |
void print_derived_column_names | ( | const THD * | thd, |
String * | str, | ||
const Create_col_name_list * | column_names | ||
) |
Prints into 'str' a comma-separated list of column names, enclosed in parenthesis.
thd | Thread handler |
str | Where to print |
column_names | List to print, or NULL |
bool push_new_name_resolution_context | ( | Parse_context * | pc, |
Table_ref * | left_op, | ||
Table_ref * | right_op | ||
) |
Push a new name resolution context for a JOIN ... ON clause to the context stack of a query block.
Create a new name resolution context for a JOIN ... ON clause, set the first and last leaves of the list of table references to be used for name resolution, and push the newly created context to the stack of contexts of the query.
pc | current parse context |
left_op | left operand of the JOIN |
right_op | right operand of the JOIN |
false | if all is OK |
true | if a memory allocation error occurred |
bool set_default_charset | ( | HA_CREATE_INFO * | create_info, |
const CHARSET_INFO * | value | ||
) |
bool set_default_collation | ( | HA_CREATE_INFO * | create_info, |
const CHARSET_INFO * | value | ||
) |
Do special checking for SHOW statements.
thd | Thread context. |
lex | LEX for SHOW statement. |
lock | If true, lock metadata for schema objects |
bool shutdown | ( | THD * | thd, |
enum mysql_enum_shutdown_level | level | ||
) |
Shutdown the mysqld server.
thd | Thread (session) context. |
level | Shutdown level. |
true | success |
false | When user has insufficient privilege or unsupported shutdown level |
bool sp_process_definer | ( | THD * | thd | ) |
bool sqlcom_can_generate_row_events | ( | enum enum_sql_command | command | ) |
void statement_id_to_session | ( | THD * | thd | ) |
bool stmt_causes_implicit_commit | ( | const THD * | thd, |
uint | mask | ||
) |
Returns whether the command in thd->lex->sql_command should cause an implicit commit.
An active transaction should be implicitly committed if the statement requires so.
thd | Thread handle. |
mask | Bitmask used for the SQL command match. |
true | This statement shall cause an implicit commit. |
false | This statement shall not cause an implicit commit. |
int test_if_data_home_dir | ( | const char * | dir | ) |
|
inline |
|
inline |
|
inline |
void trim_whitespace | ( | const CHARSET_INFO * | cs, |
LEX_STRING * | str | ||
) |
void turn_parser_debug_on | ( | ) |
|
static |
Validates a cast target type and extracts the specified length and precision of the target type.
Helper function for creating Items representing CAST expressions, and Items performing CAST-like tasks, such as JSON_VALUE.
thd | thread handler | |
arg | the value to cast | |
cast_type | the target type of the cast | |
as_array | true if the target type is an array type | |
[out] | length | gets set to the maximum length of the target type |
[out] | precision | gets set to the precision of the target type |
bool walk_join_list | ( | mem_root_deque< Table_ref * > & | list, |
std::function< bool(Table_ref *)> | action | ||
) |
|
extern |
|
static |
MySQL native functions.
MAINTAINER:
--without-XYZ
binary to fail with name collisions against a --with-XYZ
binary.grep | sort
easierThis can't be constexpr because
|
extern |
const size_t INITIAL_LEX_PLUGIN_LIST_SIZE = 16 |
|
constexpr |
|
static |
|
extern |
LEX_STRING constant for null-string to be used in parser and other places.
|
static |
|
static |
Singleton.
const LEX_CSTRING sp_data_access_name[] |
|
extern |
Mark all commands that somehow changes a table.
This is used to check number of updates / hour.
sql_command is actually set to SQLCOM_END sometimes so we need the +1 to include it in the array.
See COMMAND_FLAG_xxx for different type of commands 2 - query that returns meaningful ROW_COUNT() - a number of modified rows