Class ResultImpl
- java.lang.Object
-
- org.apache.taglibs.standard.tag.common.sql.ResultImpl
-
- All Implemented Interfaces:
jakarta.servlet.jsp.jstl.sql.Result
public class ResultImpl extends Object implements jakarta.servlet.jsp.jstl.sql.Result
This class creates a cached version of a ResultSet. It's represented as a Result implementation, capable of returing an array of Row objects containing a Column instance for each column in the row.
Note -- this is a private copy for the RI to avoid making the corresponding class in jakarta.servlet.* public.
- Author:
- Hans Bergsten, Justyna Horwat
-
-
Constructor Summary
Constructors Constructor Description ResultImpl(ResultSet rs, int startRow, int maxRows)This constructor reads the ResultSet and saves a cached copy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]getColumnNames()Returns an array of String objects.intgetRowCount()Returns the number of rows in the cached ResultSetSortedMap[]getRows()Returns an array of SortedMap objects.Object[][]getRowsByIndex()Returns an array of Object[] objects.booleanisLimitedByMaxRows()Returns true of the query was limited by a maximum row setting
-
-
-
Constructor Detail
-
ResultImpl
public ResultImpl(ResultSet rs, int startRow, int maxRows) throws SQLException
This constructor reads the ResultSet and saves a cached copy.- Parameters:
rs- an open ResultSet, positioned before the first rowstartRow- beginning row to be cachedmaxRows- query maximum rows limit- Throws:
SQLException
-
-
Method Detail
-
getRows
public SortedMap[] getRows()
Returns an array of SortedMap objects. The SortedMap object key is the ColumnName and the value is the ColumnValue. SortedMap was created using the CASE_INSENSITIVE_ORDER Comparator so the key is the case insensitive representation of the ColumnName.- Specified by:
getRowsin interfacejakarta.servlet.jsp.jstl.sql.Result- Returns:
- an array of Map, or null if there are no rows
-
getRowsByIndex
public Object[][] getRowsByIndex()
Returns an array of Object[] objects. The first index designates the Row, the second the Column. The array stores the value at the specified row and column.- Specified by:
getRowsByIndexin interfacejakarta.servlet.jsp.jstl.sql.Result- Returns:
- an array of Object[], or null if there are no rows
-
getColumnNames
public String[] getColumnNames()
Returns an array of String objects. The array represents the names of the columns arranged in the same order as in the getRowsByIndex() method.- Specified by:
getColumnNamesin interfacejakarta.servlet.jsp.jstl.sql.Result- Returns:
- an array of String[]
-
getRowCount
public int getRowCount()
Returns the number of rows in the cached ResultSet- Specified by:
getRowCountin interfacejakarta.servlet.jsp.jstl.sql.Result- Returns:
- the number of cached rows, or -1 if the Result could not be initialized due to SQLExceptions
-
isLimitedByMaxRows
public boolean isLimitedByMaxRows()
Returns true of the query was limited by a maximum row setting- Specified by:
isLimitedByMaxRowsin interfacejakarta.servlet.jsp.jstl.sql.Result- Returns:
- true if the query was limited by a MaxRows attribute
-
-