1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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

@ -23,6 +23,8 @@
#include "mysql_priv.h"
#include "sql_acl.h"
#include "sql_select.h"
#include "sp_head.h"
#include "sql_trigger.h"
static bool safe_update_on_fly(JOIN_TAB *join_tab, List<Item> *fields);
@ -341,6 +343,10 @@ int mysql_update(THD *thd,
if (fill_record(fields,values, 0) || thd->net.report_error)
break; /* purecov: inspected */
found++;
if (table->triggers)
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_BEFORE);
if (compare_record(table, query_id))
{
if (!(error=table->file->update_row((byte*) table->record[1],
@ -356,6 +362,10 @@ int mysql_update(THD *thd,
break;
}
}
if (table->triggers)
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER);
if (!--limit && using_limit)
{
error= -1; // Simulate end of file