1 /* BatchUpdateException.java -- Exception for batch oriented SQL errors
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
31 * This class extends <code>SQLException</code> to count the successful
32 * updates in each statement in a batch that was successfully updated prior
35 * @author Aaron M. Renn (arenn@urbanophile.com)
37 public class BatchUpdateException extends SQLException
40 /*************************************************************************/
47 * This is the array of update counts for the commands which completed
48 * successfully prior to the error.
51 private int[] updateCounts;
53 /*************************************************************************/
60 * This method initializes a new instance of <code>BatchUpdateException</code>
61 * with no descriptive error message. The SQL state and update count will
62 * be initialized to <code>null</code> and the vendor specific error code will
66 BatchUpdateException()
71 /*************************************************************************/
74 * This method initializes a new instance of <code>BatchUpdateException</code>
75 * with the specified update count information and no descriptive error
76 * message. This SQL state will be initialized to <code>null</code> and
77 * the vendor specific error code will be initialized to 0.
79 * @param updateCounts The update count array.
82 BatchUpdateException(int[] updateCounts)
86 this.updateCounts = updateCounts;
89 /*************************************************************************/
92 * This method initializes a new instance of <code>BatchUpdateException</code>
93 * with the specified descriptive error message and update count information.
94 * The SQL state will be initialized to <code>null</code> and the vendor
95 * specific error code will be initialized to 0.
97 * @param message The descriptive error message.
98 * @param updateCounts The update count information for this error.
101 BatchUpdateException(String message, int[] updateCounts)
105 this.updateCounts = updateCounts;
108 /*************************************************************************/
111 * This method initializes a new instance of <code>BatchUpdateException</code>
112 * with the specified descriptive error message, SQL state, and update count
113 * information. The vendor specific error code will be initialized to 0.
115 * @param message The descriptive error message.
116 * @param SQLState The SQL state information for this error.
117 * @param updateCounts The update count information for this error.
120 BatchUpdateException(String message, String SQLState, int[] updateCounts)
122 super(message, SQLState);
124 this.updateCounts = updateCounts;
127 /*************************************************************************/
130 * This method initializes a new instance of <code>BatchUpdateException</code>
131 * with the specified descriptive error message, SQL state, vendor
132 * specific error code and update count information.
134 * @param message The descriptive error message.
135 * @param SQLState The SQL state information for this error.
136 * @param vendorCode The vendor specific error code for this error.
137 * @param updateCounts The update count information for this error.
140 BatchUpdateException(String message, String SQLState, int vendorCode,
143 super(message, SQLState, vendorCode);
145 this.updateCounts = updateCounts;
148 /*************************************************************************/
155 * This method returns the update count information for this error. If
156 * not <code>null</code> this is an array of <code>int</code>'s that are
157 * the update accounts for each command that was successfully executed.
158 * The array elements are in the order that the commands were executed.
160 * @return The update count information, which may be <code>null</code>.
165 return(updateCounts);
168 } // class BatchUpdateException