Hi,
> I am expecting a Trigger to belong to *one* of those types.
I don't agree. It doesn't make sense to create one trigger object for
DELETE, one trigger object for INSERT, and one trigger object for
UPDATE.
> In fact,
> if you look at the original RFE that led to this feature getting
> added, they had the same thing in mind:
How did you come to this conclusion?
> 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).
That's possible, also for compatibility with HSQLDB. I guess it
doesn't make sense to change the existing interface (backwards
compatibility); instead, an Adapter style extension could be added.
Currently the following logic can be used:
if (oldRow != null) {
if (newRow != null) {
// update
if (hasChanged(oldRow, newRow, indexColumns)) {
delete(oldRow);
insert(newRow);
}
} else {
// delete
delete(oldRow);
}
} else if (newRow != null) {
// insert
insert(newRow);
}
> Either way, the Javadoc should match the actual behavior.
I will document in Trigger.init()
The type of operation is a bit field with the
appropriate flags set. As an example, if the trigger is of type INSERT
and UPDATE, then the parameter type is set to (INSERT | UPDATE).
@param type the operation type: INSERT, UPDATE, DELETE, SELECT, or a
combination (this parameter is a bit field)
Regards,
Thomas
--
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.