pg_trigger.h
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:3k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. /*-------------------------------------------------------------------------
  2.  *
  3.  * pg_trigger.h
  4.  *
  5.  *
  6.  * Copyright (c) 1994, Regents of the University of California
  7.  *
  8.  * NOTES
  9.  *   the genbki.sh script reads this file and generates .bki
  10.  *   information from the DATA() statements.
  11.  *
  12.  *-------------------------------------------------------------------------
  13.  */
  14. #ifndef PG_TRIGGER_H
  15. #define PG_TRIGGER_H
  16. /* ----------------
  17.  * postgres.h contains the system type definintions and the
  18.  * CATALOG(), BOOTSTRAP and DATA() sugar words so this file
  19.  * can be read by both genbki.sh and the C compiler.
  20.  * ----------------
  21.  */
  22. /* ----------------
  23.  * pg_trigger definition. cpp turns this into
  24.  * typedef struct FormData_pg_trigger
  25.  * ----------------
  26.  */
  27. CATALOG(pg_trigger) BOOTSTRAP
  28. {
  29. Oid tgrelid; /* triggered relation */
  30. NameData tgname; /* trigger' name */
  31. Oid tgfoid; /* OID of function to be called */
  32. int2 tgtype; /* BEFORE/AFTER UPDATE/DELETE/INSERT
  33.  * ROW/STATEMENT */
  34. int2 tgnargs; /* # of extra arguments in tgargs */
  35. int28 tgattr; /* UPDATE of attr1, attr2 ... (NI) */
  36. bytea tgargs; /* first00second00tgnargs00 */
  37. } FormData_pg_trigger;
  38. /* ----------------
  39.  * Form_pg_trigger corresponds to a pointer to a tuple with
  40.  * the format of pg_trigger relation.
  41.  * ----------------
  42.  */
  43. typedef FormData_pg_trigger *Form_pg_trigger;
  44. /* ----------------
  45.  * compiler constants for pg_trigger
  46.  * ----------------
  47.  */
  48. #define Natts_pg_trigger 7
  49. #define Anum_pg_trigger_tgrelid 1
  50. #define Anum_pg_trigger_tgname 2
  51. #define Anum_pg_trigger_tgfoid 3
  52. #define Anum_pg_trigger_tgtype 4
  53. #define Anum_pg_trigger_tgnargs 5
  54. #define Anum_pg_trigger_tgattr 6
  55. #define Anum_pg_trigger_tgargs 7
  56. #define TRIGGER_TYPE_ROW (1 << 0)
  57. #define TRIGGER_TYPE_BEFORE (1 << 1)
  58. #define TRIGGER_TYPE_INSERT (1 << 2)
  59. #define TRIGGER_TYPE_DELETE (1 << 3)
  60. #define TRIGGER_TYPE_UPDATE (1 << 4)
  61. #define TRIGGER_CLEAR_TYPE(type) (type = 0)
  62. #define TRIGGER_SETT_ROW(type) (type |= TRIGGER_TYPE_ROW)
  63. #define TRIGGER_SETT_BEFORE(type) (type |= TRIGGER_TYPE_BEFORE)
  64. #define TRIGGER_SETT_INSERT(type) (type |= TRIGGER_TYPE_INSERT)
  65. #define TRIGGER_SETT_DELETE(type) (type |= TRIGGER_TYPE_DELETE)
  66. #define TRIGGER_SETT_UPDATE(type) (type |= TRIGGER_TYPE_UPDATE)
  67. #define TRIGGER_FOR_ROW(type) (type & TRIGGER_TYPE_ROW)
  68. #define TRIGGER_FOR_BEFORE(type) (type & TRIGGER_TYPE_BEFORE)
  69. #define TRIGGER_FOR_INSERT(type) (type & TRIGGER_TYPE_INSERT)
  70. #define TRIGGER_FOR_DELETE(type) (type & TRIGGER_TYPE_DELETE)
  71. #define TRIGGER_FOR_UPDATE(type) (type & TRIGGER_TYPE_UPDATE)
  72. #endif  /* PG_TRIGGER_H */