MCPcopy Create free account
hub / github.com/MariaDB/server / add_table_for_trigger_internal

Function add_table_for_trigger_internal

sql/sql_trigger.cc:2206–2243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2204*/
2205
2206static bool add_table_for_trigger_internal(THD *thd,
2207 const sp_name *trg_name,
2208 bool if_exists,
2209 TABLE_LIST **table,
2210 char *trn_path_buff)
2211{
2212 LEX *lex= thd->lex;
2213 LEX_CSTRING trn_path= { trn_path_buff, 0 };
2214 LEX_CSTRING tbl_name= null_clex_str;
2215 DBUG_ENTER("add_table_for_trigger_internal");
2216
2217 build_trn_path(thd, trg_name, (LEX_STRING*) &trn_path);
2218
2219 if (check_trn_exists(&trn_path))
2220 {
2221 if (if_exists)
2222 {
2223 push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
2224 ER_TRG_DOES_NOT_EXIST, ER_THD(thd, ER_TRG_DOES_NOT_EXIST));
2225
2226 *table= NULL;
2227
2228 DBUG_RETURN(FALSE);
2229 }
2230
2231 my_error(ER_TRG_DOES_NOT_EXIST, MYF(0));
2232 DBUG_RETURN(TRUE);
2233 }
2234
2235 if (load_table_name_for_trigger(thd, trg_name, &trn_path, &tbl_name))
2236 DBUG_RETURN(TRUE);
2237
2238 *table= sp_add_to_query_tables(thd, lex, &trg_name->m_db,
2239 &tbl_name, TL_IGNORE,
2240 MDL_SHARED_NO_WRITE);
2241
2242 DBUG_RETURN(*table ? FALSE : TRUE);
2243}
2244
2245
2246/*

Callers 2

add_table_for_triggerFunction · 0.85

Calls 6

build_trn_pathFunction · 0.85
check_trn_existsFunction · 0.85
push_warningFunction · 0.85
my_errorFunction · 0.85
sp_add_to_query_tablesFunction · 0.85

Tested by

no test coverage detected