/[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.4 by mark, Tue Jan 22 22:27:01 2002 UTC revision 1.5 by ericb, Sun Feb 24 04:25:17 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 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.
5    
# 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 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package java.sql;  package java.sql;
40    
41  /**  /**
42    * This class extends <code>SQLException</code> to count the successful   * This class extends <code>SQLException</code> to count the successful
43    * updates in each statement in a batch that was successfully updated prior   * updates in each statement in a batch that was successfully updated prior
44    * to the error.   * to the error. The driver may continue to process batch commands, in which
45    *   * case those commands also have an entry in the array. So, to tell which
46    * @author Aaron M. Renn (arenn@urbanophile.com)   * command failed, search for <code>Statement.EXECUTE_FAILED</code>.
47    */   *
48  public class BatchUpdateException extends SQLException   * @author Aaron M. Renn (arenn@urbanophile.com)
49  {   * @since 1.2
50     * @status updated to 1.4
 /*************************************************************************/  
   
 /*  
  * Instance Variables  
  */  
   
 /**  
   * This is the array of update counts for the commands which completed  
   * successfully prior to the error.  
   * @serialized  
   */  
 private int[] updateCounts;  
   
 /*************************************************************************/  
   
 /*  
  * Constructors  
  */  
   
 /**  
   * This method initializes a new instance of <code>BatchUpdateException</code>  
   * with no descriptive error message.  The SQL state and update count will  
   * be initialized to <code>null</code> and the vendor specific error code will  
   * initialized to 0.  
   */  
 public  
 BatchUpdateException()  
 {  
   super();  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>BatchUpdateException</code>  
   * with the specified update count information and no descriptive error  
   * message.  This SQL state will be initialized to <code>null</code> and  
   * the vendor specific error code will be initialized to 0.  
   *  
   * @param updateCounts The update count array.  
   */  
 public  
 BatchUpdateException(int[] updateCounts)  
 {  
   super();  
     
   this.updateCounts = updateCounts;  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>BatchUpdateException</code>  
   * with the specified descriptive error message and update count information.  
   * The SQL state will be initialized to <code>null</code> and the vendor  
   * specific error code will be initialized to 0.  
   *  
   * @param message The descriptive error message.  
   * @param updateCounts The update count information for this error.  
   */  
 public  
 BatchUpdateException(String message, int[] updateCounts)  
 {  
   super(message);  
   
   this.updateCounts = updateCounts;  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>BatchUpdateException</code>  
   * with the specified descriptive error message, SQL state, and update count  
   * information.  The vendor specific error code will be initialized to 0.  
   *  
   * @param message The descriptive error message.  
   * @param SQLState The SQL state information for this error.  
   * @param updateCounts The update count information for this error.  
   */  
 public  
 BatchUpdateException(String message, String SQLState, int[] updateCounts)  
 {  
   super(message, SQLState);  
   
   this.updateCounts = updateCounts;  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>BatchUpdateException</code>  
   * with the specified descriptive error message, SQL state, vendor  
   * specific error code and update count information.  
   *  
   * @param message The descriptive error message.  
   * @param SQLState 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.  
   */  
 public  
 BatchUpdateException(String message, String SQLState, int vendorCode,  
                      int[] updateCounts)  
 {  
   super(message, SQLState, vendorCode);  
   
   this.updateCounts = updateCounts;  
 }  
   
 /*************************************************************************/  
   
 /*  
  * Instance Methods  
51   */   */
52    public class BatchUpdateException extends SQLException
 /**  
   * This method returns the update count information for this error.  If  
   * not <code>null</code> this is an array of <code>int</code>'s that are  
   * the update accounts for each command that was successfully executed.  
   * The array elements are in the order that the commands were executed.  
   *  
   * @return The update count information, which may be <code>null</code>.  
   */  
 public int[]  
 getUpdateCounts()  
53  {  {
54    return(updateCounts);    /**
55  }     * Compatible with JDK 1.2+.
56       */
57      private static final long serialVersionUID = 5977529877145521757L;
58    
59      /**
60       * This is the array of update counts for the commands which completed
61       * successfully prior to the error.
62       *
63       * @serial the outcome of the batch execution
64       */
65      private final int[] updateCounts;
66    
67      /**
68       * Create a new instance with no descriptive error message.  The SQL state
69       * and update count will be initialized to <code>null</code> and the
70       * vendor specific error code will initialized to 0.
71       */
72      public BatchUpdateException()
73      {
74        this(null, null, 0, null);
75      }
76    
77      /**
78       * Create a new instance with the specified update count information and
79       * no descriptive error message.  This SQL state will be initialized to
80       * <code>null</code> and the vendor specific error code will be initialized
81       * to 0.
82       *
83       * @param updateCounts the update count array
84       */
85      public BatchUpdateException(int[] updateCounts)
86      {
87        this(null, null, 0, updateCounts);
88      }
89    
90      /**
91       * Create a new instance with the specified descriptive error message and
92       * update count information. The SQL state will be initialized to
93       * <code>null</code> and the vendor specific error code will be
94       * initialized to 0.
95       *
96       * @param message the descriptive error message
97       * @param updateCounts the update count information for this error
98       */
99      public BatchUpdateException(String message, int[] updateCounts)
100      {
101        this(message, null, 0, updateCounts);
102      }
103    
104      /**
105       * Create a new instance with the specified descriptive error message,
106       * SQL state, and update count information.  The vendor specific error
107       * code will be initialized to 0.
108       *
109       * @param message the descriptive error message
110       * @param state the SQL state information for this error
111       * @param updateCounts the update count information for this error
112       */
113      public BatchUpdateException(String message, String state,
114                                  int[] updateCounts)
115      {
116        this(message, state, 0, updateCounts);
117      }
118    
119      /**
120       * Create a new instance with the specified descriptive error message,
121       * SQL state, vendor specific error code and update count information.
122       *
123       * @param message the descriptive error message
124       * @param state the SQL state information for this error
125       * @param vendorCode the vendor specific error code for this error
126       * @param updateCounts the update count information for this error
127       */
128      public BatchUpdateException(String message, String state, int vendorCode,
129                                  int[] updateCounts)
130      {
131        super(message, state, vendorCode);
132        this.updateCounts = updateCounts;
133      }
134    
135      /**
136       * Get the update count information for this error.  If not
137       * <code>null</code>, this is an array of <code>int</code>'s that are
138       * the update accounts for each command that was successfully executed.
139       * The array elements are in the order that the commands were executed.
140       *
141       * @return the update count information, which may be <code>null</code>
142       */
143      public int[] getUpdateCounts()
144      {
145        return updateCounts;
146      }
147  } // class BatchUpdateException  } // class BatchUpdateException
   

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

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