home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / sql / BatchUpdateException.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  3.0 KB  |  101 lines

  1. /*
  2.  * @(#)BatchUpdateException.java    1.3 98/03/18
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.sql;
  16.  
  17. /**
  18.  *  JDBC 2.0
  19.  *
  20.  *  <P>The BatchUpdateException class provides information on an error that
  21.  *  occurs during a batch update operation.  In addition to the information
  22.  *  provided by SQLException, a BatchUpdateException provides the update
  23.  *  counts for all commands that were executed successfully during the
  24.  *  batch update, i.e. all commands that were executed before the error 
  25.  *  occurred.  The order of elements in an array of update counts
  26.  *  corresponds to the order in which commands were added to the batch.
  27.  */
  28.  
  29. public class BatchUpdateException extends SQLException {
  30.  
  31.   /**
  32.    * Construct a fully specified BatchUpdateException.
  33.    *
  34.    * @param reason a description of the warning 
  35.    * @param SQLState an XOPEN code identifying the warning
  36.    * @param vendorCode a database vendor specific warning code
  37.    * @param updateCounts an array of update counts
  38.    */
  39.   public BatchUpdateException( String reason, String SQLState, int vendorCode, 
  40.                    int[] updateCounts ) {
  41.     super(reason, SQLState, vendorCode);
  42.     this.updateCounts = updateCounts;
  43.   }
  44.  
  45.   /**
  46.    * Construct a BatchUpdateException with a reason and SQLState;
  47.    * vendorCode defaults to 0.
  48.    *
  49.    * @param reason a description of the exception 
  50.    * @param SQLState an XOPEN code identifying the exception 
  51.    * @param updateCounts an array of update counts
  52.    */
  53.   public BatchUpdateException(String reason, String SQLState, 
  54.                   int[] updateCounts) {
  55.     super(reason, SQLState);
  56.     this.updateCounts = updateCounts;
  57.   }
  58.  
  59.   /**
  60.    * Construct a BatchUpdateException with a reason; SQLState defaults to
  61.    * null and vendorCode defaults to 0.
  62.    *
  63.    * @param reason a description of the exception 
  64.    * @param updateCounts an array of update counts
  65.    */
  66.   public  BatchUpdateException(String reason, int[] updateCounts) {
  67.     super(reason);
  68.     this.updateCounts = updateCounts;
  69.   }
  70.  
  71.   /**
  72.    * Construct a BatchUpdateException; reason defaults to null, SQLState
  73.    * defaults to null and vendorCode defaults to 0.
  74.    *
  75.    * @param updateCounts an array of update counts
  76.    */
  77.   public BatchUpdateException(int[] updateCounts) {
  78.     super();
  79.     this.updateCounts = updateCounts;
  80.   }
  81.  
  82.   /**
  83.    * Construct a BatchUpdateException; reason defaults to null, SQLState
  84.    * defaults to null and vendorCode defaults to 0.  UpdateCounts is null.
  85.    *
  86.    */
  87.   public BatchUpdateException() {
  88.     super();
  89.     this.updateCounts = null;
  90.   }
  91.  
  92.   /**
  93.    * Return the array of update counts.
  94.    */
  95.   public int[] getUpdateCounts() {
  96.     return updateCounts;
  97.   }
  98.  
  99.   private int[] updateCounts;
  100. }
  101.