Hi,

There seems to be some confusion in the specification of
org.h2.api.Trigger. If you invoke:

CREATE TRIGGER foo_history_trigger AFTER INSERT, UPDATE, DELETE ON foo
FOR EACH ROW CALL
  "MyTrigger";

H2 invokes init() with type = 7. If you look at the Javadoc of the
"type" parameter it says: "the operation type: INSERT, UPDATE, or
DELETE".

I am expecting a Trigger to belong to *one* of those types. In fact,
if you look at the original RFE that led to this feature getting
added, they had the same thing in mind:
http://groups.google.com/group/h2-database/browse_frm/thread/c510e6ce182826a2/72963a2273c49c97#72963a2273c49c97

Proposal:

1. Either instantiate one Trigger per type (better from a backwards-
compatibility point of view), or
2. Add a new "type" parameter to the fire() method so we can act on
the actual type that gets fired (better from a performance point of
view). I would keep the "type" parameter in init() in case someone
needs to initialize differently depending on the range of operations a
trigger may handle.

Either way, the Javadoc should match the actual behavior.

Thanks,
Gili

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to