File tree Expand file tree Collapse file tree 3 files changed +42
-17
lines changed
android/src/main/java/com/genexus/db/driver
common/src/main/java/com/genexus/db
java/src/main/java/com/genexus/db/driver Expand file tree Collapse file tree 3 files changed +42
-17
lines changed Original file line number Diff line number Diff line change @@ -660,20 +660,32 @@ private void commit_impl() throws SQLException
660660
661661 public void flushBatchCursors (java .lang .Object o ) throws SQLException {
662662 Vector <Cursor > toRemove = new Vector ();
663+ log (GXDBDebug .LOG_MIN , "Scanning " + batchUpdateStmts .size () + " batch Stmts with pending updates" );
663664 for (int i = 0 ; i < batchUpdateStmts .size (); i ++) {
664665 BatchUpdateCursor cursor = (BatchUpdateCursor ) batchUpdateStmts .get (i );
665- if (cursor .pendingRecords ()) {
666- if (cursor .beforeCommitEvent (o ))
667- toRemove .add (cursor );
666+ if (cursor .isValidOwner (o )) {
667+ if (cursor .pendingRecords ()) {
668+ cursor .beforeCommitEvent ();
669+ }
670+ toRemove .add (cursor );
668671 }
669672 }
670673 if (toRemove .size ()>0 )
671674 batchUpdateStmts .removeAll (toRemove );
672675 }
676+ public void flushAllBatchCursors () throws SQLException {
677+ log (GXDBDebug .LOG_MIN , "Scanning " + batchUpdateStmts .size () + " batch Stmts with pending updates" );
678+ for (int i = 0 ; i < batchUpdateStmts .size (); i ++) {
679+ BatchUpdateCursor cursor = (BatchUpdateCursor ) batchUpdateStmts .get (i );
680+ if (cursor .pendingRecords ())
681+ cursor .beforeCommitEvent ();
682+ }
683+ batchUpdateStmts .clear ();
684+ }
673685
674686 public void commit () throws SQLException
675687 {
676- flushBatchCursors ( null );
688+ flushAllBatchCursors ( );
677689
678690 if (DEBUG )
679691 {
Original file line number Diff line number Diff line change @@ -205,16 +205,17 @@ public boolean pendingRecords() {
205205 return mPreparedStatement .getRecordCount () > 0 ;
206206 }
207207
208- public boolean beforeCommitEvent (java .lang .Object o ) throws SQLException {
208+ public boolean isValidOwner (java .lang .Object o ) throws SQLException {
209+ return (o == null || o == mPreparedStatement .getOnCommitInstance ());
210+ }
211+ public boolean beforeCommitEvent () throws SQLException {
209212 boolean done = false ;
210- if (o == null || o == mPreparedStatement .getOnCommitInstance ()) {
211- try {
212- DynamicExecute .dynamicInstaceExecute (mPreparedStatement .getOnCommitInstance (),
213- mPreparedStatement .getOnCommitMethod (), null );
214- done = true ;
215- } catch (Exception ex ) {
216- throw new SQLException (ex .getMessage ());
217- }
213+ try {
214+ DynamicExecute .dynamicInstaceExecute (mPreparedStatement .getOnCommitInstance (),
215+ mPreparedStatement .getOnCommitMethod (), null );
216+ done = true ;
217+ } catch (Exception ex ) {
218+ throw new SQLException (ex .getMessage ());
218219 }
219220 return done ;
220221 }
Original file line number Diff line number Diff line change @@ -1016,20 +1016,32 @@ private void commit_impl() throws SQLException
10161016 }
10171017 public void flushBatchCursors (java .lang .Object o ) throws SQLException {
10181018 Vector <Cursor > toRemove = new Vector ();
1019+ log (GXDBDebug .LOG_MIN , "Scanning " + batchUpdateStmts .size () + " batch Stmts with pending updates" );
10191020 for (int i = 0 ; i < batchUpdateStmts .size (); i ++) {
10201021 BatchUpdateCursor cursor = (BatchUpdateCursor ) batchUpdateStmts .get (i );
1021- if (cursor .pendingRecords ()) {
1022- if (cursor .beforeCommitEvent (o ))
1023- toRemove .add (cursor );
1022+ if (cursor .isValidOwner (o )) {
1023+ if (cursor .pendingRecords ()) {
1024+ cursor .beforeCommitEvent ();
1025+ }
1026+ toRemove .add (cursor );
10241027 }
10251028 }
10261029 if (toRemove .size ()>0 )
10271030 batchUpdateStmts .removeAll (toRemove );
10281031 }
1032+ public void flushAllBatchCursors () throws SQLException {
1033+ log (GXDBDebug .LOG_MIN , "Scanning " + batchUpdateStmts .size () + " batch Stmts with pending updates" );
1034+ for (int i = 0 ; i < batchUpdateStmts .size (); i ++) {
1035+ BatchUpdateCursor cursor = (BatchUpdateCursor ) batchUpdateStmts .get (i );
1036+ if (cursor .pendingRecords ())
1037+ cursor .beforeCommitEvent ();
1038+ }
1039+ batchUpdateStmts .clear ();
1040+ }
10291041
10301042 public void commit () throws SQLException
10311043 {
1032- flushBatchCursors ( null );
1044+ flushAllBatchCursors ( );
10331045
10341046 if (DEBUG )
10351047 {
You can’t perform that action at this time.
0 commit comments