Skip to content

Commit 2ca45d5

Browse files
committed
Function prototypes.
1 parent 38f0ffd commit 2ca45d5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/include/commands/trigger.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,45 @@
99
#ifndef TRIGGER_H
1010
#define TRIGGER_H
1111

12+
#include "access/tupdesc.h"
13+
#include "access/htup.h"
14+
#include "utils/rel.h"
15+
16+
typedef uint32 TriggerAction;
17+
18+
#define TRIGGER_ACTION_INSERT 0x00000000
19+
#define TRIGGER_ACTION_DELETE 0x00000001
20+
#define TRIGGER_ACTION_UPDATE 0x00000010
21+
#define TRIGGER_ACTION_OPMASK 0x00000011
22+
#define TRIGGER_ACTION_ROW 4
23+
24+
#define TRIGGER_FIRED_BY_INSERT (action) \
25+
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
26+
TRIGGER_ACTION_INSERT)
27+
28+
#define TRIGGER_FIRED_BY_DELETE (action) \
29+
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
30+
TRIGGER_ACTION_DELETE)
31+
32+
#define TRIGGER_FIRED_BY_UPDATE (action) \
33+
(((TriggerAction) action & TRIGGER_ACTION_OPMASK) == \
34+
TRIGGER_ACTION_UPDATE)
35+
36+
#define TRIGGER_FIRED_FOR_ROW (action) \
37+
((TriggerAction) action & TRIGGER_ACTION_ROW)
38+
39+
#define TRIGGER_FIRED_FOR_STATEMENT (action) \
40+
(!TRIGGER_FIRED_FOR_ROW (action))
41+
42+
1243
extern void CreateTrigger (CreateTrigStmt *stmt);
1344
extern void DropTrigger (DropTrigStmt *stmt);
1445

46+
extern HeapTuple ExecBRInsertTriggers (Relation rel, HeapTuple tuple);
47+
extern void ExecARInsertTriggers (Relation rel, HeapTuple tuple);
48+
extern bool ExecBRDeleteTriggers (Relation rel, ItemPointer tupleid);
49+
extern void ExecARDeleteTriggers (Relation rel, ItemPointer tupleid);
50+
extern HeapTuple ExecBRUpdateTriggers (Relation rel, ItemPointer tupleid, HeapTuple tuple);
51+
extern void ExecARUpdateTriggers (Relation rel, ItemPointer tupleid, HeapTuple tuple);
52+
1553
#endif /* TRIGGER_H */

0 commit comments

Comments
 (0)