Hi again,
I began to modify some H2 code in order to make my use case work. The
attached file is a patch file for org.h2.expression.SequenceValue. It seems
to solve my problem fine but I don't know enough the architecture of the H2
engine to be sure it won't fail in some other situations. I ran "build test"
and I got the same results with and without this patch...
Do you think this is safe ?
Regards
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/BewqmHdmA84J.
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.
Index: SequenceValue.java
===================================================================
--- SequenceValue.java (r?vision 3883)
+++ SequenceValue.java (copie de travail)
@@ -6,6 +6,7 @@
*/
package org.h2.expression;
+import org.h2.engine.Database;
import org.h2.engine.Session;
import org.h2.message.DbException;
import org.h2.schema.Sequence;
@@ -27,9 +28,15 @@
}
public Value getValue(Session session) {
- long value = sequence.getNext(session);
- session.setLastIdentity(ValueLong.get(value));
- return ValueLong.get(value);
+ Database database = session.getDatabase();
+ database.beforeWriting();
+ try {
+ long value = sequence.getNext(session);
+ session.setLastIdentity(ValueLong.get(value));
+ return ValueLong.get(value);
+ } finally {
+ database.afterWriting();
+ }
}
public int getType() {