1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

WL#1218 "Triggers". Some very preliminary version of patch.

Mostly needed for Monty for him getting notion what needed for triggers 
from new .FRM format. 

Things to be done:
- Right placement of trigger's invocations
- Right handling of errors in triggers (including transaction rollback)
- Support for priviliges
- Right handling of DROP/RENAME table (hope that it will be handled automatically
  with merging of .TRG into .FRM file)
- Saving/restoring some information critical for trigger creation and replication
  with their definitions (e.g. sql_mode, creator, ...)
- Replication

Already has some known bugs so probably not for general review.
This commit is contained in:
dlenev@brandersnatch.localdomain
2004-09-07 16:29:46 +04:00
parent b93aa71d15
commit 9ed038dd6f
49 changed files with 1664 additions and 78 deletions

View File

@ -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
@ -299,6 +301,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)
{
@ -321,6 +329,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
id= thd->last_insert_id;
}
thd->row_count++;
if (table->triggers)
table->triggers->process_triggers(thd, TRG_EVENT_INSERT, TRG_ACTION_AFTER);
}
/*