68#define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
71#define SP_DEFAULT_SUID_MAPPING SP_IS_SUID
193 bool lookup_only,
sp_head **sp);
207 const char *body,
st_sp_chistics *chistics,
const char *definer_user,
212 bool if_not_exists,
bool &sp_already_exists);
292 const char *
db()
const {
return (
char *)
m_key + 1; }
308 return (
char *)
m_key + 1;
354 size_t db_length,
const char *
name,
size_t name_length,
357 bool own_routine,
Table_ref *belong_to_view);
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Type
Definition: item.h:889
Object_creation_ctx – interface for creation context of database objects (views, stored routines,...
Definition: table.h:197
Definition: sql_class.h:343
Definition: sql_lex.h:2507
Simple intrusive linked list.
Definition: sql_list.h:46
Structure that represents element in the set of stored routines used by statement or routine.
Definition: sp.h:224
bool use_normalized_key() const
Definition: sp.h:302
entry_type type() const
Definition: sp.h:291
LEX_CSTRING m_object_name
Definition: sp.h:248
Table_ref * belong_to_view
Uppermost view which directly or indirectly uses this routine.
Definition: sp.h:325
Sroutine_hash_entry * next
Next element in list linking all routines in set.
Definition: sp.h:319
int64 m_cache_version
This is for prepared statement validation purposes.
Definition: sp.h:336
uint16 m_db_length
Definition: sp.h:250
const char * name() const
Definition: sp.h:294
const char * db() const
Definition: sp.h:292
size_t part_mdl_key_length()
Definition: sp.h:310
char * m_key
Key identifying routine or other object added to the set.
Definition: sp.h:247
entry_type
Definition: sp.h:252
@ FUNCTION
Definition: sp.h:253
@ FK_TABLE_ROLE_CHILD_UPDATE
Child table in a foreign key with CASCADE/SET NULL/SET DEFAULT as 'on update' rule,...
Definition: sp.h:278
@ FK_TABLE_ROLE_CHILD_DELETE
Child table in a foreign key with CASCADE as 'on delete' rule for which there was delete from the par...
Definition: sp.h:288
@ FK_TABLE_ROLE_PARENT_CHECK
Parent table in a foreign key on which child table there was insert or update.
Definition: sp.h:261
@ TRIGGER
Definition: sp.h:255
@ PROCEDURE
Definition: sp.h:254
@ FK_TABLE_ROLE_CHILD_CHECK
Child table in a foreign key with RESTRICT/NO ACTION as corresponding rule and on which parent table ...
Definition: sp.h:268
const char * part_mdl_key()
Definition: sp.h:306
uint16 m_key_length
Definition: sp.h:249
size_t db_length() const
Definition: sp.h:293
size_t name_length() const
Definition: sp.h:298
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines,...
Definition: sp_head.h:89
Stored_routine_creation_ctx – creation context of stored routines (stored procedures and functions).
Definition: sp.h:145
Object_creation_ctx * create_backup_ctx(THD *thd) const override
Definition: sp.cc:248
static Stored_routine_creation_ctx * load_from_db(THD *thd, const sp_name *name, TABLE *proc_tbl)
Definition: sp.cc:185
static Stored_routine_creation_ctx * create_routine_creation_ctx(const dd::Routine *routine)
Definition: sp.cc:164
Stored_routine_creation_ctx(const CHARSET_INFO *client_cs, const CHARSET_INFO *connection_cl, const CHARSET_INFO *db_cl)
Definition: sp.h:165
Stored_program_creation_ctx * clone(MEM_ROOT *mem_root) override
Definition: sp.cc:242
void delete_backup_ctx() override
Definition: sp.cc:254
Stored_routine_creation_ctx(THD *thd)
Definition: sp.h:162
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Abstract base class for functions and procedures.
Definition: routine.h:61
std::unordered_map, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:148
Definition: sp_cache.cc:42
sp_head represents one instance of a stored program.
Definition: sp_head.h:380
Definition: sp_head.h:120
LEX_STRING m_name
Definition: sp_head.h:123
LEX_CSTRING m_db
Definition: sp_head.h:122
static MEM_ROOT mem_root
Definition: client_plugin.cc:110
ulonglong sql_mode_t
Definition: dd_event.h:37
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:53
enum_sp_type
enum_sp_type defines type codes of stored programs.
Definition: sql_lex.h:222
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
int64_t int64
Definition: my_inttypes.h:68
long long int longlong
Definition: my_inttypes.h:55
uint16_t uint16
Definition: my_inttypes.h:65
static const char * sql_mode
Definition: mysqlslap.cc:197
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
borrowable::session_track::Schema< true > Schema
Definition: classic_protocol_session_track.h:277
Definition: commit_order_queue.h:34
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
required string type
Definition: replication_group_member_actions.proto:34
Item_result sp_map_result_type(enum enum_field_types type)
Definition: sp.cc:2201
bool sp_check_name(LEX_STRING *ident)
Check that the name 'ident' is ok.
Definition: sp.cc:2413
bool sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
Evaluate an expression and store the result in the field.
Definition: sp.cc:2476
Table_ref * sp_add_to_query_tables(THD *thd, LEX *lex, const char *db, const char *name)
enum_sp_return_code sp_drop_routine(THD *thd, enum_sp_type type, sp_name *name)
Drops a stored routine.
Definition: sp.cc:927
ulonglong sql_mode_t
Definition: sp.h:59
void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, malloc_unordered_map< std::string, Sroutine_hash_entry * > *src, Table_ref *belong_to_view)
Add contents of hash representing set of routines to the set of routines used by statement.
Definition: sp.cc:1918
sp_head * sp_setup_routine(THD *thd, enum_sp_type type, sp_name *name, sp_cache **cp)
Setup a cached routine for execution.
Definition: sp.cc:1572
void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx)
Remove routines which are only indirectly used by statement from the set of routines used by this sta...
Definition: sp.cc:1885
Sp_name_normalize_type
Definition: sp.h:343
@ UNACCENT_AND_LOWERCASE_NAME
uint sp_get_flags_for_command(LEX *lex)
Definition: sp.cc:2253
bool load_charset(MEM_ROOT *mem_root, Field *field, const CHARSET_INFO *dflt_cs, const CHARSET_INFO **cs)
Definition: sp.cc:119
sp_head * sp_start_parsing(THD *thd, enum_sp_type sp_type, sp_name *sp_name)
Start parsing of a stored program.
Definition: sp.cc:2154
bool sp_show_create_routine(THD *thd, enum_sp_type type, sp_name *name)
Implement SHOW CREATE statement for stored routines.
Definition: sp.cc:1474
bool sp_create_routine(THD *thd, sp_head *sp, const LEX_USER *definer, bool if_not_exists, bool &sp_already_exists)
Creates a stored routine.
Definition: sp.cc:796
String * sp_get_item_value(THD *thd, Item *item, String *str)
Return a string representation of the Item value.
Definition: sp.cc:2544
Item * sp_prepare_func_item(THD *thd, Item **it_addr)
Prepare an Item for evaluation (call of fix_fields).
Definition: sp.cc:2442
bool lock_db_routines(THD *thd, const dd::Schema &schema)
Acquires exclusive metadata lock on all stored routines in the given database.
Definition: sp.cc:1180
Item::Type sp_map_item_type(enum enum_field_types type)
Definition: sp.cc:2223
enum_sp_return_code
Definition: sp.h:79
@ SP_ALREADY_EXISTS
Definition: sp.h:89
@ SP_INTERNAL_ERROR
Definition: sp.h:104
@ SP_NO_DB_ERROR
Definition: sp.h:83
@ SP_LOAD_FAILED
Definition: sp.h:98
@ SP_PARSE_ERROR
Definition: sp.h:101
@ SP_DOES_NOT_EXISTS
Definition: sp.h:86
@ SP_DROP_FAILED
Definition: sp.h:95
@ SP_STORE_FAILED
Definition: sp.h:92
@ SP_OK
Definition: sp.h:80
static const uint MYSQL_STORED_ROUTINE_BODY_LENGTH
Definition: sp.h:74
bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, Sroutine_hash_entry::entry_type type, const char *db, size_t db_length, const char *name, size_t name_length, bool lowercase_db, Sp_name_normalize_type name_normalize_type, bool own_routine, Table_ref *belong_to_view)
Add routine or trigger which is used by statement to the set of stored routines used by this statemen...
Definition: sp.cc:1791
bool sp_drop_db_routines(THD *thd, const dd::Schema &schema)
Drop all routines in database 'db'.
Definition: sp.cc:1244
bool sp_update_routine(THD *thd, enum_sp_type type, sp_name *name, st_sp_chistics *chistics)
Updates(Alter) a stored routine.
Definition: sp.cc:1057
bool sp_exist_routines(THD *thd, Table_ref *procs, bool is_proc)
This is used by sql_acl.cc:mysql_routine_grant() and is used to find the routines in 'routines'.
Definition: sp.cc:1653
enum_sp_return_code sp_cache_routine(THD *thd, Sroutine_hash_entry *rt, bool lookup_only, sp_head **sp)
A helper wrapper around sp_cache_routine() to use from prelocking until 'sp_name' is eradicated as a ...
Definition: sp.cc:1960
enum_sp_return_code db_load_routine(THD *thd, enum_sp_type type, const char *sp_db, size_t sp_db_len, const char *sp_name, size_t sp_name_len, sp_head **sphp, sql_mode_t sql_mode, const char *params, const char *returns, const char *body, st_sp_chistics *chistics, const char *definer_user, const char *definer_host, longlong created, longlong modified, Stored_program_creation_ctx *creation_ctx)
Definition: sp.cc:497
bool sp_add_own_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, Sroutine_hash_entry::entry_type type, sp_name *sp_name)
Convenience wrapper around sp_add_used_routine() for most common case - stored procedure or function ...
Definition: sp.h:364
void sp_finish_parsing(THD *thd)
Finish parsing of a stored program.
Definition: sp.cc:2190
bool load_collation(MEM_ROOT *mem_root, Field *field, const CHARSET_INFO *dflt_cl, const CHARSET_INFO **cl)
Definition: sp.cc:140
const uchar * sp_sroutine_key(const uchar *ptr, size_t *plen)
@ MYSQL_PROC_FIELD_PARAM_LIST
Definition: sp.h:123
@ MYSQL_PROC_FIELD_DETERMINISTIC
Definition: sp.h:121
@ MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT
Definition: sp.h:131
@ MYSQL_PROC_FIELD_RETURNS
Definition: sp.h:124
@ MYSQL_PROC_FIELD_SECURITY_TYPE
Definition: sp.h:122
@ MYSQL_PROC_FIELD_NAME
Definition: sp.h:116
@ MYSQL_PROC_FIELD_COUNT
Definition: sp.h:135
@ MYSQL_PROC_FIELD_LANGUAGE
Definition: sp.h:119
@ MYSQL_PROC_MYSQL_TYPE
Definition: sp.h:117
@ MYSQL_PROC_FIELD_SPECIFIC_NAME
Definition: sp.h:118
@ MYSQL_PROC_FIELD_COMMENT
Definition: sp.h:130
@ MYSQL_PROC_FIELD_SQL_MODE
Definition: sp.h:129
@ MYSQL_PROC_FIELD_DB_COLLATION
Definition: sp.h:133
@ MYSQL_PROC_FIELD_BODY
Definition: sp.h:125
@ MYSQL_PROC_FIELD_CREATED
Definition: sp.h:127
@ MYSQL_PROC_FIELD_ACCESS
Definition: sp.h:120
@ MYSQL_PROC_FIELD_COLLATION_CONNECTION
Definition: sp.h:132
@ MYSQL_PROC_FIELD_DB
Definition: sp.h:115
@ MYSQL_PROC_FIELD_MODIFIED
Definition: sp.h:128
@ MYSQL_PROC_FIELD_BODY_UTF8
Definition: sp.h:134
@ MYSQL_PROC_FIELD_DEFINER
Definition: sp.h:126
static const int MYSQL_STORED_ROUTINE_COMMENT_LENGTH
Definition: sp.h:77
sp_head * sp_find_routine(THD *thd, enum_sp_type type, sp_name *name, sp_cache **cp, bool cache_only)
Obtain object representing stored procedure/function by its name from stored procedures cache and loo...
Definition: sp.cc:1537
case opt name
Definition: sslopt-case.h:33
Definition: m_ctype.h:385
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3710
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Definition: mysql_lex_string.h:35
char * str
Definition: mysql_lex_string.h:36
size_t length
Definition: mysql_lex_string.h:37
Definition: sql_lex.h:2466
unsigned int uint
Definition: uca9-dump.cc:75
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39