The solution seems to be to set a flag somewhere in your program, and have the triggers check the status of this flag before executing.
On Fri, Apr 9, 2010 at 11:58 PM, Erin Drummond <[email protected]> wrote: > Hi, > > I have a database that contains a lastUpdated field on every table. > Currently there is a trigger that sets the lastUpdated field to the > current date+time every time a record is updated. > I am working on a way of replicating parts of this database across a > few nodes using the lastUpdated field. Basically, it works like: > > Node 1 generates a Map of RowId->lastUpdated pairs and sends it to Node 2 > Node 2 also generates the same Map using its local data, and compares > it to the map of data from Node 1 > Node 2 realises that some of its pairs are outdated, and makes a list > of which ones > Node 2 sends this list to node 1 as a request for data > Node 1 responds with the data, and Node 2 updates its database > All the triggers in Node 2's database fire, making the lastUpdated > field hold a value newer than Node 1, even though the actual data is > the same > > Node 2 and Node 1 do a comparison, and Node 1 sees that Node 2 has > newer records, so it requests them > All the triggers in Node 1's database fire, making the lastUpdated > field hold newer values > > Node 1 and Node 2 do a comparison... > > ..and so on in an infinite loop. I dont want to do a comparison of the > actual data because this would mean sending all the data over the > network, which would be impractical in this situation. > > Is there a way to disable triggers temporarily while I perform the data > update? > > I see from the manual there is a way to disable referential integrity > constraints, but I see no such way for triggers. I'd also much prefer > not to have to deal with the lastUpdated field at the Application > level. > > Thanks, > Erin > -- 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.
