Subject Re: [IB-Architect] Trigger Templates
Author Jim Starkey
At 03:24 AM 7/8/00 +0800, Joseph Alba wrote:
>sorry bug here
>>But with trigger template capability, I can do it with 400 things only (one
>400 should be 4

No, I'm afraid you were almost right the first time. But the answer
is actual 401 things -- one template and 400 separate and distinct
instantiations. You still have the original cut and paste problem;
you've just reduced the size of the cut.

You're barking up the wrong tree.

A better solution to your problem is table inheritance, not trigger
templates. It would work something like this:

1. Define a table call BASE containing creation timestamp,
creating user, last modification timestamp, and last
modifying user.

2. Define insert and update triggers for BASE to populate
the appropriate fields.

3. Define you favorite 400 tables with "extends BASE". Each
inherits the fields and triggers of BASE.

This could be done in the engine or an external DDL utility. It
is more powerful to use, much easier to implement, without a
performance impact, and much more elegant. You will also find
that it solves a host of other problems.

The above just describes declarative inheritance. For a tad more
work (and lot more thinking), the full semantic data model
could be implemented, again either within the engine or as a
separate DDL utility.

[Semantic data model supports a type hierarchy of tables. The
classical example is ships model with generic vessel (boat) at the
top. YACHTS and WARSHIPS derive from BOAT. SAILBOATS and
and SUBMARINES derive from WARSHIPS. Any type in the hierarchy
can be fetched; the higher you go, the fewer fields but more
records you get. It's cute. If you have multi-inheritance you
can have SUBMARINE_YACHTS (color = yellow, of course).]

Some historical notes. The precurser to Interbase (aka InterBase)
was Rdb/ELN at DEC, also known as JRD. The DEC JRD had the
semantic data model extensions well underway when the Database
Inquisition form to enforce API convergence between Rdb/ELN
and it's dumb cousin Rdb/VMS declared the SDM too avant-garde
for the times.

Later, at InterBase, I had an epiphany while unloading the
dishwasher on how to implement SDM with an external DDL utility.
Coded up a storm and it worked like a charm. Unfortunately,
it was too avante-garde for the customer. Life's like that.

I may have the code in the attic. I'll look.

Jim Starkey