summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authormonty@mishka.local <>2004-09-15 22:36:57 +0300
committermonty@mishka.local <>2004-09-15 22:36:57 +0300
commit37864e2727718a1e266461a0704104ce1cb6d436 (patch)
treec54782bf59455786d3d6b7abf02e40aaac69b1ff /sql/sql_insert.cc
parent91ff64e107866821efc8591fc6ecf28f3b7ee9a0 (diff)
parentd24f293601327d6309be082295da4aa8d2f48f11 (diff)
downloadmariadb-git-37864e2727718a1e266461a0704104ce1cb6d436.tar.gz
Merge
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3508e962c60..c30fdcd805f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -19,6 +19,8 @@
#include "mysql_priv.h"
#include "sql_acl.h"
+#include "sp_head.h"
+#include "sql_trigger.h"
static int check_null_fields(THD *thd,TABLE *entry);
#ifndef EMBEDDED_LIBRARY
@@ -302,6 +304,12 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
break;
}
}
+
+ // FIXME: Actually we should do this before check_null_fields.
+ // Or even go into write_record ?
+ if (table->triggers)
+ table->triggers->process_triggers(thd, TRG_EVENT_INSERT, TRG_ACTION_BEFORE);
+
#ifndef EMBEDDED_LIBRARY
if (lock_type == TL_WRITE_DELAYED)
{
@@ -324,6 +332,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if (error)
break;
thd->row_count++;
+
+ if (table->triggers)
+ table->triggers->process_triggers(thd, TRG_EVENT_INSERT, TRG_ACTION_AFTER);
}
/*
@@ -599,8 +610,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
setup_fields(thd, 0, table_list, update_values, 0, 0, 0))))
DBUG_RETURN(-1);
- if (find_table_in_global_list(table_list->next_global,
- table_list->db, table_list->real_name))
+ if (unique_table(table_list, table_list->next_independent()))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1);