接口 SqlRowSet
- 所有超级接口:
Serializable
- 所有已知实现类:
ResultSetWrappingSqlRowSet
public interface SqlRowSet extends Serializable
Mirror interface forRowSet
, representing a disconnected variant ofResultSet
data.The main difference to the standard JDBC RowSet is that a
SQLException
is never thrown here. This allows an SqlRowSet to be used without having to deal with checked exceptions. An SqlRowSet will throw Spring'sInvalidResultSetAccessException
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).- 从以下版本开始:
- 1.2
- 作者:
- Thomas Risberg, Juergen Hoeller
- 另请参阅:
RowSet
,ResultSet
,InvalidResultSetAccessException
,JdbcTemplate.queryForRowSet(java.lang.String)
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 boolean
absolute(int row)
Move the cursor to the given row number in the row set, just after the last row.void
afterLast()
Move the cursor to the end of this row set.void
beforeFirst()
Move the cursor to the front of this row set, just before the first row.int
findColumn(String columnLabel)
Map the given column label to its column index.boolean
first()
Move the cursor to the first row of this row set.BigDecimal
getBigDecimal(int columnIndex)
Retrieve the value of the indicated column in the current row as a BigDecimal object.BigDecimal
getBigDecimal(String columnLabel)
Retrieve the value of the indicated column in the current row as a BigDecimal object.boolean
getBoolean(int columnIndex)
Retrieve the value of the indicated column in the current row as a boolean.boolean
getBoolean(String columnLabel)
Retrieve the value of the indicated column in the current row as a boolean.byte
getByte(int columnIndex)
Retrieve the value of the indicated column in the current row as a byte.byte
getByte(String columnLabel)
Retrieve the value of the indicated column in the current row as a byte.Date
getDate(int columnIndex)
Retrieve the value of the indicated column in the current row as a Date object.Date
getDate(int columnIndex, Calendar cal)
Retrieve the value of the indicated column in the current row as a Date object.Date
getDate(String columnLabel)
Retrieve the value of the indicated column in the current row as a Date object.Date
getDate(String columnLabel, Calendar cal)
Retrieve the value of the indicated column in the current row as a Date object.double
getDouble(int columnIndex)
Retrieve the value of the indicated column in the current row as a Double object.double
getDouble(String columnLabel)
Retrieve the value of the indicated column in the current row as a Double object.float
getFloat(int columnIndex)
Retrieve the value of the indicated column in the current row as a float.float
getFloat(String columnLabel)
Retrieve the value of the indicated column in the current row as a float.int
getInt(int columnIndex)
Retrieve the value of the indicated column in the current row as an int.int
getInt(String columnLabel)
Retrieve the value of the indicated column in the current row as an int.long
getLong(int columnIndex)
Retrieve the value of the indicated column in the current row as a long.long
getLong(String columnLabel)
Retrieve the value of the indicated column in the current row as a long.SqlRowSetMetaData
getMetaData()
Retrieve the meta-data, i.e. number, types and properties for the columns of this row set.String
getNString(int columnIndex)
Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).String
getNString(String columnLabel)
Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).Object
getObject(int columnIndex)
Retrieve the value of the indicated column in the current row as an Object.<T> T
getObject(int columnIndex, Class<T> type)
Retrieve the value of the indicated column in the current row as an Object.Object
getObject(int columnIndex, Map<String,Class<?>> map)
Retrieve the value of the indicated column in the current row as an Object.Object
getObject(String columnLabel)
Retrieve the value of the indicated column in the current row as an Object.<T> T
getObject(String columnLabel, Class<T> type)
Retrieve the value of the indicated column in the current row as an Object.Object
getObject(String columnLabel, Map<String,Class<?>> map)
Retrieve the value of the indicated column in the current row as an Object.int
getRow()
Retrieve the current row number.short
getShort(int columnIndex)
Retrieve the value of the indicated column in the current row as a short.short
getShort(String columnLabel)
Retrieve the value of the indicated column in the current row as a short.String
getString(int columnIndex)
Retrieve the value of the indicated column in the current row as a String.String
getString(String columnLabel)
Retrieve the value of the indicated column in the current row as a String.Time
getTime(int columnIndex)
Retrieve the value of the indicated column in the current row as a Time object.Time
getTime(int columnIndex, Calendar cal)
Retrieve the value of the indicated column in the current row as a Time object.Time
getTime(String columnLabel)
Retrieve the value of the indicated column in the current row as a Time object.Time
getTime(String columnLabel, Calendar cal)
Retrieve the value of the indicated column in the current row as a Time object.Timestamp
getTimestamp(int columnIndex)
Retrieve the value of the indicated column in the current row as a Timestamp object.Timestamp
getTimestamp(int columnIndex, Calendar cal)
Retrieve the value of the indicated column in the current row as a Timestamp object.Timestamp
getTimestamp(String columnLabel)
Retrieve the value of the indicated column in the current row as a Timestamp object.Timestamp
getTimestamp(String columnLabel, Calendar cal)
Retrieve the value of the indicated column in the current row as a Timestamp object.boolean
isAfterLast()
Retrieve whether the cursor is after the last row of this row set.boolean
isBeforeFirst()
Retrieve whether the cursor is before the first row of this row set.boolean
isFirst()
Retrieve whether the cursor is on the first row of this row set.boolean
isLast()
Retrieve whether the cursor is on the last row of this row set.boolean
last()
Move the cursor to the last row of this row set.boolean
next()
Move the cursor to the next row.boolean
previous()
Move the cursor to the previous row.boolean
relative(int rows)
Move the cursor a relative number of rows, either positive or negative.boolean
wasNull()
Report whether the last column read had a value of SQLNULL
.
方法详细资料
getMetaData
SqlRowSetMetaData getMetaData()
Retrieve the meta-data, i.e. number, types and properties for the columns of this row set.- 返回:
- a corresponding SqlRowSetMetaData instance
- 另请参阅:
ResultSet.getMetaData()
findColumn
int findColumn(String columnLabel) throws InvalidResultSetAccessException
Map the given column label to its column index.- 参数:
columnLabel
- the name of the column- 返回:
- the column index for the given column label
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.findColumn(String)
getBigDecimal
@Nullable BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a BigDecimal object.- 参数:
columnIndex
- the column index- 返回:
- an BigDecimal object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getBigDecimal(int)
getBigDecimal
@Nullable BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a BigDecimal object.- 参数:
columnLabel
- the column label- 返回:
- an BigDecimal object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getBigDecimal(String)
getBoolean
boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a boolean.- 参数:
columnIndex
- the column index- 返回:
- a boolean representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getBoolean(int)
getBoolean
boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a boolean.- 参数:
columnLabel
- the column label- 返回:
- a boolean representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getBoolean(String)
getByte
byte getByte(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a byte.- 参数:
columnIndex
- the column index- 返回:
- a byte representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getByte(int)
getByte
byte getByte(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a byte.- 参数:
columnLabel
- the column label- 返回:
- a byte representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getByte(String)
getDate
@Nullable Date getDate(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Date object.- 参数:
columnIndex
- the column index- 返回:
- a Date object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDate(int)
getDate
@Nullable Date getDate(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Date object.- 参数:
columnLabel
- the column label- 返回:
- a Date object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDate(String)
getDate
@Nullable Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Date object.- 参数:
columnIndex
- the column indexcal
- the Calendar to use in constructing the Date- 返回:
- a Date object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDate(int, Calendar)
getDate
@Nullable Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Date object.- 参数:
columnLabel
- the column labelcal
- the Calendar to use in constructing the Date- 返回:
- a Date object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDate(String, Calendar)
getDouble
double getDouble(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Double object.- 参数:
columnIndex
- the column index- 返回:
- a Double object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDouble(int)
getDouble
double getDouble(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Double object.- 参数:
columnLabel
- the column label- 返回:
- a Double object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getDouble(String)
getFloat
float getFloat(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a float.- 参数:
columnIndex
- the column index- 返回:
- a float representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getFloat(int)
getFloat
float getFloat(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a float.- 参数:
columnLabel
- the column label- 返回:
- a float representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getFloat(String)
getInt
int getInt(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an int.- 参数:
columnIndex
- the column index- 返回:
- an int representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getInt(int)
getInt
int getInt(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an int.- 参数:
columnLabel
- the column label- 返回:
- an int representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getInt(String)
getLong
long getLong(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a long.- 参数:
columnIndex
- the column index- 返回:
- a long representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getLong(int)
getLong
long getLong(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a long.- 参数:
columnLabel
- the column label- 返回:
- a long representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getLong(String)
getNString
@Nullable String getNString(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).- 参数:
columnIndex
- the column index- 返回:
- a String representing the column value
- 抛出:
InvalidResultSetAccessException
- 从以下版本开始:
- 4.1.3
- 另请参阅:
ResultSet.getNString(int)
getNString
@Nullable String getNString(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).- 参数:
columnLabel
- the column label- 返回:
- a String representing the column value
- 抛出:
InvalidResultSetAccessException
- 从以下版本开始:
- 4.1.3
- 另请参阅:
ResultSet.getNString(String)
getObject
@Nullable Object getObject(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnIndex
- the column index- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getObject(int)
getObject
@Nullable Object getObject(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnLabel
- the column label- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getObject(String)
getObject
@Nullable Object getObject(int columnIndex, Map<String,Class<?>> map) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnIndex
- the column indexmap
- a Map object containing the mapping from SQL types to Java types- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getObject(int, Map)
getObject
@Nullable Object getObject(String columnLabel, Map<String,Class<?>> map) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnLabel
- the column labelmap
- a Map object containing the mapping from SQL types to Java types- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getObject(String, Map)
getObject
@Nullable <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnIndex
- the column indextype
- the Java type to convert the designated column to- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 从以下版本开始:
- 4.1.3
- 另请参阅:
ResultSet.getObject(int, Class)
getObject
@Nullable <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as an Object.- 参数:
columnLabel
- the column labeltype
- the Java type to convert the designated column to- 返回:
- a Object representing the column value
- 抛出:
InvalidResultSetAccessException
- 从以下版本开始:
- 4.1.3
- 另请参阅:
ResultSet.getObject(String, Class)
getShort
short getShort(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a short.- 参数:
columnIndex
- the column index- 返回:
- a short representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getShort(int)
getShort
short getShort(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a short.- 参数:
columnLabel
- the column label- 返回:
- a short representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getShort(String)
getString
@Nullable String getString(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a String.- 参数:
columnIndex
- the column index- 返回:
- a String representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getString(int)
getString
@Nullable String getString(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a String.- 参数:
columnLabel
- the column label- 返回:
- a String representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getString(String)
getTime
@Nullable Time getTime(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Time object.- 参数:
columnIndex
- the column index- 返回:
- a Time object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTime(int)
getTime
@Nullable Time getTime(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Time object.- 参数:
columnLabel
- the column label- 返回:
- a Time object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTime(String)
getTime
@Nullable Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Time object.- 参数:
columnIndex
- the column indexcal
- the Calendar to use in constructing the Date- 返回:
- a Time object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTime(int, Calendar)
getTime
@Nullable Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Time object.- 参数:
columnLabel
- the column labelcal
- the Calendar to use in constructing the Date- 返回:
- a Time object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTime(String, Calendar)
getTimestamp
@Nullable Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Timestamp object.- 参数:
columnIndex
- the column index- 返回:
- a Timestamp object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTimestamp(int)
getTimestamp
@Nullable Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Timestamp object.- 参数:
columnLabel
- the column label- 返回:
- a Timestamp object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTimestamp(String)
getTimestamp
@Nullable Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Timestamp object.- 参数:
columnIndex
- the column indexcal
- the Calendar to use in constructing the Date- 返回:
- a Timestamp object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTimestamp(int, Calendar)
getTimestamp
@Nullable Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException
Retrieve the value of the indicated column in the current row as a Timestamp object.- 参数:
columnLabel
- the column labelcal
- the Calendar to use in constructing the Date- 返回:
- a Timestamp object representing the column value
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getTimestamp(String, Calendar)
absolute
boolean absolute(int row) throws InvalidResultSetAccessException
Move the cursor to the given row number in the row set, just after the last row.- 参数:
row
- the number of the row where the cursor should move- 返回:
true
if the cursor is on the row set,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.absolute(int)
afterLast
void afterLast() throws InvalidResultSetAccessException
Move the cursor to the end of this row set.
beforeFirst
void beforeFirst() throws InvalidResultSetAccessException
Move the cursor to the front of this row set, just before the first row.
first
boolean first() throws InvalidResultSetAccessException
Move the cursor to the first row of this row set.- 返回:
true
if the cursor is on a valid row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.first()
getRow
int getRow() throws InvalidResultSetAccessException
Retrieve the current row number.- 返回:
- the current row number
- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.getRow()
isAfterLast
boolean isAfterLast() throws InvalidResultSetAccessException
Retrieve whether the cursor is after the last row of this row set.- 返回:
true
if the cursor is after the last row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.isAfterLast()
isBeforeFirst
boolean isBeforeFirst() throws InvalidResultSetAccessException
Retrieve whether the cursor is before the first row of this row set.- 返回:
true
if the cursor is before the first row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.isBeforeFirst()
isFirst
boolean isFirst() throws InvalidResultSetAccessException
Retrieve whether the cursor is on the first row of this row set.- 返回:
true
if the cursor is after the first row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.isFirst()
isLast
boolean isLast() throws InvalidResultSetAccessException
Retrieve whether the cursor is on the last row of this row set.- 返回:
true
if the cursor is after the last row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.isLast()
last
boolean last() throws InvalidResultSetAccessException
Move the cursor to the last row of this row set.- 返回:
true
if the cursor is on a valid row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.last()
next
boolean next() throws InvalidResultSetAccessException
Move the cursor to the next row.- 返回:
true
if the new row is valid,false
if there are no more rows- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.next()
previous
boolean previous() throws InvalidResultSetAccessException
Move the cursor to the previous row.- 返回:
true
if the new row is valid,false
if it is off the row set- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.previous()
relative
boolean relative(int rows) throws InvalidResultSetAccessException
Move the cursor a relative number of rows, either positive or negative.- 返回:
true
if the cursor is on a row,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.relative(int)
wasNull
boolean wasNull() throws InvalidResultSetAccessException
Report whether the last column read had a value of SQLNULL
.Note that you must first call one of the getter methods and then call the
wasNull()
method.- 返回:
true
if the most recent column retrieved was SQLNULL
,false
otherwise- 抛出:
InvalidResultSetAccessException
- 另请参阅:
ResultSet.wasNull()