On 11/06/2011 12:25 PM, Thomas Mueller wrote:
Hi,

    Okay. How do you generate the same sequence id for different triggers in
the same transaction (and different ids for different transactions)?
The first operation in the transaction could generate a new sequence
id, and all other operations could then use the last value of the
generated sequence: http://h2database.com/html/functions.html#currval

I guess this is how I would solve the problem. It is relatively
database independent.

Regards,
Thomas

Hi Thomas,

I need help understanding your proposal. Looking at http://h2database.com/html/functions.html#currval

1. Does "session" refer to a database connection?
2. I am concerned about the part of the description that reads "independent of the session". Doesn't this mean that if two connections run concurrently CURRVAL() may lead to race-conditions? 3. I'm trying to use transaction IDs in database triggers. I have no way of knowing which one runs first, as such I don't know when to run NEXTVAL() and when to run CURRVAL(). Any suggestions? 4. Assuming we get this working, why did you decide to implement TRANSACTION_ID() in terms of a UUID string instead of this approach? The only benefit I can think of is cross-database uniqueness, but for single databases it seems the performance would be worse...?

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