src/share/classes/java/sql/BatchUpdateException.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,32 ****
--- 23,34 ----
* questions.
*/
package java.sql;
+ import java.util.Arrays;
+
/**
* The subclass of {@link SQLException} thrown when an error
* occurs during a batch update operation. In addition to the
* information provided by {@link SQLException}, a
* <code>BatchUpdateException</code> provides the update
*** 75,86 ****
* failure
* @since 1.2
*/
public BatchUpdateException( String reason, String SQLState, int vendorCode,
int[] updateCounts ) {
! super(reason, SQLState, vendorCode);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>reason</code>, <code>SQLState</code> and
--- 77,87 ----
* failure
* @since 1.2
*/
public BatchUpdateException( String reason, String SQLState, int vendorCode,
int[] updateCounts ) {
! this(reason, SQLState, vendorCode, updateCounts, null);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>reason</code>, <code>SQLState</code> and
*** 103,114 ****
* failure
* @since 1.2
*/
public BatchUpdateException(String reason, String SQLState,
int[] updateCounts) {
! super(reason, SQLState);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>reason</code> and <code>updateCounts</code>.
--- 104,114 ----
* failure
* @since 1.2
*/
public BatchUpdateException(String reason, String SQLState,
int[] updateCounts) {
! this(reason, SQLState, 0, updateCounts, null);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>reason</code> and <code>updateCounts</code>.
*** 130,141 ****
* prior to the failure for JDBC drivers that stop processing after a command
* failure
* @since 1.2
*/
public BatchUpdateException(String reason, int[] updateCounts) {
! super(reason);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>updateCounts</code>.
--- 130,140 ----
* prior to the failure for JDBC drivers that stop processing after a command
* failure
* @since 1.2
*/
public BatchUpdateException(String reason, int[] updateCounts) {
! this(reason, null, 0, updateCounts, null);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a given
* <code>updateCounts</code>.
*** 154,165 ****
* prior to the failure for JDBC drivers that stop processing after a command
* failure
* @since 1.2
*/
public BatchUpdateException(int[] updateCounts) {
! super();
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object.
* The <code>reason</code>, <code>SQLState</code> and <code>updateCounts</code>
--- 153,163 ----
* prior to the failure for JDBC drivers that stop processing after a command
* failure
* @since 1.2
*/
public BatchUpdateException(int[] updateCounts) {
! this(null, null, 0, updateCounts, null);
}
/**
* Constructs a <code>BatchUpdateException</code> object.
* The <code>reason</code>, <code>SQLState</code> and <code>updateCounts</code>
*** 170,181 ****
* <p>
*
* @since 1.2
*/
public BatchUpdateException() {
! super();
! this.updateCounts = null;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>cause</code>.
--- 168,178 ----
* <p>
*
* @since 1.2
*/
public BatchUpdateException() {
! this(null, null, 0, null, null);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>cause</code>.
*** 189,200 ****
* (which is saved for later retrieval by the <code>getCause()</code> method);
* may be null indicating the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(Throwable cause) {
! super(cause);
! this.updateCounts = null;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a
* given <code>cause</code> and <code>updateCounts</code>.
--- 186,196 ----
* (which is saved for later retrieval by the <code>getCause()</code> method);
* may be null indicating the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(Throwable cause) {
! this(null, null, 0, null, cause);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with a
* given <code>cause</code> and <code>updateCounts</code>.
*** 216,227 ****
* (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(int []updateCounts , Throwable cause) {
! super(cause);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>cause</code>
--- 212,222 ----
* (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(int []updateCounts , Throwable cause) {
! this(null, null, 0, updateCounts, cause);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>cause</code>
*** 241,252 ****
* may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, int []updateCounts, Throwable cause) {
! super(reason,cause);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>SQLState</code>,<code>cause</code>, and
--- 236,246 ----
* may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, int []updateCounts, Throwable cause) {
! this(reason, null, 0, updateCounts, cause);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>SQLState</code>,<code>cause</code>, and
*** 267,278 ****
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, String SQLState,
int []updateCounts, Throwable cause) {
! super(reason,SQLState,cause);
! this.updateCounts = updateCounts;
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
--- 261,271 ----
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, String SQLState,
int []updateCounts, Throwable cause) {
! this(reason, SQLState, 0, updateCounts, cause);
}
/**
* Constructs a <code>BatchUpdateException</code> object initialized with
* a given <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
*** 295,306 ****
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, String SQLState, int vendorCode,
int []updateCounts,Throwable cause) {
! super(reason,SQLState,vendorCode,cause);
! this.updateCounts = updateCounts;
}
/**
* Retrieves the update count for each update statement in the batch
* update that executed successfully before this exception occurred.
--- 288,301 ----
* the cause is non-existent or unknown.
* @since 1.6
*/
public BatchUpdateException(String reason, String SQLState, int vendorCode,
int []updateCounts,Throwable cause) {
! super(reason, SQLState, vendorCode, cause);
! if(updateCounts != null) {
! this.updateCounts = Arrays.copyOf(updateCounts, updateCounts.length);
! }
}
/**
* Retrieves the update count for each update statement in the batch
* update that executed successfully before this exception occurred.
*** 330,340 ****
* failed to execute successfully
* </OL>
* @since 1.3
*/
public int[] getUpdateCounts() {
! return updateCounts;
}
/**
* The array that describes the outcome of a batch execution.
* @serial
--- 325,335 ----
* failed to execute successfully
* </OL>
* @since 1.3
*/
public int[] getUpdateCounts() {
! return updateCounts != null ? Arrays.copyOf(updateCounts, updateCounts.length) : null;
}
/**
* The array that describes the outcome of a batch execution.
* @serial