KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > jsp > jstl > sql > Result


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package javax.servlet.jsp.jstl.sql;
18
19 import java.util.SortedMap JavaDoc;
20
21 /**
22  * <p>This interface represents the result of a &lt;sql:query&gt;
23  * action. It provides access to the following information in the
24  * query result:</p>
25  *
26  * <ul>
27  * <li> The result rows (<tt>getRows()</tt> and <tt>getRowsByIndex()</tt>)
28  * <li> The column names (<tt>getColumnNames()</tt>)
29  * <li> The number of rows in the result (<tt>getRowCount()</tt>)
30  * <li> An indication whether the rows returned represent the complete result
31  * or just a subset that is limited by a maximum row setting
32  * (<tt>isLimitedByMaxRows()</tt>)
33  * </ul>
34  *
35  * <p>An implementation of the <tt>Result</tt> interface provides a
36  * <i>disconnected</i> view into the result of a query.
37  *
38  * @author Justyna Horwat
39  *
40  */

41 public interface Result {
42
43     /**
44      * <p>Returns the result of the query as an array of <code>SortedMap</code> objects.
45      * Each item of the array represents a specific row in the query result.</p>
46      *
47      * <p>A row is structured as a <code>SortedMap</code> object where the key is the column name,
48      * and where the value is the value associated with the column identified by
49      * the key. The column value is an Object of the Java type corresponding
50      * to the mapping between column types and Java types defined by the JDBC
51      * specification when the <code>ResultSet.getObject()</code> method is used.</p>
52      *
53      * <p>The <code>SortedMap</code> must use the <code>Comparator</code>
54      * <code>java.util.String.CASE_INSENSITIVE_ORDER</code>.
55      * This makes it possible to access the key as a case insensitive representation
56      * of a column name. This method will therefore work regardless of the case of
57      * the column name returned by the database.</p>
58      *
59      * @return The result rows as an array of <code>SortedMap</code> objects
60      */

61     public SortedMap JavaDoc[] getRows();
62
63     /**
64      * Returns the result of the query as an array of arrays.
65      * The first array dimension represents a specific row in the query result.
66      * The array elements for each row are Object instances of the Java type
67      * corresponding to the mapping between column types and Java types defined
68      * by the JDBC specification when the <code>ResultSet.getObject()</code> method is used.
69      *
70      * @return the result rows as an array of <code>Object[]</code> objects
71      */

72     public Object JavaDoc[][] getRowsByIndex();
73
74     /**
75      * Returns the names of the columns in the result. The order of the names in the array
76      * matches the order in which columns are returned in method getRowsByIndex().
77      *
78      * @return the column names as an array of <code>String</code> objects
79      */

80     public String JavaDoc[] getColumnNames();
81
82     /**
83      * Returns the number of rows in the cached ResultSet
84      *
85      * @return the number of rows in the result
86      */

87     public int getRowCount();
88
89     /**
90      * Returns true if the query was limited by a maximum row setting
91      *
92      * @return <tt>true</tt> if the query was limited by a maximum
93      * row setting
94      */

95     public boolean isLimitedByMaxRows();
96 }
97
Popular Tags