You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2022/01/21 23:24:50 UTC

[empire-db] branch version3 updated: EMPIREDB-364 enalbeRollbackHandling flag

This is an automated email from the ASF dual-hosted git repository.

doebele pushed a commit to branch version3
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/version3 by this push:
     new 709b0e5  EMPIREDB-364 enalbeRollbackHandling flag
709b0e5 is described below

commit 709b0e5b348998fe5ccfd72387bd322b5e31161c
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Sat Jan 22 00:24:48 2022 +0100

    EMPIREDB-364 enalbeRollbackHandling flag
---
 .../src/main/java/org/apache/empire/db/DBRecord.java    | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
index 76af745..bc79a99 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
@@ -202,11 +202,11 @@ public class DBRecord extends DBRecordData implements DBContextAware, Record, Cl
     private State           state;
     private Object[]        fields;
     private boolean[]       modified;
-    // Special Rowset Data (usually null)
-    private Object          rowsetData;
+    private Object          rowsetData; // Special Rowset Data (usually null)
 
     // options
-    private boolean         validateFieldValues;
+    protected boolean       enableRollbackHandling = true;
+    protected boolean       validateFieldValues = true;
     
     /**
      * Constructs a new DBRecord.<BR>
@@ -225,7 +225,6 @@ public class DBRecord extends DBRecordData implements DBContextAware, Record, Cl
         this.fields = null;
         this.modified = null;
         this.rowsetData = null;
-        this.validateFieldValues = true;
     }
 
     /**
@@ -817,7 +816,8 @@ public class DBRecord extends DBRecordData implements DBContextAware, Record, Cl
         if (!isModified())
             return; /* Not modified. Nothing to do! */
         // allow rollback
-        context.addRollbackHandler(createRollbackHandler());
+        if (enableRollbackHandling)
+            context.addRollbackHandler(createRollbackHandler());
         // update
         rowset.updateRecord(this);
     }
@@ -837,7 +837,8 @@ public class DBRecord extends DBRecordData implements DBContextAware, Record, Cl
         if (isValid()==false)
             throw new ObjectNotValidException(this);
         // allow rollback
-        context.addRollbackHandler(createRollbackHandler());
+        if (enableRollbackHandling)
+            context.addRollbackHandler(createRollbackHandler());
         // Delete only if record is not new
         if (!isNew())
         {
@@ -1266,8 +1267,8 @@ public class DBRecord extends DBRecordData implements DBContextAware, Record, Cl
     {
         if (log.isTraceEnabled() && isValid())
             log.trace("Record has been changed");
-        // remove rollback (but not when close is called)
-        if (fields!=null)
+        // Remove rollback (but not when close() is called!)
+        if (enableRollbackHandling && fields!=null)
             context.removeRollbackHandler(this);
     }