Hi
I changed the way to fix this.

Using undo log and rollback method seems more simple.
I just added undo log index and rollback method if it catches
DbException.
I really appreciate if anyone has comments on this.


        public void updateRows(Prepared prepared, Session session, RowList
rows) {
                // ADD MAY 21,2012
                int rollback = session.getUndoLogPos();
                // ADD MAY 21,2012
                // remove the old rows
                int rowScanCount = 0;
                for (rows.reset(); rows.hasNext();) {
                        if ((++rowScanCount & 127) == 0) {
                                prepared.checkCanceled();
                        }
                        Row o = rows.next();
                        rows.next();
                        removeRow(session, o);
                        session.log(this, UndoLogRecord.DELETE, o);
                }
                // add the new rows
                for (rows.reset(); rows.hasNext();) {
                        if ((++rowScanCount & 127) == 0) {
                                prepared.checkCanceled();
                        }
                        rows.next();
                        Row n = rows.next();
                        // <==ADD MAY 21,2012
                        try {
                                // ==>ADD MAY 21,2012
                                addRow(session, n);
                                // <==ADD MAY 21,2012
                        } catch (DbException e) {
                                if (e.getErrorCode() == 
ErrorCode.CONCURRENT_UPDATE_1) {
                                        session.rollbackTo(rollback, false);
                                }
                                throw e;
                        }
                        // ==>ADD MAY 21,2012
                        session.log(this, UndoLogRecord.INSERT, n);
                }
        }

Thanks!

-- 
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