Subject Re: [IB-Architect] Trigger Templates
Author Joseph Alba
>First, do you think this stuff needs to be in the engine, or would
>an extension to GDEF be sufficient? Is there really much gain
>over simple cut and paste?

I am still in the beginning pages of blr, maybe, when I'm done I'll have a
clearer picture / hint of what the engine is all about. But on the human
side, templates would help unstring the spaghetti of trigger codes. (Less
typing errors, neater format/code).

The disadvantage of cut and paste or GDEF would be if you would want to
produce the meta - script from the existing database. It would give back all
the spaghetti again. For instance, I like to have timestamps for all my
tables. At present, if I have 200 tables, this means, I'll have to have 400
triggers (1 for insert and 1 for update). But with templates, I'll only have
to have two. One for the template, another for the table assignment.

>If the answers are a) engine, b) template, and c) consistency, there
>are major changes to the engine, the system tables, and the various
>DDL processors, most of which will be difficult to make backwards
>compatible. Do you think this is worth the cost of a little cut
>and paste activity in a text editor? It seems to me likely that the
>number of keystokes expended in the implementation would exceed the
>number of keystrokes expended over the lifetime of the feature...
>

I think Templates would be to triggers as Roles are to Grants. Sure, you can
type in Grants to all users, Retyping each Grant set up for each new user.
But, roles have made Granting privileges a much more saner task.

I think Templates can even be extended to Table Structures:

CREATE TEMPLATE TABLE MyTemplateTable
( column1 integer not null primary key,
column2 char(10),
amount numeric(18,2)
);

CREATE Table MyTable1, MyTable2, MyTable3 FROM Template MyTemplateTable;

---------------------

If you take it all the way, Templates can become like Class Definitions in
Object-Oriented computing. And assignations to specific tables, triggers,
(even domains) would be the Instantiation part.

------------

>Ann and I are back from three days ...
> but temporarily too mellow to use them.
>
>Jim Starkey
Glad to hear that. Especially for me. So, I better take advantage of this
temporary situation by adding in INHERITANCE (haha!)

CREATE TEMPLATE TABLE MyTemplateSon INHERIT From MyTemplateTable
(
aFewMore1 char(10),
aFewMore2 char(10)
);

[It can even inherit from multiple parents, then, you can tout
object-oriented SQL]

Joseph Alba
jalba@...