站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

SqlRowSet (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.jdbc.support.rowset
Interface SqlRowSet

All Superinterfaces:
Serializable
All Known Implementing Classes:
ResultSetWrappingSqlRowSet

public interface SqlRowSet
extends Serializable

Mirror interface for javax.sql.RowSet, representing disconnected java.sql.ResultSet data.

The main difference to the standard JDBC RowSet is that an SQLException is never thrown here. This allows a SqlRowSet to be used without having to deal with checked exceptions. A SqlRowSet will throw Spring's org.springframework.jdbc.InvalidResultSetAccessException instead (when appropriate).

Note: This interface extends the java.io.Serializable marker interface. Implementations, which typically hold disconnected data, are encouraged to be actually serializable (as far as possible).

Since:
1.2
Author:
Thomas Risberg, Juergen Hoeller
See Also:
RowSet, ResultSet, InvalidResultSetAccessException, JdbcTemplate.queryForRowSet(java.lang.String)

Method Summary
 boolean absolute(int row)
          Moves the cursor to the given row number in the RowSet, just after the last row.
 void afterLast()
          Moves the cursor to the end of this RowSet.
 void beforeFirst()
          Moves the cursor to the front of this RowSet, just before the first row.
 int findColumn(String columnName)
          Maps the given column name to its column index.
 boolean first()
          Moves the cursor to the first row of this RowSet.
 BigDecimal getBigDecimal(int columnIndex)
          Retrieves the value of the indicated column in the current row as an BigDecimal object.
 BigDecimal getBigDecimal(String columnName)
          Retrieves the value of the indicated column in the current row as an BigDecimal object.
 boolean getBoolean(int columnIndex)
          Retrieves the value of the indicated column in the current row as a boolean.
 boolean getBoolean(String columnName)
          Retrieves the value of the indicated column in the current row as a boolean.
 byte getByte(int columnIndex)
          Retrieves the value of the indicated column in the current row as a byte.
 byte getByte(String columnName)
          Retrieves the value of the indicated column in the current row as a byte.
 Date getDate(int columnIndex)
          Retrieves the value of the indicated column in the current row as a Date object.
 Date getDate(int columnIndex, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Date object.
 Date getDate(String columnName)
          Retrieves the value of the indicated column in the current row as a Date object.
 Date getDate(String columnName, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Date object.
 double getDouble(int columnIndex)
          Retrieves the value of the indicated column in the current row as a Double object.
 double getDouble(String columnName)
          Retrieves the value of the indicated column in the current row as a Double object.
 float getFloat(int columnIndex)
          Retrieves the value of the indicated column in the current row as a float.
 float getFloat(String columnName)
          Retrieves the value of the indicated column in the current row as a float.
 int getInt(int columnIndex)
          Retrieves the value of the indicated column in the current row as an int.
 int getInt(String columnName)
          Retrieves the value of the indicated column in the current row as an int.
 long getLong(int columnIndex)
          Retrieves the value of the indicated column in the current row as a long.
 long getLong(String columnName)
          Retrieves the value of the indicated column in the current row as a long.
 SqlRowSetMetaData getMetaData()
          Retrieves the meta data (number, types and properties for the columns) of this row set.
 Object getObject(int columnIndex)
          Retrieves the value of the indicated column in the current row as an Object.
 Object getObject(int columnIndex, Map map)
          Retrieves the value of the indicated column in the current row as an Object.
 Object getObject(String columnName)
          Retrieves the value of the indicated column in the current row as an Object.
 Object getObject(String columnName, Map map)
          Retrieves the value of the indicated column in the current row as an Object.
 int getRow()
          Retrieves the current row number.
 short getShort(int columnIndex)
          Retrieves the value of the indicated column in the current row as a short.
 short getShort(String columnName)
          Retrieves the value of the indicated column in the current row as a short.
 String getString(int columnIndex)
          Retrieves the value of the indicated column in the current row as a String.
 String getString(String columnName)
          Retrieves the value of the indicated column in the current row as a String.
 Time getTime(int columnIndex)
          Retrieves the value of the indicated column in the current row as a Time object.
 Time getTime(int columnIndex, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Time object.
 Time getTime(String columnName)
          Retrieves the value of the indicated column in the current row as a Time object.
 Time getTime(String columnName, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Time object.
 Timestamp getTimestamp(int columnIndex)
          Retrieves the value of the indicated column in the current row as a Timestamp object.
 Timestamp getTimestamp(int columnIndex, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Timestamp object.
 Timestamp getTimestamp(String columnName)
          Retrieves the value of the indicated column in the current row as a Timestamp object.
 Timestamp getTimestamp(String columnName, Calendar cal)
          Retrieves the value of the indicated column in the current row as a Timestamp object.
 boolean isAfterLast()
          Retrieves whether the cursor is after the last row of this RowSet.
 boolean isBeforeFirst()
          Retrieves whether the cursor is after the first row of this RowSet.
 boolean isFirst()
          Retrieves whether the cursor is on the first row of this RowSet.
 boolean isLast()
          Retrieves whether the cursor is on the last row of this RowSet.
 boolean last()
          Moves the cursor to the last row of this RowSet.
 boolean next()
          Moves the cursor to the next row.
 boolean previous()
          Moves the cursor to the previous row.
 boolean relative(int rows)
          Moves the cursor a relative number f rows, either positive or negative.
 boolean wasNull()
          Reports whether the last column read had a value of SQL NULL.
 

Method Detail

getMetaData

SqlRowSetMetaData getMetaData()
Retrieves the meta data (number, types and properties for the columns) of this row set.

Returns:
a corresponding SqlRowSetMetaData instance
See Also:
ResultSet.getMetaData()

findColumn

int findColumn(String columnName)
               throws InvalidResultSetAccessException
Maps the given column name to its column index.

Parameters:
columnName - the name of the column
Returns:
the column index for the given column name
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.findColumn(String)

getBigDecimal

BigDecimal getBigDecimal(int columnIndex)
                         throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an BigDecimal object.

Parameters:
columnIndex - the column index
Returns:
an BigDecimal object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getBigDecimal(int)

getBigDecimal

BigDecimal getBigDecimal(String columnName)
                         throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an BigDecimal object.

Parameters:
columnName - the column name
Returns:
an BigDecimal object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getBigDecimal(java.lang.String)

getBoolean

boolean getBoolean(int columnIndex)
                   throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a boolean.

Parameters:
columnIndex - the column index
Returns:
a boolean representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getBoolean(int)

getBoolean

boolean getBoolean(String columnName)
                   throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a boolean.

Parameters:
columnName - the column name
Returns:
a boolean representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getBoolean(java.lang.String)

getByte

byte getByte(int columnIndex)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a byte.

Parameters:
columnIndex - the column index
Returns:
a byte representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getByte(int)

getByte

byte getByte(String columnName)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a byte.

Parameters:
columnName - the column name
Returns:
a byte representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getByte(java.lang.String)

getDate

Date getDate(int columnIndex,
             Calendar cal)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Date object.

Parameters:
columnIndex - the column index
cal - the Calendar to use in constructing the Date
Returns:
a Date object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDate(int, java.util.Calendar)

getDate

Date getDate(int columnIndex)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Date object.

Parameters:
columnIndex - the column index
Returns:
a Date object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDate(int)

getDate

Date getDate(String columnName,
             Calendar cal)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Date object.

Parameters:
columnName - the column name
cal - the Calendar to use in constructing the Date
Returns:
a Date object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDate(java.lang.String, java.util.Calendar)

getDate

Date getDate(String columnName)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Date object.

Parameters:
columnName - the column name
Returns:
a Date object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDate(java.lang.String)

getDouble

double getDouble(int columnIndex)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Double object.

Parameters:
columnIndex - the column index
Returns:
a Double object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDouble(int)

getDouble

double getDouble(String columnName)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Double object.

Parameters:
columnName - the column name
Returns:
a Double object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getDouble(java.lang.String)

getFloat

float getFloat(int columnIndex)
               throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a float.

Parameters:
columnIndex - the column index
Returns:
a float representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getFloat(int)

getFloat

float getFloat(String columnName)
               throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a float.

Parameters:
columnName - the column name
Returns:
a float representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getFloat(java.lang.String)

getInt

int getInt(int columnIndex)
           throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an int.

Parameters:
columnIndex - the column index
Returns:
an int representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getInt(int)

getInt

int getInt(String columnName)
           throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an int.

Parameters:
columnName - the column name
Returns:
an int representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getInt(java.lang.String)

getLong

long getLong(int columnIndex)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a long.

Parameters:
columnIndex - the column index
Returns:
a long representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getLong(int)

getLong

long getLong(String columnName)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a long.

Parameters:
columnName - the column name
Returns:
a long representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getLong(java.lang.String)

getObject

Object getObject(int columnIndex,
                 Map map)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an Object.

Parameters:
columnIndex - the column index
map - a Map object containing the mapping from SQL types to Java types
Returns:
a Object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getObject(int, java.util.Map)

getObject

Object getObject(int columnIndex)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an Object.

Parameters:
columnIndex - the column index
Returns:
a Object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getObject(int)

getObject

Object getObject(String columnName,
                 Map map)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an Object.

Parameters:
columnName - the column name
map - a Map object containing the mapping from SQL types to Java types
Returns:
a Object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getObject(java.lang.String, java.util.Map)

getObject

Object getObject(String columnName)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as an Object.

Parameters:
columnName - the column name
Returns:
a Object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getObject(java.lang.String)

getShort

short getShort(int columnIndex)
               throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a short.

Parameters:
columnIndex - the column index
Returns:
a short representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getShort(int)

getShort

short getShort(String columnName)
               throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a short.

Parameters:
columnName - the column name
Returns:
a short representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getShort(java.lang.String)

getString

String getString(int columnIndex)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a String.

Parameters:
columnIndex - the column index
Returns:
a String representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getString(int)

getString

String getString(String columnName)
                 throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a String.

Parameters:
columnName - the column name
Returns:
a String representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getString(java.lang.String)

getTime

Time getTime(int columnIndex,
             Calendar cal)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Time object.

Parameters:
columnIndex - the column index
cal - the Calendar to use in constructing the Date
Returns:
a Time object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTime(int, java.util.Calendar)

getTime

Time getTime(int columnIndex)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Time object.

Parameters:
columnIndex - the column index
Returns:
a Time object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTime(int)

getTime

Time getTime(String columnName,
             Calendar cal)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Time object.

Parameters:
columnName - the column name
cal - the Calendar to use in constructing the Date
Returns:
a Time object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTime(java.lang.String, java.util.Calendar)

getTime

Time getTime(String columnName)
             throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Time object.

Parameters:
columnName - the column name
Returns:
a Time object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTime(java.lang.String)

getTimestamp

Timestamp getTimestamp(int columnIndex,
                       Calendar cal)
                       throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Timestamp object.

Parameters:
columnIndex - the column index
cal - the Calendar to use in constructing the Date
Returns:
a Timestamp object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTimestamp(int, java.util.Calendar)

getTimestamp

Timestamp getTimestamp(int columnIndex)
                       throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Timestamp object.

Parameters:
columnIndex - the column index
Returns:
a Timestamp object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTimestamp(int)

getTimestamp

Timestamp getTimestamp(String columnName,
                       Calendar cal)
                       throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Timestamp object.

Parameters:
columnName - the column name
cal - the Calendar to use in constructing the Date
Returns:
a Timestamp object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTimestamp(java.lang.String, java.util.Calendar)

getTimestamp

Timestamp getTimestamp(String columnName)
                       throws InvalidResultSetAccessException
Retrieves the value of the indicated column in the current row as a Timestamp object.

Parameters:
columnName - the column name
Returns:
a Timestamp object representing the column value
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getTimestamp(java.lang.String)

absolute

boolean absolute(int row)
                 throws InvalidResultSetAccessException
Moves the cursor to the given row number in the RowSet, just after the last row.

Parameters:
row - the number of the row where the cursor should move
Returns:
true if the cursor is on the RowSet, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.absolute(int)

afterLast

void afterLast()
               throws InvalidResultSetAccessException
Moves the cursor to the end of this RowSet.

Throws:
InvalidResultSetAccessException
See Also:
ResultSet.afterLast()

beforeFirst

void beforeFirst()
                 throws InvalidResultSetAccessException
Moves the cursor to the front of this RowSet, just before the first row.

Throws:
InvalidResultSetAccessException
See Also:
ResultSet.beforeFirst()

first

boolean first()
              throws InvalidResultSetAccessException
Moves the cursor to the first row of this RowSet.

Returns:
true if the cursor is on a valid row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.first()

getRow

int getRow()
           throws InvalidResultSetAccessException
Retrieves the current row number.

Returns:
the current row number
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.getRow()

isAfterLast

boolean isAfterLast()
                    throws InvalidResultSetAccessException
Retrieves whether the cursor is after the last row of this RowSet.

Returns:
true if the cursor is after the last row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.isAfterLast()

isBeforeFirst

boolean isBeforeFirst()
                      throws InvalidResultSetAccessException
Retrieves whether the cursor is after the first row of this RowSet.

Returns:
true if the cursor is after the first row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.isBeforeFirst()

isFirst

boolean isFirst()
                throws InvalidResultSetAccessException
Retrieves whether the cursor is on the first row of this RowSet.

Returns:
true if the cursor is after the first row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.isFirst()

isLast

boolean isLast()
               throws InvalidResultSetAccessException
Retrieves whether the cursor is on the last row of this RowSet.

Returns:
true if the cursor is after the last row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.isLast()

last

boolean last()
             throws InvalidResultSetAccessException
Moves the cursor to the last row of this RowSet.

Returns:
true if the cursor is on a valid row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.last()

next

boolean next()
             throws InvalidResultSetAccessException
Moves the cursor to the next row.

Returns:
true if the new row is valid, false if there are no more rows
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.next()

previous

boolean previous()
                 throws InvalidResultSetAccessException
Moves the cursor to the previous row.

Returns:
true if the new row is valid, false if it is off the RowSet
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.previous()

relative

boolean relative(int rows)
                 throws InvalidResultSetAccessException
Moves the cursor a relative number f rows, either positive or negative.

Returns:
true if the cursor is on a row, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.relative(int)

wasNull

boolean wasNull()
                throws InvalidResultSetAccessException
Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods and then call the wasNull method.

Returns:
true if the most recent coumn retrieved was SQL NULL, false otherwise
Throws:
InvalidResultSetAccessException
See Also:
ResultSet.wasNull()

The Spring Framework

Copyright © 2002-2007 The Spring Framework.