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

Diff of /classpath/java/sql/SQLWarning.java

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

revision 1.6 by mark, Tue Jan 22 22:27:01 2002 UTC revision 1.7 by ericb, Sun Feb 24 04:25:17 2002 UTC
# Line 1  Line 1 
1  /* SQLWarning.java -- Database access warnings.  /* SQLWarning.java -- database access warnings
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 exception is thrown when a database warning occurs.   * This exception is thrown when a database warning occurs. Warnings are
43    *   * silently chained to the object which caused them.
44    * @author Aaron M. Renn (arenn@urbanophile.com)   *
45    */   * <p>Warnings may be retrieved from <code>Connection</code>,
46  public class SQLWarning extends SQLException   * <code>Statement</code>, and <code>ResultSet</code> objects. Trying to
47  {   * retrieve a warning one of these after it has been closed will cause an
48     * exception to be thrown. Note that closing a statement also closes a result
49  /*************************************************************************/   * set that it might have produced.
50     *
51  /**   * @author Aaron M. Renn (arenn@urbanophile.com)
52    * Static Variables   * @see Connection#getWarnings()
53    */   * @see Statement#getWarnings()
54     * @see ResultSet#getWarnings()
 /**  
   * This is the serialization UID for this class  
   */  
 private static final long serialVersionUID = 3917336774604784856L;  
   
 /*************************************************************************/  
   
 /*  
  * Constructors  
55   */   */
56    public class SQLWarning extends SQLException
 /**  
   * This method initializes a new instance of <code>SQLWarning</code>  
   * that does not have a descriptive messages and SQL state, and which  
   * has a vendor error code of 0.  
   */  
 public  
 SQLWarning()  
 {  
   this(null, null, 0);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>SQLWarning</code>  
   * with the specified descriptive error message.  The SQL state of this  
   * instance will be <code>null</code> and the vendor error code will be 0.  
   *  
   * @param message A string describing the nature of the error.  
   */  
 public  
 SQLWarning(String message)  
 {  
   this(message, null, 0);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a new instance of <code>SQLWarning</code>  
   * with the specified descriptive error message and SQL state string.  
   * The vendor error code of this instance will be 0.  
   *  
   * @param message A string describing the nature of the error.  
   * @param SQLState A string containing the SQL state of the error.  
   */  
 public  
 SQLWarning(String message, String SQLState)  
 {  
   this(message, SQLState, 0);  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method initializes a nwe instance of <code>SQLWarning</code>  
   * with the specified descriptive error message, SQL state string, and  
   * vendor code.  
   *  
   * @param message A string describing the nature of the error.  
   * @param SQLState A string containing the SQL state of the error.  
   * @param vendorCode The vendor error code associated with this error.  
   */  
 public  
 SQLWarning(String message, String SQLState, int vendorCode)  
 {  
   super(message, SQLState, vendorCode);  
 }  
   
 /*************************************************************************/  
   
 /*  
  * Instance Methods  
  */  
   
 /**  
   * This method returns the exception that is chained to this object.  
   *  
   * @return The exception chained to this object, which may be  
   * <code>null</code>.  
   */  
 public SQLWarning  
 getNextWarning()  
 {  
   return((SQLWarning)super.getNextException());  
 }  
   
 /*************************************************************************/  
   
 /**  
   * This method adds a new exception to the end of the chain of exceptions  
   * that are chained to this object.  
   *  
   * @param e The exception to add to the end of the chain.  
   */  
 public void  
 setNextWarning(SQLWarning e)  
57  {  {
58    super.setNextException(e);    /**
59  }     * Compatible with JDK 1.1+.
60       */
61      private static final long serialVersionUID = 3917336774604784856L;
62    
63      /**
64       * Create a new instance that does not have a descriptive messages or SQL
65       * state, and which has a vendor error code of 0.
66       */
67      public SQLWarning()
68      {
69      }
70    
71      /**
72       * Create a new instance with the specified descriptive error message.
73       * The SQL state of this instance will be <code>null</code> and the vendor
74       * error code will be 0.
75       *
76       * @param message a string describing the nature of the error
77       */
78      public SQLWarning(String message)
79      {
80        super(message);
81      }
82    
83      /**
84       * Create a new instance with the specified descriptive error message
85       * and SQL state string. The vendor error code of this instance will be 0.
86       *
87       * @param message a string describing the nature of the error
88       * @param SQLState a string containing the SQL state of the error
89       */
90      public SQLWarning(String message, String SQLState)
91      {
92        super(message, SQLState);
93      }
94    
95      /**
96       * Create a new instance with the specified descriptive error message,
97       * SQL state string, and vendor code.
98       *
99       * @param message a string describing the nature of the error
100       * @param SQLState a string containing the SQL state of the error
101       * @param vendorCode the vendor error code associated with this error
102       */
103      public SQLWarning(String message, String SQLState, int vendorCode)
104      {
105        super(message, SQLState, vendorCode);
106      }
107    
108      /**
109       * Get the warning that is chained to this object.
110       *
111       * @return the exception chained to this object, or null
112       * @throws Error if the next element is not an SQLWarning
113       */
114      public SQLWarning getNextWarning()
115      {
116        if (next == null)
117          return null;
118        if (! (next instanceof SQLWarning))
119          throw new Error("SQLWarning chain holds value that is not a SQLWarning");
120        return (SQLWarning) next;
121      }
122    
123      /**
124       * Set the new end of the warning chain.
125       *
126       * @param e the exception to add to the end of the chain
127       */
128      public void setNextWarning(SQLWarning e)
129      {
130        setNextException(e);
131      }
132  } // class SQLWarning  } // class SQLWarning
   

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

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