[Babase] Examining database rules
Karl O. Pinc
babase@www.eco.princeton.edu
Thu, 14 Apr 2005 19:16:37 +0000
In the babase/db/triggers/ directory you can
look at the file TABLE.m4 (where TABLE is the
name of the table) to see the trigger code,
the code that enforces the rules. All a table's
triggers are in one file. There
are various other ways to look at the
triggers. When in babase/db/triggers/ type
make usage
and it tells you the different things you can do with make.
The ones of interest are:
make TABLE Expand a table's triggers into TABLE
make TABLE.rem Put the comments of a table's unexpanded triggers
into TABLE.rem
make TABLE.xrem Put the comments of a table's expanded triggers
into TABLE.xrem
make TABLE.rem.nb Put the comments of a table's unexpanded triggers
into TABLE.rem.nb, removing all blank lines
make TABLE.xrem.nb Put the comments of a table's expanded triggers
into TABLE.xrem.nb, removing all blank lines
The above all make files of varying content that should help
review the rules.
Very simple rules are established when the tables are created.
See the file babase/db/maketables.m4 and look at the
CREATE TABLE statements. You will see things like (from
biograph):
CONSTRAINT "Sex bb_male, bb_female, or bb_unk_sex"
CHECK(sex = 'bb_male' OR sex = 'bb_female' OR
sex = 'bb_unk_sex'),
Look in babase/db/include/constants.m4 to find out what, e.g.,
bb_male is.
(FYI, I see I have not yet defined the bb_... constants used below.)
CONSTRAINT "Sname must not be one of bb_unk, bb_unkmale, bb_unkfemale"
CHECK(sname != 'bb_unk'
AND sname != 'bb_unkmale'
AND sname != 'bb_unkfemale'),
Note, the CYCLES stuff is going to change as I go to CYCPOINTS.
So watch out for that.
Karl <kop@meme.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein