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.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index e7e7dd9589d..63323ea386c 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -16,7 +16,7 @@
#define MYSQL_LEX 1
-#include <my_global.h> /* NO_EMBEDDED_ACCESS_CHECKS */
+#include "mariadb.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sp_head.h"
@@ -693,7 +693,7 @@ static void build_trig_stmt_query(THD *thd, TABLE_LIST *tables,
/* Create statement for storing trigger (without trigger order) */
if (lex->trg_chistics.ordering_clause == TRG_ORDER_NONE)
- trigger_def->append(stmt_definition.str, stmt_definition.length);
+ trigger_def->append(&stmt_definition);
else
{
/* Copy data before FOLLOWS/PRECEDES trigger_name */
@@ -755,8 +755,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
DBUG_RETURN(true);
/* Trigger must be in the same schema as target table. */
- if (my_strcasecmp(table_alias_charset, table->s->db.str,
- lex->spname->m_db.str))
+ if (lex_string_cmp(table_alias_charset, &table->s->db,
+ &lex->spname->m_db))
{
my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0));
DBUG_RETURN(true);
@@ -928,8 +928,8 @@ err_without_cleanup:
if (trigger_dropped)
{
String drop_trg_query;
- drop_trg_query.append("DROP TRIGGER /* generated by failed CREATE TRIGGER */ ");
- drop_trg_query.append(lex->spname->m_name.str);
+ drop_trg_query.append(STRING_WITH_LEN("DROP TRIGGER /* generated by failed CREATE TRIGGER */ "));
+ drop_trg_query.append(&lex->spname->m_name);
/*
We dropped an existing trigger and was not able to recreate it because
of an internal error. Ensure it's also dropped on the slave.
@@ -1089,8 +1089,8 @@ Trigger *Table_triggers_list::find_trigger(const LEX_CSTRING *name,
(trigger= *parent);
parent= &trigger->next)
{
- if (my_strcasecmp(table_alias_charset,
- trigger->name.str, name->str) == 0)
+ if (lex_string_cmp(table_alias_charset,
+ &trigger->name, name) == 0)
{
if (remove_from_list)
{
@@ -1228,7 +1228,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
uchar null_bit= 1;
for (fld= table->field, trg_fld= record0_field; *fld; fld++, trg_fld++)
{
- if (!(*fld)->null_ptr && !(*fld)->vcol_info)
+ if (!(*fld)->null_ptr && !(*fld)->vcol_info && !(*fld)->vers_sys_field())
{
Field *f;
if (!(f= *trg_fld= (*fld)->make_new_field(&table->mem_root, table,
@@ -1251,7 +1251,9 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table)
bzero(extra_null_bitmap, null_bytes);
}
else
+ {
record0_field= table->field;
+ }
if (has_triggers(TRG_EVENT_UPDATE,TRG_ACTION_BEFORE) ||
has_triggers(TRG_EVENT_UPDATE,TRG_ACTION_AFTER) ||
@@ -1638,8 +1640,8 @@ void Table_triggers_list::add_trigger(trg_event_type event,
for ( ; *parent ; parent= &(*parent)->next, position++)
{
if (ordering_clause != TRG_ORDER_NONE &&
- !my_strcasecmp(table_alias_charset, anchor_trigger_name->str,
- (*parent)->name.str))
+ !lex_string_cmp(table_alias_charset, anchor_trigger_name,
+ &(*parent)->name))
{
if (ordering_clause == TRG_ORDER_FOLLOWS)
{