Package java.sql

Examples of java.sql.BatchUpdateException


  private static final long serialVersionUID = -4004800841908629772L;

  private static SQLException findInterestingCause(SQLException e) {
    if (e instanceof BatchUpdateException) {
      BatchUpdateException b = (BatchUpdateException)e;
      logger.error(b.toString(), b);
      return b.getNextException();
    }
    return e;
  }
View Full Code Here


            updateCounts[i] = ((Integer) data[0]).intValue();
        }

        if (updateCounts.length != batchCount) {
            if (errorResult == null) {
                throw new BatchUpdateException(updateCounts);
            } else {
                errorResult.getMainString();

                throw new BatchUpdateException(errorResult.getMainString(),
                        errorResult.getSubString(),
                        errorResult.getErrorCode(), updateCounts);
            }
        }
View Full Code Here

            updateCounts[i] = ((Integer) data[0]).intValue();
        }

        if (updateCounts.length != batchCount) {
            if (errorResult == null) {
                throw new BatchUpdateException(updateCounts);
            } else {
                errorResult.getMainString();

                throw new BatchUpdateException(errorResult.getMainString(),
                        errorResult.getSubString(),
                        errorResult.getErrorCode(), updateCounts);
            }
        }
View Full Code Here

                rc = step(stmt);
                if (rc != SQLITE_DONE) {
                    reset(stmt);
                    if (rc == SQLITE_ROW)
                        throw new BatchUpdateException("batch entry " + i + ": query returns results", changes);
                    throwex();
                }

                changes[i] = changes();
            }
View Full Code Here

        updateCounts = resultIn.getUpdateCounts();

//#ifdef JAVA2
        if (updateCounts.length != batchCount) {
            throw new BatchUpdateException("failed batch", updateCounts);
        }

//#endif JAVA2
        return updateCounts;
    }
View Full Code Here

    }
   
    // Ensure BatchUpdateExceptions have matching update counts
    if ((exception1 instanceof BatchUpdateException) && (exception2 instanceof BatchUpdateException))
    {
      BatchUpdateException e1 = (BatchUpdateException) exception1;
      BatchUpdateException e2 = (BatchUpdateException) exception2;
     
      int[] counts1 = e1.getUpdateCounts();
      int[] counts2 = e2.getUpdateCounts();
     
      if ((counts1 != null) && (counts2 != null) ? !Arrays.equals(counts1, counts2) : (counts1 != counts2))
      {
        return false;
      }
    }
    else if ((exception1 instanceof SQLClientInfoException) && (exception2 instanceof SQLClientInfoException))
    {
      SQLClientInfoException e1 = (SQLClientInfoException) exception1;
      SQLClientInfoException e2 = (SQLClientInfoException) exception2;
     
      Map<String, ClientInfoStatus> map1 = e1.getFailedProperties();
      Map<String, ClientInfoStatus> map2 = e2.getFailedProperties();
     
      return (map1 != null) && (map2 != null) ? map1.equals(map2) : (map1 != map2);
    }
    else if ((exception1 instanceof DataTruncation) && (exception2 instanceof DataTruncation))
    {
      DataTruncation e1 = (DataTruncation) exception1;
      DataTruncation e2 = (DataTruncation) exception2;
     
      return (e1.getDataSize() == e2.getDataSize()) && (e1.getIndex() == e2.getIndex()) && (e1.getParameter() == e2.getParameter()) && (e1.getRead() == e2.getRead()) && (e1.getTransferSize() == e2.getTransferSize());
    }
   
    SQLException nextException1 = exception1.getNextException();
    SQLException nextException2 = exception2.getNextException();
   
View Full Code Here

      {
        this.indicatesFailure(String.format("%s%s000", alphabet[a], alphabet[b]));
      }
    }
    assertFalse(this.dialect.indicatesFailure(new SQLException()));
    assertFalse(this.dialect.indicatesFailure(new BatchUpdateException()));
    assertFalse(this.dialect.indicatesFailure(new RowSetWarning()));
    assertFalse(this.dialect.indicatesFailure(new SerialException()));
    assertFalse(this.dialect.indicatesFailure(new SQLClientInfoException()));
    assertFalse(this.dialect.indicatesFailure(new SQLNonTransientException()));
    assertFalse(this.dialect.indicatesFailure(new SQLDataException()));
View Full Code Here

      {
        this.indicatesFailure(String.format("%s%s000", alphabet[a], alphabet[b]));
      }
    }
    assertFalse(this.dialect.indicatesFailure(new SQLException()));
    assertFalse(this.dialect.indicatesFailure(new BatchUpdateException()));
    assertFalse(this.dialect.indicatesFailure(new RowSetWarning()));
    assertFalse(this.dialect.indicatesFailure(new SerialException()));
    assertFalse(this.dialect.indicatesFailure(new SQLClientInfoException()));
    assertFalse(this.dialect.indicatesFailure(new SQLNonTransientException()));
    assertFalse(this.dialect.indicatesFailure(new SQLDataException()));
View Full Code Here

            updateCounts[i] = ((Integer) data[0]).intValue();
        }

        if (updateCounts.length != batchCount) {
            if (errorResult == null) {
                throw new BatchUpdateException(updateCounts);
            } else {
                errorResult.getMainString();

                throw new BatchUpdateException(errorResult.getMainString(),
                        errorResult.getSubString(),
                        errorResult.getErrorCode(), updateCounts);
            }
        }
View Full Code Here

            updateCounts[i] = ((Integer) data[0]).intValue();
        }

        if (updateCounts.length != batchCount) {
            if (errorResult == null) {
                throw new BatchUpdateException(updateCounts);
            } else {
                errorResult.getMainString();

                throw new BatchUpdateException(errorResult.getMainString(),
                        errorResult.getSubString(),
                        errorResult.getErrorCode(), updateCounts);
            }
        }
View Full Code Here

TOP

Related Classes of java.sql.BatchUpdateException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.