src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java

Print this page

        

@@ -263,10 +263,11 @@
  *         written to the rowset's underlying data source;
  *         <code>false</code> otherwise
  */
     public boolean writeData(RowSetInternal caller) throws SQLException {
         boolean conflict = false;
+        int conflictNum = 0;
         boolean showDel = false;
         PreparedStatement pstmtIns = null;
         iChangedValsInDbAndCRS = 0;
         iChangedValsinDbOnly = 0;
 

@@ -337,10 +338,11 @@
         while (crs.next()) {
             if (crs.rowDeleted()) {
                 // The row has been deleted.
                 if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
                        status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
+                    conflictNum++;
                 } else {
                       // delete happened without any occurrence of conflicts
                       // so update status accordingly
                        status.add(rows, SyncResolver.NO_ROW_CONFLICT);
                 }

@@ -349,19 +351,21 @@
                 // The row has been inserted.
 
                 pstmtIns = con.prepareStatement(insertCmd);
                 if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
                           status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
+                    conflictNum++;
                 } else {
                       // insert happened without any occurrence of conflicts
                       // so update status accordingly
                        status.add(rows, SyncResolver.NO_ROW_CONFLICT);
                 }
             } else  if (crs.rowUpdated()) {
                   // The row has been updated.
                        if ( conflict = (updateOriginalRow(crs)) == true) {
                              status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
+                conflictNum++;
                } else {
                       // update happened without any occurrence of conflicts
                       // so update status accordingly
                       status.add(rows, SyncResolver.NO_ROW_CONFLICT);
                }

@@ -407,11 +411,13 @@
 
         crs.beforeFirst();
         this.crsResolve.beforeFirst();
 
     if(boolConf) {
-        SyncProviderException spe = new SyncProviderException(status.size() - 1+resBundle.handleGetObject("crswriter.conflictsno").toString());
+        SyncProviderException spe = new SyncProviderException(conflictNum + " "
+            + resBundle.handleGetObject("crswriter.conflictsno").toString());
+
         //SyncResolver syncRes = spe.getSyncResolver();
 
          SyncResolverImpl syncResImpl = (SyncResolverImpl) spe.getSyncResolver();
 
          syncResImpl.setCachedRowSet(crs);