OSDN Git Service

Start of AWT merge with Classpath:
[pf3gnuchains/gcc-fork.git] / libjava / java / sql / BatchUpdateException.java
1 /* BatchUpdateException.java -- Exception for batch oriented SQL errors
2    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
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)
9 any later version.
10  
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.
15
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
19 02111-1307 USA.
20
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. */
26
27
28 package java.sql;
29
30 /**
31   * This class extends <code>SQLException</code> to count the successful
32   * updates in each statement in a batch that was successfully updated prior 
33   * to the error.
34   *
35   * @author Aaron M. Renn (arenn@urbanophile.com)
36   */
37 public class BatchUpdateException extends SQLException 
38 {
39
40 /*************************************************************************/
41
42 /*
43  * Instance Variables
44  */
45
46 /**
47   * This is the array of update counts for the commands which completed
48   * successfully prior to the error.
49   * @serialized
50   */
51 private int[] updateCounts;
52
53 /*************************************************************************/
54
55 /*
56  * Constructors
57  */
58
59 /**
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 
63   * initialized to 0.
64   */
65 public
66 BatchUpdateException()
67 {
68   super();
69
70
71 /*************************************************************************/
72
73 /**
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.
78   *
79   * @param updateCounts The update count array.
80   */
81 public
82 BatchUpdateException(int[] updateCounts)
83 {
84   super();
85   
86   this.updateCounts = updateCounts;
87 }
88
89 /*************************************************************************/
90
91 /**
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.
96   *
97   * @param message The descriptive error message.
98   * @param updateCounts The update count information for this error.
99   */
100 public
101 BatchUpdateException(String message, int[] updateCounts)
102 {
103   super(message);
104
105   this.updateCounts = updateCounts;
106 }
107
108 /*************************************************************************/
109
110 /**
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.
114   *
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.
118   */
119 public
120 BatchUpdateException(String message, String SQLState, int[] updateCounts)
121 {
122   super(message, SQLState);
123
124   this.updateCounts = updateCounts;
125 }
126
127 /*************************************************************************/
128
129 /**
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.
133   *
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.
138   */
139 public
140 BatchUpdateException(String message, String SQLState, int vendorCode,
141                      int[] updateCounts)
142 {
143   super(message, SQLState, vendorCode);
144
145   this.updateCounts = updateCounts;
146 }
147
148 /*************************************************************************/
149
150 /*
151  * Instance Methods
152  */
153
154 /**
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.
159   *
160   * @return The update count information, which may be <code>null</code>.
161   */
162 public int[]
163 getUpdateCounts()
164 {
165   return(updateCounts);
166 }
167
168 } // class BatchUpdateException
169