summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 9f26bff3321..61660a964ff 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -35,16 +35,6 @@
#include "sp_cache.h" // sp_invalidate_cache
#include <mysys_err.h>
-LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str,
- const char* str, size_t length,
- MEM_ROOT *mem_root)
-{
- if (!(lex_str->str= strmake_root(mem_root, str, length)))
- return 0;
- lex_str->length= length;
- return lex_str;
-}
-
/*************************************************************************/
/**
@@ -515,7 +505,10 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (err_status)
goto end;
}
+
+#ifdef WITH_WSREP
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+#endif
/* We should have only one table in table list. */
DBUG_ASSERT(tables->next_global == 0);
@@ -543,7 +536,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
/* Under LOCK TABLES we must only accept write locked tables. */
if (!(tables->table= find_table_for_mdl_upgrade(thd, tables->db.str,
tables->table_name.str,
- FALSE)))
+ NULL)))
goto end;
}
else
@@ -619,9 +612,9 @@ end:
DBUG_RETURN(result);
#ifdef WITH_WSREP
- error:
+wsrep_error_label:
DBUG_RETURN(true);
-#endif /* WITH_WSREP */
+#endif
}
@@ -1499,8 +1492,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
if (likely((name= error_handler.get_trigger_name())))
{
- if (unlikely(!(make_lex_string(&trigger->name, name->str,
- name->length, &table->mem_root))))
+ trigger->name= safe_lexcstrdup_root(&table->mem_root, *name);
+ if (unlikely(!trigger->name.str))
goto err_with_lex_cleanup;
}
trigger->definer= ((!trg_definer || !trg_definer->length) ?
@@ -2189,8 +2182,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
This trigger must have been processed by the pre-locking
algorithm.
*/
- DBUG_ASSERT(trigger_table->pos_in_table_list->trg_event_map &
- static_cast<uint>(1 << static_cast<int>(event)));
+ DBUG_ASSERT(trigger_table->pos_in_table_list->trg_event_map & trg2bit(event));
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
@@ -2242,8 +2234,7 @@ add_tables_and_routines_for_triggers(THD *thd,
for (int i= 0; i < (int)TRG_EVENT_MAX; i++)
{
- if (table_list->trg_event_map &
- static_cast<uint8>(1 << static_cast<int>(i)))
+ if (table_list->trg_event_map & trg2bit(static_cast<trg_event_type>(i)))
{
for (int j= 0; j < (int)TRG_ACTION_MAX; j++)
{