KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > rowset > RowSetWarning


1 /*
2  * @(#)RowSetWarning.java 1.5 04/03/11
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sql.rowset;
9
10 import java.sql.SQLException JavaDoc;
11
12 /**
13  * An extension of <code>SQLException</code> that provides information
14  * about database warnings set on <code>RowSet</code> objects.
15  * Warnings are silently chained to the object whose method call
16  * caused it to be reported.
17  * This class complements the <code>SQLWarning</code> class.
18  * <P>
19  * Rowset warnings may be retrieved from <code>JdbcRowSet</code>,
20  * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup>,
21  * <code>WebRowSet</code>, <code>FilteredRowSet</code>, or <code>JoinRowSet</code>
22  * implementations. To retrieve the first warning reported on any
23  * <code>RowSet</code>
24  * implementation, use the method <code>getRowSetWarnings</code> defined
25  * in the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code>
26  * interface. To retrieve a warning chained to the first warning, use the
27  * <code>RowSetWarning</code> method
28  * <code>getNextWarning</code>. To retrieve subsequent warnings, call
29  * <code>getNextWarning</code> on each <code>RowSetWarning</code> object that is
30  * returned.
31  * <P>
32  * The inherited methods <code>getMessage</code>, <code>getSQLState</code>,
33  * and <code>getErrorCode</code> retrieve information contained in a
34  * <code>RowSetWarning</code> object.
35  */

36 public class RowSetWarning extends SQLException JavaDoc {
37     
38     /**
39      * RowSetWarning object handle.
40      */

41      private RowSetWarning JavaDoc rwarning;
42
43     /**
44      * Constructs a <code>RowSetWarning</code> object
45      * with the given value for the reason; SQLState defaults to null,
46      * and vendorCode defaults to 0.
47      *
48      * @param reason a <code>String</code> object giving a description
49      * of the warning; if the <code>String</code> is <code>null</code>,
50      * this constructor behaves like the default (zero parameter)
51      * <code>RowSetWarning</code> constructor
52      */

53     public RowSetWarning(String JavaDoc reason) {
54         super(reason);
55     }
56
57     /**
58      * Constructs a default <code>RowSetWarning</code> object. The reason
59      * defaults to <code>null</code>, SQLState defaults to null and vendorCode
60      * defaults to 0.
61      */

62     public RowSetWarning() {
63         super();
64     }
65     
66     /**
67      * Constructs a <code>RowSetWarning</code> object initialized with the
68      * given values for the reason and SQLState. The vendor code defaults to 0.
69      *
70      * If the <code>reason</code> or <code>SQLState</code> parameters are <code>null</code>,
71      * this constructor behaves like the default (zero parameter)
72      * <code>RowSetWarning</code> constructor.
73      *
74      * @param reason a <code>String</code> giving a description of the
75      * warning;
76      * @param SQLState an XOPEN code identifying the warning; if a non standard
77      * XOPEN <i>SQLState</i> is supplied, no exception is thrown.
78      */

79     public RowSetWarning(java.lang.String JavaDoc reason, java.lang.String JavaDoc SQLState) {
80         super(reason, SQLState);
81     }
82     
83     /**
84      * Constructs a fully specified <code>RowSetWarning</code> object initialized
85      * with the given values for the reason, SQLState and vendorCode.
86      *
87      * If the <code>reason</code>, or the <code>SQLState</code>
88      * parameters are <code>null</code>, this constructor behaves like the default
89      * (zero parameter) <code>RowSetWarning</code> constructor.
90      *
91      * @param reason a <code>String</code> giving a description of the
92      * warning;
93      * @param SQLState an XOPEN code identifying the warning; if a non standard
94      * XPOEN <i>SQLState</i> is supplied, no exception is thrown.
95      * @param vendorCode a database vendor-specific warning code
96      */

97     public RowSetWarning(java.lang.String JavaDoc reason, java.lang.String JavaDoc SQLState, int vendorCode) {
98         super(reason, SQLState, vendorCode);
99     }
100
101     /**
102      * Retrieves the warning chained to this <code>RowSetWarning</code>
103      * object.
104      *
105      * @return the <code>RowSetWarning</code> object chained to this one; if no
106      * <code>RowSetWarning</code> object is chained to this one,
107      * <code>null</code> is returned (default value)
108      * @see #setNextWarning
109      */

110     public RowSetWarning JavaDoc getNextWarning() {
111         return rwarning;
112     }
113     
114     /**
115      * Sets <i>warning</i> as the next warning, that is, the warning chained
116      * to this <code>RowSetWarning</code> object.
117      *
118      * @param warning the <code>RowSetWarning</code> object to be set as the
119      * next warning; if the <code>RowSetWarning</code> is null, this
120      * represents the finish point in the warning chain
121      * @see #getNextWarning
122      */

123     public void setNextWarning(RowSetWarning JavaDoc warning) {
124         rwarning = warning;
125     }
126     
127     static final long serialVersionUID = 6678332766434564774L;
128 }
129
Popular Tags