The world's most popular open source database
#include <stddef.h>Include dependency graph for sp_head.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
| #define TYPE_ENUM_FUNCTION 1 |
Definition at line 29 of file sp_head.h.
Referenced by sp_head::create(), create_string(), db_create_routine(), Item_func_sp::find_and_check_access(), grant_load(), mysql_execute_command(), replace_routine_table(), sp_cache_routines_and_add_tables_aux(), sp_create_function(), sp_drop_function(), sp_exist_routines(), sp_find_routine(), Item_func_sp::sp_result_field(), sp_show_create_function(), sp_show_status_function(), sp_update_function(), and store_schema_proc().
| #define TYPE_ENUM_PROCEDURE 2 |
Definition at line 30 of file sp_head.h.
Referenced by check_show_routine_access(), db_find_routine(), grant_load(), sp_head::is_not_allowed_in_function(), mysql_execute_command(), sp_head::recursion_level_error(), replace_routine_table(), sp_create_procedure(), sp_drop_procedure(), sp_exist_routines(), sp_find_routine(), sp_get_prelocking_info(), sp_show_create_procedure(), sp_show_status_procedure(), sp_update_procedure(), and store_schema_proc().
| #define TYPE_ENUM_TRIGGER 3 |
| bool check_routine_name | ( | LEX_STRING | name | ) |
| bool set_routine_security_ctx | ( | THD * | thd, | |
| sp_head * | sp, | |||
| bool | is_proc, | |||
| Security_context ** | save_ctx | |||
| ) |
Definition at line 1227 of file sp_head.cc.
References check_routine_access(), EXECUTE_ACL, FALSE, sp_head::m_db, sp_head::m_name, sp_change_security_context(), sp_restore_security_context(), LEX_STRING::str, and TRUE.
Referenced by sp_head::execute_function(), sp_head::execute_procedure(), and Item_func_sp::fix_fields().
01229 { 01230 *save_ctx= 0; 01231 if (sp_change_security_context(thd, sp, save_ctx)) 01232 return TRUE; 01233 01234 /* 01235 If we changed context to run as another user, we need to check the 01236 access right for the new context again as someone may have revoked 01237 the right to use the procedure from this user. 01238 01239 TODO: 01240 Cache if the definer has the right to use the object on the 01241 first usage and only reset the cache if someone does a GRANT 01242 statement that 'may' affect this. 01243 */ 01244 if (*save_ctx && 01245 check_routine_access(thd, EXECUTE_ACL, 01246 sp->m_db.str, sp->m_name.str, is_proc, FALSE)) 01247 { 01248 sp_restore_security_context(thd, *save_ctx); 01249 *save_ctx= 0; 01250 return TRUE; 01251 } 01252 01253 return FALSE; 01254 }
Here is the call graph for this function:

Here is the caller graph for this function:

| TABLE_LIST* sp_add_to_query_tables | ( | THD * | thd, | |
| LEX * | lex, | |||
| const char * | db, | |||
| const char * | name, | |||
| thr_lock_type | locktype | |||
| ) |
Definition at line 3606 of file sp_head.cc.
References st_table_list::alias, st_table_list::cacheable_table, st_table_list::db, st_table_list::db_length, ER_OUTOFMEMORY, st_table_list::lock_type, my_error(), MYF, NULL, st_table_list::select_lex, strlen(), st_table_list::table_name, and st_table_list::table_name_length.
Referenced by add_table_for_trigger().
03609 { 03610 TABLE_LIST *table; 03611 03612 if (!(table= (TABLE_LIST *)thd->calloc(sizeof(TABLE_LIST)))) 03613 { 03614 my_error(ER_OUTOFMEMORY, MYF(0), sizeof(TABLE_LIST)); 03615 return NULL; 03616 } 03617 table->db_length= strlen(db); 03618 table->db= thd->strmake(db, table->db_length); 03619 table->table_name_length= strlen(name); 03620 table->table_name= thd->strmake(name, table->table_name_length); 03621 table->alias= thd->strdup(name); 03622 table->lock_type= locktype; 03623 table->select_lex= lex->current_select; 03624 table->cacheable_table= 1; 03625 03626 lex->add_to_query_tables(table); 03627 return table; 03628 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3352 of file sp_head.cc.
References acl_getroot_no_password(), ER_NO_SUCH_USER, FALSE, sp_head::m_chistics, sp_head::m_db, sp_head::m_definer_host, sp_head::m_definer_user, sp_head::m_security_ctx, my_error(), my_strcasecmp, MYF, LEX_STRING::str, strcmp(), system_charset_info, and TRUE.
Referenced by Table_triggers_list::process_triggers(), and set_routine_security_ctx().
03353 { 03354 *backup= 0; 03355 if (sp->m_chistics->suid != SP_IS_NOT_SUID && 03356 (strcmp(sp->m_definer_user.str, 03357 thd->security_ctx->priv_user) || 03358 my_strcasecmp(system_charset_info, sp->m_definer_host.str, 03359 thd->security_ctx->priv_host))) 03360 { 03361 if (acl_getroot_no_password(&sp->m_security_ctx, sp->m_definer_user.str, 03362 sp->m_definer_host.str, 03363 sp->m_definer_host.str, 03364 sp->m_db.str)) 03365 { 03366 my_error(ER_NO_SUCH_USER, MYF(0), sp->m_definer_user.str, 03367 sp->m_definer_host.str); 03368 return TRUE; 03369 } 03370 *backup= thd->security_ctx; 03371 thd->security_ctx= &sp->m_security_ctx; 03372 } 03373 return FALSE; 03374 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 325 of file sp_head.cc.
References CHECK_FIELD_ERROR_FOR_NULL, DBUG_ENTER, DBUG_RETURN, FALSE, MODE_STRICT_ALL_TABLES, MODE_STRICT_TRANS_TABLES, Item::save_in_field(), sp_prepare_func_item(), and TRUE.
Referenced by sp_rcontext::set_return_value(), and sp_rcontext::set_variable().
00326 { 00327 Item *expr_item; 00328 00329 DBUG_ENTER("sp_eval_expr"); 00330 00331 if (!*expr_item_ptr) 00332 DBUG_RETURN(TRUE); 00333 00334 if (!(expr_item= sp_prepare_func_item(thd, expr_item_ptr))) 00335 DBUG_RETURN(TRUE); 00336 00337 bool err_status= FALSE; 00338 00339 /* 00340 Set THD flags to emit warnings/errors in case of overflow/type errors 00341 during saving the item into the field. 00342 00343 Save original values and restore them after save. 00344 */ 00345 00346 enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; 00347 bool save_abort_on_warning= thd->abort_on_warning; 00348 bool save_no_trans_update= thd->no_trans_update; 00349 00350 thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL; 00351 thd->abort_on_warning= 00352 thd->variables.sql_mode & 00353 (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES); 00354 thd->no_trans_update= 0; 00355 00356 /* Save the value in the field. Convert the value if needed. */ 00357 00358 expr_item->save_in_field(result_field, 0); 00359 00360 thd->count_cuted_fields= save_count_cuted_fields; 00361 thd->abort_on_warning= save_abort_on_warning; 00362 thd->no_trans_update= save_no_trans_update; 00363 00364 if (thd->net.report_error) 00365 { 00366 /* Return error status if something went wrong. */ 00367 err_status= TRUE; 00368 } 00369 00370 DBUG_RETURN(err_status); 00371 }
Here is the call graph for this function:

Here is the caller graph for this function:

| uint sp_get_flags_for_command | ( | LEX * | lex | ) |
Definition at line 151 of file sp_head.cc.
References sp_head::CONTAINS_DYNAMIC_SQL, flags, HA_LEX_CREATE_TMP_TABLE, sp_head::HAS_COMMIT_OR_ROLLBACK, sp_head::MULTI_RESULTS, SQLCOM_ALTER_EVENT, SQLCOM_ALTER_FUNCTION, SQLCOM_ALTER_PROCEDURE, SQLCOM_ALTER_TABLE, SQLCOM_ANALYZE, SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_BACKUP_TABLE, SQLCOM_BEGIN, SQLCOM_CHECK, SQLCOM_CHECKSUM, SQLCOM_COMMIT, SQLCOM_CREATE_DB, SQLCOM_CREATE_EVENT, SQLCOM_CREATE_INDEX, SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_TRIGGER, SQLCOM_CREATE_USER, SQLCOM_CREATE_VIEW, SQLCOM_DEALLOCATE_PREPARE, SQLCOM_DROP_DB, SQLCOM_DROP_EVENT, SQLCOM_DROP_FUNCTION, SQLCOM_DROP_INDEX, SQLCOM_DROP_PROCEDURE, SQLCOM_DROP_TABLE, SQLCOM_DROP_TRIGGER, SQLCOM_DROP_USER, SQLCOM_DROP_VIEW, SQLCOM_EXECUTE, SQLCOM_FLUSH, SQLCOM_HA_READ, SQLCOM_INSTALL_PLUGIN, SQLCOM_LOAD, SQLCOM_LOAD_MASTER_DATA, SQLCOM_LOCK_TABLES, SQLCOM_OPTIMIZE, SQLCOM_PRELOAD_KEYS, SQLCOM_PREPARE, SQLCOM_RENAME_TABLE, SQLCOM_RENAME_USER, SQLCOM_REPAIR, SQLCOM_RESTORE_TABLE, SQLCOM_ROLLBACK, SQLCOM_SELECT, SQLCOM_SHOW_AUTHORS, SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_SHOW_BINLOGS, SQLCOM_SHOW_CHARSETS, SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_CONTRIBUTORS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_CREATE_FUNC, SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_MUTEX, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ERRORS, SQLCOM_SHOW_EVENTS, SQLCOM_SHOW_FIELDS, SQLCOM_SHOW_FUNC_CODE, SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_KEYS, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_NEW_MASTER, SQLCOM_SHOW_OPEN_TABLES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_SCHEDULER_STATUS, SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_SHOW_SLAVE_STAT, SQLCOM_SHOW_STATUS, SQLCOM_SHOW_STATUS_FUNC, SQLCOM_SHOW_STATUS_PROC, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_WARNS, SQLCOM_TRUNCATE, and SQLCOM_UNINSTALL_PLUGIN.
00152 { 00153 uint flags; 00154 00155 switch (lex->sql_command) { 00156 case SQLCOM_SELECT: 00157 if (lex->result) 00158 { 00159 flags= 0; /* This is a SELECT with INTO clause */ 00160 break; 00161 } 00162 /* fallthrough */ 00163 case SQLCOM_ANALYZE: 00164 case SQLCOM_BACKUP_TABLE: 00165 case SQLCOM_OPTIMIZE: 00166 case SQLCOM_PRELOAD_KEYS: 00167 case SQLCOM_ASSIGN_TO_KEYCACHE: 00168 case SQLCOM_CHECKSUM: 00169 case SQLCOM_CHECK: 00170 case SQLCOM_HA_READ: 00171 case SQLCOM_SHOW_AUTHORS: 00172 case SQLCOM_SHOW_BINLOGS: 00173 case SQLCOM_SHOW_BINLOG_EVENTS: 00174 case SQLCOM_SHOW_CHARSETS: 00175 case SQLCOM_SHOW_COLLATIONS: 00176 case SQLCOM_SHOW_COLUMN_TYPES: 00177 case SQLCOM_SHOW_CONTRIBUTORS: 00178 case SQLCOM_SHOW_CREATE: 00179 case SQLCOM_SHOW_CREATE_DB: 00180 case SQLCOM_SHOW_CREATE_FUNC: 00181 case SQLCOM_SHOW_CREATE_PROC: 00182 case SQLCOM_SHOW_CREATE_EVENT: 00183 case SQLCOM_SHOW_DATABASES: 00184 case SQLCOM_SHOW_ERRORS: 00185 case SQLCOM_SHOW_FIELDS: 00186 case SQLCOM_SHOW_FUNC_CODE: 00187 case SQLCOM_SHOW_GRANTS: 00188 case SQLCOM_SHOW_ENGINE_STATUS: 00189 case SQLCOM_SHOW_ENGINE_LOGS: 00190 case SQLCOM_SHOW_ENGINE_MUTEX: 00191 case SQLCOM_SHOW_EVENTS: 00192 case SQLCOM_SHOW_KEYS: 00193 case SQLCOM_SHOW_MASTER_STAT: 00194 case SQLCOM_SHOW_NEW_MASTER: 00195 case SQLCOM_SHOW_OPEN_TABLES: 00196 case SQLCOM_SHOW_PRIVILEGES: 00197 case SQLCOM_SHOW_PROCESSLIST: 00198 case SQLCOM_SHOW_PROC_CODE: 00199 case SQLCOM_SHOW_SCHEDULER_STATUS: 00200 case SQLCOM_SHOW_SLAVE_HOSTS: 00201 case SQLCOM_SHOW_SLAVE_STAT: 00202 case SQLCOM_SHOW_STATUS: 00203 case SQLCOM_SHOW_STATUS_FUNC: 00204 case SQLCOM_SHOW_STATUS_PROC: 00205 case SQLCOM_SHOW_STORAGE_ENGINES: 00206 case SQLCOM_SHOW_TABLES: 00207 case SQLCOM_SHOW_VARIABLES: 00208 case SQLCOM_SHOW_WARNS: 00209 case SQLCOM_REPAIR: 00210 case SQLCOM_RESTORE_TABLE: 00211 flags= sp_head::MULTI_RESULTS; 00212 break; 00213 /* 00214 EXECUTE statement may return a result set, but doesn't have to. 00215 We can't, however, know it in advance, and therefore must add 00216 this statement here. This is ok, as is equivalent to a result-set 00217 statement within an IF condition. 00218 */ 00219 case SQLCOM_EXECUTE: 00220 flags= sp_head::MULTI_RESULTS | sp_head::CONTAINS_DYNAMIC_SQL; 00221 break; 00222 case SQLCOM_PREPARE: 00223 case SQLCOM_DEALLOCATE_PREPARE: 00224 flags= sp_head::CONTAINS_DYNAMIC_SQL; 00225 break; 00226 case SQLCOM_CREATE_TABLE: 00227 if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) 00228 flags= 0; 00229 else 00230 flags= sp_head::HAS_COMMIT_OR_ROLLBACK; 00231 break; 00232 case SQLCOM_DROP_TABLE: 00233 if (lex->drop_temporary) 00234 flags= 0; 00235 else 00236 flags= sp_head::HAS_COMMIT_OR_ROLLBACK; 00237 break; 00238 case SQLCOM_CREATE_INDEX: 00239 case SQLCOM_CREATE_DB: 00240 case SQLCOM_CREATE_VIEW: 00241 case SQLCOM_CREATE_TRIGGER: 00242 case SQLCOM_CREATE_USER: 00243 case SQLCOM_ALTER_TABLE: 00244 case SQLCOM_BEGIN: 00245 case SQLCOM_RENAME_TABLE: 00246 case SQLCOM_RENAME_USER: 00247 case SQLCOM_DROP_INDEX: 00248 case SQLCOM_DROP_DB: 00249 case SQLCOM_DROP_USER: 00250 case SQLCOM_DROP_VIEW: 00251 case SQLCOM_DROP_TRIGGER: 00252 case SQLCOM_TRUNCATE: 00253 case SQLCOM_COMMIT: 00254 case SQLCOM_ROLLBACK: 00255 case SQLCOM_LOAD: 00256 case SQLCOM_LOAD_MASTER_DATA: 00257 case SQLCOM_LOCK_TABLES: 00258 case SQLCOM_CREATE_PROCEDURE: 00259 case SQLCOM_CREATE_SPFUNCTION: 00260 case SQLCOM_ALTER_PROCEDURE: 00261 case SQLCOM_ALTER_FUNCTION: 00262 case SQLCOM_DROP_PROCEDURE: 00263 case SQLCOM_DROP_FUNCTION: 00264 case SQLCOM_CREATE_EVENT: 00265 case SQLCOM_ALTER_EVENT: 00266 case SQLCOM_DROP_EVENT: 00267 case SQLCOM_FLUSH: 00268 case SQLCOM_INSTALL_PLUGIN: 00269 case SQLCOM_UNINSTALL_PLUGIN: 00270 flags= sp_head::HAS_COMMIT_OR_ROLLBACK; 00271 break; 00272 default: 00273 flags= 0; 00274 break; 00275 } 00276 return flags; 00277 }
| Item::Type sp_map_item_type | ( | enum enum_field_types | type | ) |
Definition at line 59 of file sp_head.cc.
References Item::DECIMAL_ITEM, Item::INT_ITEM, MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL, MYSQL_TYPE_SHORT, MYSQL_TYPE_TINY, Item::REAL_ITEM, and Item::STRING_ITEM.
Referenced by Item_splocal::Item_splocal().
00060 { 00061 switch (type) { 00062 case MYSQL_TYPE_TINY: 00063 case MYSQL_TYPE_SHORT: 00064 case MYSQL_TYPE_LONG: 00065 case MYSQL_TYPE_LONGLONG: 00066 case MYSQL_TYPE_INT24: 00067 return Item::INT_ITEM; 00068 case MYSQL_TYPE_DECIMAL: 00069 case MYSQL_TYPE_NEWDECIMAL: 00070 return Item::DECIMAL_ITEM; 00071 case MYSQL_TYPE_FLOAT: 00072 case MYSQL_TYPE_DOUBLE: 00073 return Item::REAL_ITEM; 00074 default: 00075 return Item::STRING_ITEM; 00076 } 00077 }
Here is the caller graph for this function:

| Item_result sp_map_result_type | ( | enum enum_field_types | type | ) |
Definition at line 37 of file sp_head.cc.
References DECIMAL_RESULT, INT_RESULT, MYSQL_TYPE_DECIMAL, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24, MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, MYSQL_TYPE_NEWDECIMAL, MYSQL_TYPE_SHORT, MYSQL_TYPE_TINY, REAL_RESULT, and STRING_RESULT.
Referenced by Item_splocal::Item_splocal().
00038 { 00039 switch (type) { 00040 case MYSQL_TYPE_TINY: 00041 case MYSQL_TYPE_SHORT: 00042 case MYSQL_TYPE_LONG: 00043 case MYSQL_TYPE_LONGLONG: 00044 case MYSQL_TYPE_INT24: 00045 return INT_RESULT; 00046 case MYSQL_TYPE_DECIMAL: 00047 case MYSQL_TYPE_NEWDECIMAL: 00048 return DECIMAL_RESULT; 00049 case MYSQL_TYPE_FLOAT: 00050 case MYSQL_TYPE_DOUBLE: 00051 return REAL_RESULT; 00052 default: 00053 return STRING_RESULT; 00054 } 00055 }
Here is the caller graph for this function:

Definition at line 294 of file sp_head.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, NULL, and Item::this_item_addr().
Referenced by sp_instr_jump_if_not::exec_core(), sp_rcontext::set_case_expr(), Item_trigger_field::set_value(), and sp_eval_expr().
00295 { 00296 DBUG_ENTER("sp_prepare_func_item"); 00297 it_addr= (*it_addr)->this_item_addr(thd, it_addr); 00298 00299 if (!(*it_addr)->fixed && 00300 ((*it_addr)->fix_fields(thd, it_addr) || 00301 (*it_addr)->check_cols(1))) 00302 { 00303 DBUG_PRINT("info", ("fix_fields() failed")); 00304 DBUG_RETURN(NULL); 00305 } 00306 DBUG_RETURN(*it_addr); 00307 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void sp_restore_security_context | ( | THD * | thd, | |
| Security_context * | backup | |||
| ) |
Definition at line 3377 of file sp_head.cc.
Referenced by sp_head::execute_function(), sp_head::execute_procedure(), Item_func_sp::fix_fields(), Table_triggers_list::process_triggers(), and set_routine_security_ctx().
03378 { 03379 if (backup) 03380 thd->security_ctx= backup; 03381 }
Here is the caller graph for this function:

1.4.7

