View Javadoc

1   /*
2    * Copyright 2002,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;
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> result rows
28   * <li> result rows using an index
29   * <li> number of rows in the result
30   * <li> result meta data
31   * <li> indication whether result returned is a complete set or
32   *      a subset limited by a maximum row setting
33   * </ul>
34   *
35   * @author Justyna Horwat
36   *
37   */
38  public interface Result {
39  
40      /***
41       * Returns an array of SortedMap objects. Column name is used as the key
42       * for the column value. SortedMap must use the CASE_INSENSITIVE_ORDER
43       * Comparator so that the key is the case insensitive representation
44       * of the column name.
45       *
46       * @return the result rows as an array of <code>SortedMap</code> objects
47       */
48      public SortedMap[] getRows();
49  
50      /***
51       * Returns an array of Objects[]. The first index
52       * designates the Row, the second the Column. The array
53       * stores the value at the specified row and column.
54       *
55       * @return the result rows as an array of <code>Object[]</code> objects
56       */
57      public Object[][] getRowsByIndex();
58  
59      /***
60       * Returns an array of column names.
61       *
62       * @return the column names as an array of <code>String</code> objects
63       */
64      public String[] getColumnNames();
65  
66      /***
67       * Returns the number of rows in the cached ResultSet
68       *
69       * @return the number of rows in the result
70       */
71      public int getRowCount();
72  
73      /***
74       * Returns true of the query was limited by a maximum row setting
75       *
76       * @return <tt>true</tt> if the query was limited by a maximum
77       * row setting
78       */
79      public boolean isLimitedByMaxRows();
80  }