/[classpath]/classpath/java/sql/BatchUpdateException.java
ViewVC logotype

Diff of /classpath/java/sql/BatchUpdateException.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by ericb, Sun Feb 24 04:25:17 2002 UTC revision 1.6 by bryce, Fri Jun 21 05:34:12 2002 UTC
# Line 1  Line 1 
1  /* BatchUpdateException.java -- exception for batch oriented SQL errors  /* BatchUpdateException.java -- Exception for batch oriented SQL errors
2     Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.     Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
# Line 7  GNU Classpath is free software; you can Line 7  GNU Classpath is free software; you can
7  it under the terms of the GNU General Public License as published by  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)  the Free Software Foundation; either version 2, or (at your option)
9  any later version.  any later version.
10    
11  GNU Classpath is distributed in the hope that it will be useful, but  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
   
38  package java.sql;  package java.sql;
39    
40  /**  /**
41   * This class extends <code>SQLException</code> to count the successful   * This class extends <code>SQLException</code> to count the successful
42   * updates in each statement in a batch that was successfully updated prior   * updates in each statement in a batch that was successfully updated prior
43   * to the error. The driver may continue to process batch commands, in which   * to the error.
  * case those commands also have an entry in the array. So, to tell which  
  * command failed, search for <code>Statement.EXECUTE_FAILED</code>.  
44   *   *
45   * @author Aaron M. Renn (arenn@urbanophile.com)   * @author Aaron M. Renn (arenn@urbanophile.com)
  * @since 1.2  
  * @status updated to 1.4  
46   */   */
47  public class BatchUpdateException extends SQLException  public class BatchUpdateException extends SQLException
48  {  {
49    /**    static final long serialVersionUID = 5977529877145521757L;
    * Compatible with JDK 1.2+.  
    */  
   private static final long serialVersionUID = 5977529877145521757L;  
50    
51    /**    /**
52     * This is the array of update counts for the commands which completed     * This is the array of update counts for the commands which completed
53     * successfully prior to the error.     * successfully prior to the error.
    *  
    * @serial the outcome of the batch execution  
54     */     */
55    private final int[] updateCounts;    private int[] updateCounts;
56    
57    /**    /**
58     * Create a new instance with no descriptive error message.  The SQL state     * This method initializes a new instance of <code>BatchUpdateException</code>
59     * and update count will be initialized to <code>null</code> and the     * with the specified descriptive error message, SQL state, and update count
60     * vendor specific error code will initialized to 0.     * information.  The vendor specific error code will be initialized to 0.
61       *
62       * @param message The descriptive error message.
63       * @param SQLState The SQL state information for this error.
64       * @param vendorCode
65       * @param updateCounts The update count information for this error.
66     */     */
67    public BatchUpdateException()    public BatchUpdateException(String message, String SQLState, int vendorCode,
68        int[] updateCounts)
69    {    {
70      this(null, null, 0, null);      super(message, SQLState, vendorCode);
71        this.updateCounts = updateCounts;
72    }    }
73    
74    /**    /**
75     * Create a new instance with the specified update count information and     * This method initializes a new instance of <code>BatchUpdateException</code>
76     * no descriptive error message.  This SQL state will be initialized to     * with the specified descriptive error message, SQL state, and update count
77     * <code>null</code> and the vendor specific error code will be initialized     * information.  The vendor specific error code will be initialized to 0.
    * to 0.  
78     *     *
79     * @param updateCounts the update count array     * @param message The descriptive error message.
80       * @param SQLState The SQL state information for this error.
81       * @param updateCounts The update count information for this error.
82     */     */
83    public BatchUpdateException(int[] updateCounts)    public BatchUpdateException(String message, String SQLState,
84        int[] updateCounts)
85    {    {
86      this(null, null, 0, updateCounts);      super(message, SQLState);
87        this.updateCounts = updateCounts;  
88    }    }
89    
90    /**    /**
91     * Create a new instance with the specified descriptive error message and     * This method initializes a new instance of <code>BatchUpdateException</code>
92     * update count information. The SQL state will be initialized to     * with the specified descriptive error message and update count information.
93     * <code>null</code> and the vendor specific error code will be     * The SQL state will be initialized to <code>null</code> and the vendor
94     * initialized to 0.     * specific error code will be initialized to 0.
95     *     *
96     * @param message the descriptive error message     * @param message The descriptive error message.
97     * @param updateCounts the update count information for this error     * @param updateCounts The update count information for this error.
98     */     */
99    public BatchUpdateException(String message, int[] updateCounts)    public BatchUpdateException(String message, int[] updateCounts)
100    {    {
101      this(message, null, 0, updateCounts);      super(message);
102        this.updateCounts = updateCounts;
103    }    }
104    
105    /**    /**
106     * Create a new instance with the specified descriptive error message,     * Initializes a new instance of <code>BatchUpdateException</code>
107     * SQL state, and update count information.  The vendor specific error     * with the specified update count information and no descriptive error
108     * code will be initialized to 0.     * message.  This SQL state will be initialized to <code>null</code> and
109       * the vendor specific error code will be initialized to 0.
110     *     *
111     * @param message the descriptive error message     * @param updateCounts The update count array.
    * @param state the SQL state information for this error  
    * @param updateCounts the update count information for this error  
112     */     */
113    public BatchUpdateException(String message, String state,    public BatchUpdateException(int[] updateCounts)
                               int[] updateCounts)  
114    {    {
115      this(message, state, 0, updateCounts);      this.updateCounts = updateCounts;
116    }    }
117    
118    /**    /**
119     * Create a new instance with the specified descriptive error message,     * Initializes a new instance of <code>BatchUpdateException</code>
120     * SQL state, vendor specific error code and update count information.     * with no descriptive error message.  The SQL state and update count will
121     *     * be initialized to <code>null</code> and the vendor specific error code will
122     * @param message the descriptive error message     * initialized to 0.
    * @param state the SQL state information for this error  
    * @param vendorCode the vendor specific error code for this error  
    * @param updateCounts the update count information for this error  
123     */     */
124    public BatchUpdateException(String message, String state, int vendorCode,    public BatchUpdateException()
                               int[] updateCounts)  
125    {    {
126      super(message, state, vendorCode);      super();
     this.updateCounts = updateCounts;  
127    }    }
128    
129    /**    /**
130     * Get the update count information for this error.  If not     * This method returns the update count information for this error.  If
131     * <code>null</code>, this is an array of <code>int</code>'s that are     * not <code>null</code> this is an array of <code>int</code>'s that are
132     * the update accounts for each command that was successfully executed.     * the update accounts for each command that was successfully executed.
133     * The array elements are in the order that the commands were executed.     * The array elements are in the order that the commands were executed.
134     *     *
135     * @return the update count information, which may be <code>null</code>     * @return The update count information, which may be <code>null</code>.
136     */     */
137    public int[] getUpdateCounts()    public int[] getUpdateCounts()
138    {    {
139      return updateCounts;      return updateCounts;
140    }    }
141  } // class BatchUpdateException  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26