MySQL  8.0.23
Source Code Documentation
sp.h
Go to the documentation of this file.
1 /* Copyright (c) 2002, 2020, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef _SP_H_
24 #define _SP_H_
25 
26 #include <stddef.h>
27 #include <sys/types.h>
28 #include <string>
29 
30 #include "field_types.h"
31 #include "lex_string.h"
32 #include "map_helpers.h"
33 #include "my_dbug.h"
34 #include "my_inttypes.h"
36 #include "sql/item.h" // Item::Type
37 #include "sql/sp_head.h" // Stored_program_creation_ctx
38 #include "sql/sql_lex.h"
39 
41 class Query_arena;
42 class THD;
43 struct CHARSET_INFO;
44 struct LEX_USER;
45 struct MEM_ROOT;
46 
47 namespace dd {
48 class Routine;
49 class Schema;
50 } // namespace dd
51 
52 class Field;
54 class String;
55 class sp_cache;
56 struct TABLE;
57 struct TABLE_LIST;
58 
60 template <typename T>
61 class SQL_I_List;
62 
63 enum class enum_sp_type;
64 
65 /* Tells what SP_DEFAULT_ACCESS should be mapped to */
66 #define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
67 
68 /* Tells what SP_IS_DEFAULT_SUID should be mapped to */
69 #define SP_DEFAULT_SUID_MAPPING SP_IS_SUID
70 
71 /* Max length(LONGBLOB field type length) of stored routine body */
72 static const uint MYSQL_STORED_ROUTINE_BODY_LENGTH = 4294967295U;
73 
74 /* Max length(TEXT field type length) of stored routine comment */
75 static const int MYSQL_STORED_ROUTINE_COMMENT_LENGTH = 65535;
76 
78  SP_OK = 0,
79 
80  // Schema does not exists
82 
83  // Routine does not exists
85 
86  // Routine already exists
88 
89  // Create routine failed
91 
92  // Drop routine failed
94 
95  // Routine load failed
97 
98  // Routine parse failed
100 
101  // Internal errors
103 };
104 
105 /*
106  Fields in mysql.proc table in 5.7. This enum is used to read and
107  update mysql.routines dictionary table during upgrade scenario.
108 
109  Note: This enum should not be used for other purpose
110  as it will be removed eventually.
111 */
112 enum {
134 };
135 
136 /*************************************************************************/
137 
138 /**
139  Stored_routine_creation_ctx -- creation context of stored routines
140  (stored procedures and functions).
141 */
142 
144  public:
146  const dd::Routine *routine);
147 
149  const sp_name *name,
150  TABLE *proc_tbl);
151 
152  public:
154 
155  protected:
156  Object_creation_ctx *create_backup_ctx(THD *thd) const override;
157  void delete_backup_ctx() override;
158 
159  private:
162 
164  const CHARSET_INFO *connection_cl,
165  const CHARSET_INFO *db_cl)
166  : Stored_program_creation_ctx(client_cs, connection_cl, db_cl) {}
167 };
168 
169 /* Drop all routines in database 'db' */
171 
172 /**
173  Acquires exclusive metadata lock on all stored routines in the
174  given database.
175 
176  @param thd Thread handler
177  @param schema Schema object
178 
179  @retval false Success
180  @retval true Failure
181  */
182 bool lock_db_routines(THD *thd, const dd::Schema &schema);
183 
185  sp_cache **cp, bool cache_only);
186 
188  sp_cache **cp);
189 
191  bool lookup_only, sp_head **sp);
192 
194  const sp_name *name, bool lookup_only,
195  sp_head **sp);
196 
197 bool sp_exist_routines(THD *thd, TABLE_LIST *procs, bool is_proc);
198 
200 
202  THD *thd, enum_sp_type type, const char *sp_db, size_t sp_db_len,
203  const char *sp_name, size_t sp_name_len, sp_head **sphp,
204  sql_mode_t sql_mode, const char *params, const char *returns,
205  const char *body, st_sp_chistics *chistics, const char *definer_user,
206  const char *definer_host, longlong created, longlong modified,
207  Stored_program_creation_ctx *creation_ctx);
208 
209 bool sp_create_routine(THD *thd, sp_head *sp, const LEX_USER *definer);
210 
212  st_sp_chistics *chistics);
213 
215 
216 /**
217  Structure that represents element in the set of stored routines
218  used by statement or routine.
219 */
220 
222  public:
223  /**
224  Key identifying routine or other object added to the set.
225 
226  Key format: "@<1-byte entry type@>@<db name@>\0@<routine/object name@>\0".
227 
228  @note We use binary comparison for these keys as the @<db name@> component
229  requires case-sensitive comparison on --lower-case-table-names=0
230  systems. On systems where --lower-case-table-names > 0 database
231  names which passed to functions working with this set are already
232  lowercased. So binary comparison is equivalent to case-insensitive
233  comparison for them.
234  Routine names are case and accent insensitive. To achieve such
235  comparison we normalize routine names by converting their characters
236  to their sort weights (according to case and accent insensitive
237  collation). In this case, the actual routine name is also stored in
238  the member m_object_name.
239 
240  @note For Foreign Key objects, '@<db name@>\0@<object name@>\0' part of the
241  key is compatible with keys used by MDL. So one can easily construct
242  MDL_key from this key.
243  */
244  char *m_key;
248 
249  enum entry_type {
253  /**
254  Parent table in a foreign key on which child table there was insert
255  or update. We will lookup new values in parent, so need to acquire
256  SR lock on it.
257  */
259  /**
260  Child table in a foreign key with RESTRICT/NO ACTION as corresponding
261  rule and on which parent table there was delete or update.
262  We will check if old parent key is referenced by child table,
263  so need to acquire SR lock on it.
264  */
266  /**
267  Child table in a foreign key with CASCADE/SET NULL/SET DEFAULT as
268  'on update' rule, on which parent there was update, or with SET NULL/
269  SET DEFAULT as 'on delete' rule, on which parent there was delete.
270  We might need to update rows in child table, so we need to acquire
271  SW lock on it. We also need to take into account that child table
272  might be parent for some other FKs, so such update needs
273  to be handled recursively.
274  */
276  /**
277  Child table in a foreign key with CASCADE as 'on delete' rule for
278  which there was delete from the parent table.
279  We might need to delete rows from the child table, so we need to
280  acquire SW lock on it.
281  We also need to take into account that child table might be parent
282  for some other FKs, so such delete needs to be handled recursively
283  (and even might result in updates).
284  */
286  };
287 
288  entry_type type() const { return (entry_type)m_key[0]; }
289  const char *db() const { return (char *)m_key + 1; }
290  size_t db_length() const { return m_db_length; }
291  const char *name() const {
293  : (char *)m_key + 1 + m_db_length + 1;
294  }
295  size_t name_length() const {
297  : m_key_length - 1U - m_db_length - 1U - 1U;
298  }
299  bool use_normalized_key() const {
300  return (type() == FUNCTION || type() == PROCEDURE || type() == TRIGGER);
301  }
302 
303  const char *part_mdl_key() {
305  return (char *)m_key + 1;
306  }
309  return m_key_length - 1U;
310  }
311 
312  /**
313  Next element in list linking all routines in set. See also comments
314  for LEX::sroutine/sroutine_list and sp_head::m_sroutines.
315  */
317  /**
318  Uppermost view which directly or indirectly uses this routine.
319  0 if routine is not used in view. Note that it also can be 0 if
320  statement uses routine both via view and directly.
321  */
323  /**
324  This is for prepared statement validation purposes.
325  A statement looks up and pre-loads all its stored functions
326  at prepare. Later on, if a function is gone from the cache,
327  execute may fail. Similarly, tables involved in referential
328  constraints are also prelocked.
329  Remember the version of the cached item at prepare to be able to
330  invalidate the prepared statement at execute if it
331  changes.
332  */
334 };
335 
336 /*
337  Enum to indicate SP name normalization required when constructing a key
338  in sp_add_used_routine method.
339 */
341  LEAVE_AS_IS = 0, // No normalization needed.
342  LOWERCASE_NAME, // Lower case SP name.
343  UNACCENT_AND_LOWERCASE_NAME, // Lower case SP name and remove accent.
344 };
345 
346 /*
347  Procedures for handling sets of stored routines used by statement or routine.
348 */
349 bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
350  Sroutine_hash_entry::entry_type type, const char *db,
351  size_t db_length, const char *name, size_t name_length,
352  bool lowercase_db,
353  Sp_name_normalize_type name_normalize_type,
354  bool own_routine, TABLE_LIST *belong_to_view);
355 
356 /**
357  Convenience wrapper around sp_add_used_routine() for most common case -
358  stored procedure or function which are explicitly used by the statement.
359 */
360 
361 inline bool sp_add_own_used_routine(Query_tables_list *prelocking_ctx,
362  Query_arena *arena,
364  sp_name *sp_name) {
367 
368  return sp_add_used_routine(
369  prelocking_ctx, arena, type, sp_name->m_db.str, sp_name->m_db.length,
372 }
373 
374 void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx);
376  THD *thd, Query_tables_list *prelocking_ctx,
378  TABLE_LIST *belong_to_view);
379 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
381  TABLE_LIST *belong_to_view);
382 
383 const uchar *sp_sroutine_key(const uchar *ptr, size_t *plen);
384 
386  const dd::Routine *routine,
387  bool *free_sp_head);
388 
389 bool load_charset(MEM_ROOT *mem_root, Field *field, const CHARSET_INFO *dflt_cs,
390  const CHARSET_INFO **cs);
391 
392 bool load_collation(MEM_ROOT *mem_root, Field *field,
393  const CHARSET_INFO *dflt_cl, const CHARSET_INFO **cl);
394 
395 ///////////////////////////////////////////////////////////////////////////
396 
398 
399 void sp_finish_parsing(THD *thd);
400 
401 ///////////////////////////////////////////////////////////////////////////
402 
406 
407 bool sp_check_name(LEX_STRING *ident);
408 
409 TABLE_LIST *sp_add_to_query_tables(THD *thd, LEX *lex, const char *db,
410  const char *name);
411 
412 Item *sp_prepare_func_item(THD *thd, Item **it_addr);
413 
414 bool sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr);
415 
416 String *sp_get_item_value(THD *thd, Item *item, String *str);
417 
418 ///////////////////////////////////////////////////////////////////////////
419 
420 #endif /* _SP_H_ */
Sroutine_hash_entry
Structure that represents element in the set of stored routines used by statement or routine.
Definition: sp.h:221
sp_cache
Definition: sp_cache.cc:41
Stored_routine_creation_ctx::create_backup_ctx
Object_creation_ctx * create_backup_ctx(THD *thd) const override
Definition: sp.cc:248
MYSQL_LEX_CSTRING
Definition: mysql_lex_string.h:39
Item
Definition: item.h:775
malloc_unordered_map< std::string, Sroutine_hash_entry * >
THD
Definition: sql_class.h:807
Sroutine_hash_entry::m_key_length
uint16 m_key_length
Definition: sp.h:246
MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT
@ MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT
Definition: sp.h:129
sp_load_for_information_schema
sp_head * sp_load_for_information_schema(THD *thd, LEX_CSTRING db_name, const dd::Routine *routine, bool *free_sp_head)
The function loads sp_head struct for information schema purposes (used for I_S ROUTINES & PARAMETERS...
Definition: sp.cc:2027
field_types.h
This file contains the field type.
Stored_routine_creation_ctx
Stored_routine_creation_ctx – creation context of stored routines (stored procedures and functions).
Definition: sp.h:143
sp_create_routine
bool sp_create_routine(THD *thd, sp_head *sp, const LEX_USER *definer)
Creates a stored routine.
Definition: sp.cc:708
Sp_name_normalize_type::LOWERCASE_NAME
@ LOWERCASE_NAME
dd::Schema
Definition: schema.h:62
sp_head
sp_head represents one instance of a stored program.
Definition: sp_head.h:379
MYSQL_PROC_FIELD_BODY_UTF8
@ MYSQL_PROC_FIELD_BODY_UTF8
Definition: sp.h:132
MYSQL_PROC_FIELD_SECURITY_TYPE
@ MYSQL_PROC_FIELD_SECURITY_TYPE
Definition: sp.h:120
sp_exist_routines
bool sp_exist_routines(THD *thd, TABLE_LIST *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:1527
MYSQL_PROC_FIELD_DB
@ MYSQL_PROC_FIELD_DB
Definition: sp.h:113
load_charset
bool load_charset(MEM_ROOT *mem_root, Field *field, const CHARSET_INFO *dflt_cs, const CHARSET_INFO **cs)
Definition: sp.cc:119
Stored_routine_creation_ctx::delete_backup_ctx
void delete_backup_ctx() override
Definition: sp.cc:254
sp_map_result_type
Item_result sp_map_result_type(enum enum_field_types type)
Definition: sp.cc:2163
sql_lex.h
SP_DOES_NOT_EXISTS
@ SP_DOES_NOT_EXISTS
Definition: sp.h:84
CHARSET_INFO
Definition: m_ctype.h:354
sp_setup_routine
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:1446
Sroutine_hash_entry::m_db_length
uint16 m_db_length
Definition: sp.h:247
MYSQL_LEX_CSTRING::length
size_t length
Definition: mysql_lex_string.h:41
sp_remove_not_own_routines
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:1759
my_dbug.h
sp_show_create_routine
bool sp_show_create_routine(THD *thd, enum_sp_type type, sp_name *name)
Implement SHOW CREATE statement for stored routines.
Definition: sp.cc:1347
String
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:164
sp_add_own_used_routine
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:361
TABLE
Definition: table.h:1364
Item::Type
Type
Definition: item.h:811
longlong
long long int longlong
Definition: my_inttypes.h:54
MYSQL_PROC_MYSQL_TYPE
@ MYSQL_PROC_MYSQL_TYPE
Definition: sp.h:115
sql_mode_t
ulonglong sql_mode_t
Definition: sp.h:57
enum_sp_type
enum_sp_type
enum_sp_type defines type codes of stored programs.
Definition: sql_lex.h:218
sql_mode
static const char * sql_mode
Definition: mysqlslap.cc:194
MYSQL_PROC_FIELD_ACCESS
@ MYSQL_PROC_FIELD_ACCESS
Definition: sp.h:118
Sroutine_hash_entry::FK_TABLE_ROLE_CHILD_DELETE
@ 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:285
MYSQL_PROC_FIELD_COLLATION_CONNECTION
@ MYSQL_PROC_FIELD_COLLATION_CONNECTION
Definition: sp.h:130
mem_root
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
sp_finish_parsing
void sp_finish_parsing(THD *thd)
Finish parsing of a stored program.
Definition: sp.cc:2152
Sroutine_hash_entry::db
const char * db() const
Definition: sp.h:289
sp_get_flags_for_command
uint sp_get_flags_for_command(LEX *lex)
Definition: sp.cc:2215
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:40
name
case opt name
Definition: sslopt-case.h:32
Stored_routine_creation_ctx::Stored_routine_creation_ctx
Stored_routine_creation_ctx(THD *thd)
Definition: sp.h:160
LEX_USER
Definition: table.h:2433
U
#define U
Definition: ctype-tis620.cc:74
Sroutine_hash_entry::belong_to_view
TABLE_LIST * belong_to_view
Uppermost view which directly or indirectly uses this routine.
Definition: sp.h:322
sp_drop_routine
enum_sp_return_code sp_drop_routine(THD *thd, enum_sp_type type, sp_name *name)
Drops a stored routine.
Definition: sp.cc:842
sp_cache_routine
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:1834
Item_result
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:38
Sroutine_hash_entry::m_object_name
LEX_CSTRING m_object_name
Definition: sp.h:245
Sroutine_hash_entry::FK_TABLE_ROLE_CHILD_CHECK
@ 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:265
sp_map_item_type
Item::Type sp_map_item_type(enum enum_field_types type)
Definition: sp.cc:2185
sp_sroutine_key
const uchar * sp_sroutine_key(const uchar *ptr, size_t *plen)
Object_creation_ctx
Object_creation_ctx – interface for creation context of database objects (views, stored routines,...
Definition: table.h:187
int64
int64_t int64
Definition: my_inttypes.h:67
Stored_routine_creation_ctx::Stored_routine_creation_ctx
Stored_routine_creation_ctx(const CHARSET_INFO *client_cs, const CHARSET_INFO *connection_cl, const CHARSET_INFO *db_cl)
Definition: sp.h:163
MYSQL_PROC_FIELD_DB_COLLATION
@ MYSQL_PROC_FIELD_DB_COLLATION
Definition: sp.h:131
sp_name
Definition: sp_head.h:119
U
Definition: dtoa.cc:601
my_inttypes.h
Query_tables_list
Definition: sql_lex.h:2422
Sroutine_hash_entry::TRIGGER
@ TRIGGER
Definition: sp.h:252
sp_name::m_db
LEX_CSTRING m_db
Definition: sp_head.h:121
Sroutine_hash_entry::entry_type
entry_type
Definition: sp.h:249
Stored_routine_creation_ctx::clone
Stored_program_creation_ctx * clone(MEM_ROOT *mem_root) override
Definition: sp.cc:242
MYSQL_PROC_FIELD_MODIFIED
@ MYSQL_PROC_FIELD_MODIFIED
Definition: sp.h:126
SP_DROP_FAILED
@ SP_DROP_FAILED
Definition: sp.h:93
MEM_ROOT
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
lex_string.h
sp_start_parsing
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:2113
sp_update_routine
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:973
cs
Definition: commit_order_queue.h:33
enum_field_types
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
SP_LOAD_FAILED
@ SP_LOAD_FAILED
Definition: sp.h:96
MYSQL_PROC_FIELD_PARAM_LIST
@ MYSQL_PROC_FIELD_PARAM_LIST
Definition: sp.h:121
uint
unsigned int uint
Definition: uca-dump.cc:29
Sroutine_hash_entry::name
const char * name() const
Definition: sp.h:291
map_helpers.h
sp_update_stmt_used_routines
void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, malloc_unordered_map< std::string, Sroutine_hash_entry * > *src, TABLE_LIST *belong_to_view)
Add contents of hash representing set of routines to the set of routines used by statement.
Definition: sp.cc:1792
TABLE_LIST
Definition: table.h:2541
MYSQL_PROC_FIELD_NAME
@ MYSQL_PROC_FIELD_NAME
Definition: sp.h:114
SP_NO_DB_ERROR
@ SP_NO_DB_ERROR
Definition: sp.h:81
Sroutine_hash_entry::type
entry_type type() const
Definition: sp.h:288
sp_eval_expr
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:2437
Query_arena
Definition: sql_class.h:226
MYSQL_PROC_FIELD_DETERMINISTIC
@ MYSQL_PROC_FIELD_DETERMINISTIC
Definition: sp.h:119
Sroutine_hash_entry::m_cache_version
int64 m_cache_version
This is for prepared statement validation purposes.
Definition: sp.h:333
MYSQL_PROC_FIELD_SQL_MODE
@ MYSQL_PROC_FIELD_SQL_MODE
Definition: sp.h:127
uchar
unsigned char uchar
Definition: my_inttypes.h:51
MYSQL_STORED_ROUTINE_BODY_LENGTH
static const uint MYSQL_STORED_ROUTINE_BODY_LENGTH
Definition: sp.h:72
Sroutine_hash_entry::FK_TABLE_ROLE_PARENT_CHECK
@ FK_TABLE_ROLE_PARENT_CHECK
Parent table in a foreign key on which child table there was insert or update.
Definition: sp.h:258
enum_sp_return_code
enum_sp_return_code
Definition: sp.h:77
Sp_name_normalize_type::UNACCENT_AND_LOWERCASE_NAME
@ UNACCENT_AND_LOWERCASE_NAME
MYSQL_PROC_FIELD_DEFINER
@ MYSQL_PROC_FIELD_DEFINER
Definition: sp.h:124
Sroutine_hash_entry::use_normalized_key
bool use_normalized_key() const
Definition: sp.h:299
Sroutine_hash_entry::part_mdl_key
const char * part_mdl_key()
Definition: sp.h:303
SP_INTERNAL_ERROR
@ SP_INTERNAL_ERROR
Definition: sp.h:102
sp_add_used_routine
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_LIST *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:1665
MYSQL_PROC_FIELD_LANGUAGE
@ MYSQL_PROC_FIELD_LANGUAGE
Definition: sp.h:117
sp_get_item_value
String * sp_get_item_value(THD *thd, Item *item, String *str)
Return a string representation of the Item value.
Definition: sp.cc:2505
sp_find_routine
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:1411
Sroutine_hash_entry::db_length
size_t db_length() const
Definition: sp.h:290
Stored_routine_creation_ctx::create_routine_creation_ctx
static Stored_routine_creation_ctx * create_routine_creation_ctx(const dd::Routine *routine)
Definition: sp.cc:164
sp_add_to_query_tables
TABLE_LIST * sp_add_to_query_tables(THD *thd, LEX *lex, const char *db, const char *name)
sql_mode_t
ulonglong sql_mode_t
Definition: dd_event.h:36
sp_check_name
bool sp_check_name(LEX_STRING *ident)
Check that the name 'ident' is ok.
Definition: sp.cc:2374
SP_ALREADY_EXISTS
@ SP_ALREADY_EXISTS
Definition: sp.h:87
load_collation
bool load_collation(MEM_ROOT *mem_root, Field *field, const CHARSET_INFO *dflt_cl, const CHARSET_INFO **cl)
Definition: sp.cc:140
lock_db_routines
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:1086
MYSQL_STORED_ROUTINE_COMMENT_LENGTH
static const int MYSQL_STORED_ROUTINE_COMMENT_LENGTH
Definition: sp.h:75
MYSQL_LEX_STRING
Definition: mysql_lex_string.h:34
Sroutine_hash_entry::FUNCTION
@ FUNCTION
Definition: sp.h:250
LEX
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3618
Sp_name_normalize_type::LEAVE_AS_IS
@ LEAVE_AS_IS
DBUG_ASSERT
#define DBUG_ASSERT(A)
Definition: my_dbug.h:199
MYSQL_PROC_FIELD_COUNT
@ MYSQL_PROC_FIELD_COUNT
Definition: sp.h:133
sp_head.h
sp_prepare_func_item
Item * sp_prepare_func_item(THD *thd, Item **it_addr)
Prepare an Item for evaluation (call of fix_fields).
Definition: sp.cc:2403
Sroutine_hash_entry::part_mdl_key_length
size_t part_mdl_key_length()
Definition: sp.h:307
MYSQL_PROC_FIELD_RETURNS
@ MYSQL_PROC_FIELD_RETURNS
Definition: sp.h:122
Sroutine_hash_entry::name_length
size_t name_length() const
Definition: sp.h:295
SP_PARSE_ERROR
@ SP_PARSE_ERROR
Definition: sp.h:99
Sp_name_normalize_type
Sp_name_normalize_type
Definition: sp.h:340
rules_table_service::db_name
const char * db_name
Definition: rules_table_service.cc:54
dd::Routine
Abstract base class for functions and procedures.
Definition: routine.h:60
sp_drop_db_routines
enum_sp_return_code sp_drop_db_routines(THD *thd, const dd::Schema &schema)
Drop all routines in database 'db'.
Definition: sp.cc:1142
sp_name::m_name
LEX_STRING m_name
Definition: sp_head.h:122
uint16
uint16_t uint16
Definition: my_inttypes.h:64
Sroutine_hash_entry::FK_TABLE_ROLE_CHILD_UPDATE
@ FK_TABLE_ROLE_CHILD_UPDATE
Child table in a foreign key with CASCADE/SET NULL/SET DEFAULT as 'on update' rule,...
Definition: sp.h:275
Sroutine_hash_entry::m_key
char * m_key
Key identifying routine or other object added to the set.
Definition: sp.h:244
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
db_load_routine
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:498
Sroutine_hash_entry::next
Sroutine_hash_entry * next
Next element in list linking all routines in set.
Definition: sp.h:316
MYSQL_LEX_STRING::str
char * str
Definition: mysql_lex_string.h:35
MYSQL_LEX_CSTRING::str
const char * str
Definition: mysql_lex_string.h:40
Field
Definition: field.h:568
Stored_program_creation_ctx
Stored_program_creation_ctx – base class for creation context of stored programs (stored routines,...
Definition: sp_head.h:88
udf_registration_types.h
MYSQL_LEX_STRING::length
size_t length
Definition: mysql_lex_string.h:36
MYSQL_PROC_FIELD_BODY
@ MYSQL_PROC_FIELD_BODY
Definition: sp.h:123
MYSQL_PROC_FIELD_COMMENT
@ MYSQL_PROC_FIELD_COMMENT
Definition: sp.h:128
binary_log::transaction::compression::type
type
Definition: base.h:36
Sroutine_hash_entry::PROCEDURE
@ PROCEDURE
Definition: sp.h:251
Stored_routine_creation_ctx::load_from_db
static Stored_routine_creation_ctx * load_from_db(THD *thd, const sp_name *name, TABLE *proc_tbl)
Definition: sp.cc:185
SQL_I_List
Simple intrusive linked list.
Definition: sp.h:61
MYSQL_PROC_FIELD_CREATED
@ MYSQL_PROC_FIELD_CREATED
Definition: sp.h:125
SP_STORE_FAILED
@ SP_STORE_FAILED
Definition: sp.h:90
st_sp_chistics
Definition: sql_lex.h:2379
SP_OK
@ SP_OK
Definition: sp.h:78
MYSQL_PROC_FIELD_SPECIFIC_NAME
@ MYSQL_PROC_FIELD_SPECIFIC_NAME
Definition: sp.h:116
item.h