Ok, tested it and it works so that the array of old row
1) Always contains all columns belonging to that table
2) The columns are in the order they are defined for the table
So all is quite ok.
My only (mostly aesthetic) criticism is that the columns of a table
should be a set (and thus have no ordering).
But since SQL violated that principle then I quess I can live with that.
Maybe this remark could be added to trigger documentation?
- rami
5.5.2010 0:09, Rami Ojares kirjoitti:
Hi,
In trigger interface the fire method is defined as
void fire
<http://www.h2database.com/javadoc/org/h2/api/Trigger.html#fire_Connection_Object-_Object->(Connection
conn, Object[] oldRow, Object[] newRow) throws SQLException
Does the old/new row object array contain all the columns of the row
or just the ones mentioned in the insert/update statement?
Is there any way to know in what order those values are?
I mean if I do two two separate updates
UPDATE TBL SET COL1 = X, COL2 = Y
and
UPDATE TBL SET COL2 = Y, COL1 = X
Then are those values in the array in the order used in the statement.
If so, how am I able to know what value is which?
I think it would be great if instead of an Object Array old and new
rows could be represented as Map<String, Object>
that would map column names to row's values.
And also that the map would contain all the columns of the table.
(Maybe it already does, haven't tested that yet.
- Rami Ojares
--
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.