19 #include "sql_string.h"
24 class Open_tables_backup;
25 class Open_tables_state;
27 class Query_tables_list;
31 struct st_sp_chistics;
40 #define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
44 #define SP_KEY_NOT_FOUND -1
45 #define SP_OPEN_TABLE_FAILED -2
46 #define SP_WRITE_ROW_FAILED -3
47 #define SP_DELETE_ROW_FAILED -4
48 #define SP_GET_FIELD_FAILED -5
49 #define SP_PARSE_ERROR -6
50 #define SP_INTERNAL_ERROR -7
51 #define SP_NO_DB_ERROR -8
52 #define SP_BAD_IDENTIFIER -9
53 #define SP_BODY_TOO_LONG -10
54 #define SP_FLD_STORE_FAILED -11
59 MYSQL_PROC_FIELD_DB = 0,
60 MYSQL_PROC_FIELD_NAME,
61 MYSQL_PROC_MYSQL_TYPE,
62 MYSQL_PROC_FIELD_SPECIFIC_NAME,
63 MYSQL_PROC_FIELD_LANGUAGE,
64 MYSQL_PROC_FIELD_ACCESS,
65 MYSQL_PROC_FIELD_DETERMINISTIC,
66 MYSQL_PROC_FIELD_SECURITY_TYPE,
67 MYSQL_PROC_FIELD_PARAM_LIST,
68 MYSQL_PROC_FIELD_RETURNS,
69 MYSQL_PROC_FIELD_BODY,
70 MYSQL_PROC_FIELD_DEFINER,
71 MYSQL_PROC_FIELD_CREATED,
72 MYSQL_PROC_FIELD_MODIFIED,
73 MYSQL_PROC_FIELD_SQL_MODE,
74 MYSQL_PROC_FIELD_COMMENT,
75 MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT,
76 MYSQL_PROC_FIELD_COLLATION_CONNECTION,
77 MYSQL_PROC_FIELD_DB_COLLATION,
78 MYSQL_PROC_FIELD_BODY_UTF8,
79 MYSQL_PROC_FIELD_COUNT
83 int sp_drop_db_routines(THD *thd,
char *db);
95 bool lock_db_routines(THD *thd,
char *db);
101 bool lookup_only,
sp_head **sp);
104 bool lookup_only,
sp_head **sp);
106 bool sp_exist_routines(THD *thd,
TABLE_LIST *procs,
bool is_proc);
108 bool sp_show_create_routine(THD *thd, enum_sp_type
type,
sp_name *
name);
110 int sp_create_routine(THD *thd,
sp_head *sp);
113 st_sp_chistics *chistics);
158 void sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
159 sp_name *rt, enum_sp_type rt_type);
160 bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena,
162 void sp_remove_not_own_routines(Query_tables_list *prelocking_ctx);
163 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
165 void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx,
169 extern "C" uchar* sp_sroutine_key(
const uchar *ptr,
size_t *plen,
176 TABLE *open_proc_table_for_read(THD *thd, Open_tables_backup *backup);
181 const char *returns,
const char *params,
184 bool load_charset(
MEM_ROOT *mem_root,
189 bool load_collation(
MEM_ROOT *mem_root,
196 sp_head *sp_start_parsing(THD *thd,
197 enum_sp_type sp_type,
200 void sp_finish_parsing(THD *thd);
204 Item_result sp_map_result_type(
enum enum_field_types
type);
205 Item::Type sp_map_item_type(
enum enum_field_types
type);
206 uint sp_get_flags_for_command(LEX *lex);
210 TABLE_LIST *sp_add_to_query_tables(THD *thd, LEX *lex,
211 const char *db,
const char *
name,
212 thr_lock_type locktype,
213 enum_mdl_type mdl_type);
215 bool sp_check_show_access(THD *thd,
sp_head *sp,
bool *full_access);
217 Item *sp_prepare_func_item(THD* thd,
Item **it_addr);
219 bool sp_eval_expr(THD *thd,
Field *result_field,
Item **expr_item_ptr);