Browse Source

Revised SqlRowSet javadoc and support for JDBC 4.x ResultSet additions

Issue: SPR-12476
Issue: SPR-12480
pull/701/head
Juergen Hoeller 11 years ago
parent
commit
fc92c0010e
  1. 150
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java
  2. 357
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java

150
spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java

@ -221,12 +221,12 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getDate(int, java.util.Calendar) * @see java.sql.ResultSet#getDate(int)
*/ */
@Override @Override
public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException { public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
try { try {
return this.resultSet.getDate(columnIndex, cal); return this.resultSet.getDate(columnIndex);
} }
catch (SQLException se) { catch (SQLException se) {
throw new InvalidResultSetAccessException(se); throw new InvalidResultSetAccessException(se);
@ -234,33 +234,34 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getDate(int) * @see java.sql.ResultSet#getDate(String)
*/ */
@Override @Override
public Date getDate(int columnIndex) throws InvalidResultSetAccessException { public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel));
}
/**
* @see java.sql.ResultSet#getDate(int, Calendar)
*/
@Override
public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try { try {
return this.resultSet.getDate(columnIndex); return this.resultSet.getDate(columnIndex, cal);
} }
catch (SQLException se) { catch (SQLException se) {
throw new InvalidResultSetAccessException(se); throw new InvalidResultSetAccessException(se);
} }
} }
/** /**
* @see java.sql.ResultSet#getDate(String, java.util.Calendar) * @see java.sql.ResultSet#getDate(String, Calendar)
*/ */
@Override @Override
public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException { public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel), cal); return getDate(findColumn(columnLabel), cal);
} }
/**
* @see java.sql.ResultSet#getDate(String)
*/
@Override
public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel));
}
/** /**
* @see java.sql.ResultSet#getDouble(int) * @see java.sql.ResultSet#getDouble(int)
*/ */
@ -302,6 +303,7 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
public float getFloat(String columnLabel) throws InvalidResultSetAccessException { public float getFloat(String columnLabel) throws InvalidResultSetAccessException {
return getFloat(findColumn(columnLabel)); return getFloat(findColumn(columnLabel));
} }
/** /**
* @see java.sql.ResultSet#getInt(int) * @see java.sql.ResultSet#getInt(int)
*/ */
@ -345,18 +347,26 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getObject(int, java.util.Map) * @see java.sql.ResultSet#getNString(int)
*/ */
@Override @Override
public Object getObject(int i, Map<String, Class<?>> map) throws InvalidResultSetAccessException { public String getNString(int columnIndex) throws InvalidResultSetAccessException {
try { try {
return this.resultSet.getObject(i, map); return this.resultSet.getNString(columnIndex);
} }
catch (SQLException se) { catch (SQLException se) {
throw new InvalidResultSetAccessException(se); throw new InvalidResultSetAccessException(se);
} }
} }
/**
* @see java.sql.ResultSet#getNString(String)
*/
@Override
public String getNString(String columnLabel) throws InvalidResultSetAccessException {
return getNString(findColumn(columnLabel));
}
/** /**
* @see java.sql.ResultSet#getObject(int) * @see java.sql.ResultSet#getObject(int)
*/ */
@ -371,19 +381,53 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getObject(String, java.util.Map) * @see java.sql.ResultSet#getObject(String)
*/ */
@Override @Override
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException { public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel));
}
/**
* @see java.sql.ResultSet#getObject(int, Map)
*/
@Override
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
try {
return this.resultSet.getObject(columnIndex, map);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
/**
* @see java.sql.ResultSet#getObject(String, Map)
*/
@Override
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), map); return getObject(findColumn(columnLabel), map);
} }
/** /**
* @see java.sql.ResultSet#getObject(String) * @see java.sql.ResultSet#getObject(int, Class)
*/ */
@Override @Override
public Object getObject(String columnLabel) throws InvalidResultSetAccessException { public <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel)); try {
return this.resultSet.getObject(columnIndex, type);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
/**
* @see java.sql.ResultSet#getObject(String, Class)
*/
@Override
public <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), type);
} }
/** /**
@ -428,19 +472,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
return getString(findColumn(columnLabel)); return getString(findColumn(columnLabel));
} }
/**
* @see java.sql.ResultSet#getTime(int, java.util.Calendar)
*/
@Override
public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTime(columnIndex, cal);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
/** /**
* @see java.sql.ResultSet#getTime(int) * @see java.sql.ResultSet#getTime(int)
*/ */
@ -454,14 +485,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
} }
/**
* @see java.sql.ResultSet#getTime(String, java.util.Calendar)
*/
@Override
public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTime(findColumn(columnLabel), cal);
}
/** /**
* @see java.sql.ResultSet#getTime(String) * @see java.sql.ResultSet#getTime(String)
*/ */
@ -471,18 +494,26 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) * @see java.sql.ResultSet#getTime(int, Calendar)
*/ */
@Override @Override
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException { public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try { try {
return this.resultSet.getTimestamp(columnIndex, cal); return this.resultSet.getTime(columnIndex, cal);
} }
catch (SQLException se) { catch (SQLException se) {
throw new InvalidResultSetAccessException(se); throw new InvalidResultSetAccessException(se);
} }
} }
/**
* @see java.sql.ResultSet#getTime(String, Calendar)
*/
@Override
public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTime(findColumn(columnLabel), cal);
}
/** /**
* @see java.sql.ResultSet#getTimestamp(int) * @see java.sql.ResultSet#getTimestamp(int)
*/ */
@ -497,19 +528,32 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
} }
/** /**
* @see java.sql.ResultSet#getTimestamp(String, java.util.Calendar) * @see java.sql.ResultSet#getTimestamp(String)
*/ */
@Override @Override
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException { public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel), cal); return getTimestamp(findColumn(columnLabel));
} }
/** /**
* @see java.sql.ResultSet#getTimestamp(String) * @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/ */
@Override @Override
public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException { public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel)); try {
return this.resultSet.getTimestamp(columnIndex, cal);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
/**
* @see java.sql.ResultSet#getTimestamp(String, Calendar)
*/
@Override
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel), cal);
} }

357
spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,8 +27,8 @@ import java.util.Map;
import org.springframework.jdbc.InvalidResultSetAccessException; import org.springframework.jdbc.InvalidResultSetAccessException;
/** /**
* Mirror interface for {@code javax.sql.RowSet}, representing * Mirror interface for {@link javax.sql.RowSet}, representing
* disconnected {@code java.sql.ResultSet} data. * disconnected {@link java.sql.ResultSet} data.
* *
* <p>The main difference to the standard JDBC RowSet is that an SQLException * <p>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 * is never thrown here. This allows a SqlRowSet to be used without having
@ -51,15 +51,15 @@ import org.springframework.jdbc.InvalidResultSetAccessException;
public interface SqlRowSet extends Serializable { public interface SqlRowSet extends Serializable {
/** /**
* Retrieves the meta data (number, types and properties for the columns) * Retrieve the meta data, i.e. number, types and properties
* of this row set. * for the columns of this row set.
* @return a corresponding SqlRowSetMetaData instance * @return a corresponding SqlRowSetMetaData instance
* @see java.sql.ResultSet#getMetaData() * @see java.sql.ResultSet#getMetaData()
*/ */
SqlRowSetMetaData getMetaData(); SqlRowSetMetaData getMetaData();
/** /**
* Maps the given column label to its column index. * Map the given column label to its column index.
* @param columnLabel the name of the column * @param columnLabel the name of the column
* @return the column index for the given column label * @return the column index for the given column label
* @see java.sql.ResultSet#findColumn(String) * @see java.sql.ResultSet#findColumn(String)
@ -70,8 +70,8 @@ public interface SqlRowSet extends Serializable {
// RowSet methods for extracting data values // RowSet methods for extracting data values
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an BigDecimal object. * as a BigDecimal object.
* @param columnIndex the column index * @param columnIndex the column index
* @return an BigDecimal object representing the column value * @return an BigDecimal object representing the column value
* @see java.sql.ResultSet#getBigDecimal(int) * @see java.sql.ResultSet#getBigDecimal(int)
@ -79,17 +79,17 @@ public interface SqlRowSet extends Serializable {
BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException; BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an BigDecimal object. * as a BigDecimal object.
* @param columnLabel the column label * @param columnLabel the column label
* @return an BigDecimal object representing the column value * @return an BigDecimal object representing the column value
* @see java.sql.ResultSet#getBigDecimal(java.lang.String) * @see java.sql.ResultSet#getBigDecimal(String)
*/ */
BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException; BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a boolean. * as a boolean.
* @param columnIndex the column index * @param columnIndex the column index
* @return a boolean representing the column value * @return a boolean representing the column value
* @see java.sql.ResultSet#getBoolean(int) * @see java.sql.ResultSet#getBoolean(int)
@ -97,17 +97,17 @@ public interface SqlRowSet extends Serializable {
boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException; boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a boolean. * as a boolean.
* @param columnLabel the column label * @param columnLabel the column label
* @return a boolean representing the column value * @return a boolean representing the column value
* @see java.sql.ResultSet#getBoolean(java.lang.String) * @see java.sql.ResultSet#getBoolean(String)
*/ */
boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException; boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a byte. * as a byte.
* @param columnIndex the column index * @param columnIndex the column index
* @return a byte representing the column value * @return a byte representing the column value
* @see java.sql.ResultSet#getByte(int) * @see java.sql.ResultSet#getByte(int)
@ -115,55 +115,55 @@ public interface SqlRowSet extends Serializable {
byte getByte(int columnIndex) throws InvalidResultSetAccessException; byte getByte(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a byte. * as a byte.
* @param columnLabel the column label * @param columnLabel the column label
* @return a byte representing the column value * @return a byte representing the column value
* @see java.sql.ResultSet#getByte(java.lang.String) * @see java.sql.ResultSet#getByte(String)
*/ */
byte getByte(String columnLabel) throws InvalidResultSetAccessException; byte getByte(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Date object. * as a Date object.
* @param columnIndex the column index * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(int, java.util.Calendar) * @see java.sql.ResultSet#getDate(int)
*/ */
Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException; Date getDate(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Date object. * as a Date object.
* @param columnIndex the column index * @param columnLabel the column label
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(int) * @see java.sql.ResultSet#getDate(String)
*/ */
Date getDate(int columnIndex) throws InvalidResultSetAccessException; Date getDate(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Date object. * as a Date object.
* @param columnLabel the column label * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar) * @see java.sql.ResultSet#getDate(int, Calendar)
*/ */
Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException; Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Date object. * as a Date object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(java.lang.String) * @see java.sql.ResultSet#getDate(String, Calendar)
*/ */
Date getDate(String columnLabel) throws InvalidResultSetAccessException; Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Double object. * as a Double object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Double object representing the column value * @return a Double object representing the column value
* @see java.sql.ResultSet#getDouble(int) * @see java.sql.ResultSet#getDouble(int)
@ -171,17 +171,17 @@ public interface SqlRowSet extends Serializable {
double getDouble(int columnIndex) throws InvalidResultSetAccessException; double getDouble(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Double object. * as a Double object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Double object representing the column value * @return a Double object representing the column value
* @see java.sql.ResultSet#getDouble(java.lang.String) * @see java.sql.ResultSet#getDouble(String)
*/ */
double getDouble(String columnLabel) throws InvalidResultSetAccessException; double getDouble(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a float. * as a float.
* @param columnIndex the column index * @param columnIndex the column index
* @return a float representing the column value * @return a float representing the column value
* @see java.sql.ResultSet#getFloat(int) * @see java.sql.ResultSet#getFloat(int)
@ -189,17 +189,17 @@ public interface SqlRowSet extends Serializable {
float getFloat(int columnIndex) throws InvalidResultSetAccessException; float getFloat(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a float. * as a float.
* @param columnLabel the column label * @param columnLabel the column label
* @return a float representing the column value * @return a float representing the column value
* @see java.sql.ResultSet#getFloat(java.lang.String) * @see java.sql.ResultSet#getFloat(String)
*/ */
float getFloat(String columnLabel) throws InvalidResultSetAccessException; float getFloat(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an int. * as an int.
* @param columnIndex the column index * @param columnIndex the column index
* @return an int representing the column value * @return an int representing the column value
* @see java.sql.ResultSet#getInt(int) * @see java.sql.ResultSet#getInt(int)
@ -207,17 +207,17 @@ public interface SqlRowSet extends Serializable {
int getInt(int columnIndex) throws InvalidResultSetAccessException; int getInt(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an int. * as an int.
* @param columnLabel the column label * @param columnLabel the column label
* @return an int representing the column value * @return an int representing the column value
* @see java.sql.ResultSet#getInt(java.lang.String) * @see java.sql.ResultSet#getInt(String)
*/ */
int getInt(String columnLabel) throws InvalidResultSetAccessException; int getInt(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a long. * as a long.
* @param columnIndex the column index * @param columnIndex the column index
* @return a long representing the column value * @return a long representing the column value
* @see java.sql.ResultSet#getLong(int) * @see java.sql.ResultSet#getLong(int)
@ -225,27 +225,37 @@ public interface SqlRowSet extends Serializable {
long getLong(int columnIndex) throws InvalidResultSetAccessException; long getLong(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a long. * as a long.
* @param columnLabel the column label * @param columnLabel the column label
* @return a long representing the column value * @return a long representing the column value
* @see java.sql.ResultSet#getLong(java.lang.String) * @see java.sql.ResultSet#getLong(String)
*/ */
long getLong(String columnLabel) throws InvalidResultSetAccessException; long getLong(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an Object. * as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
* @param columnIndex the column index * @param columnIndex the column index
* @param map a Map object containing the mapping from SQL types to Java types * @return a String representing the column value
* @return a Object representing the column value * @see java.sql.ResultSet#getNString(int)
* @see java.sql.ResultSet#getObject(int, java.util.Map) * @since 4.1.3
*/ */
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException; String getNString(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an Object. * as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
* @param columnLabel the column label
* @return a String representing the column value
* @see java.sql.ResultSet#getNString(String)
* @since 4.1.3
*/
String getNString(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Object representing the column value * @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int) * @see java.sql.ResultSet#getObject(int)
@ -253,27 +263,59 @@ public interface SqlRowSet extends Serializable {
Object getObject(int columnIndex) throws InvalidResultSetAccessException; Object getObject(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an Object. * as an Object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(String)
*/
Object getObject(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnIndex the column index
* @param map a Map object containing the mapping from SQL types to Java types * @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value * @return a Object representing the column value
* @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map) * @see java.sql.ResultSet#getObject(int, Map)
*/
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnLabel the column label
* @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(String, Map)
*/ */
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException; Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* an Object. * as an Object.
* @param columnIndex the column index
* @param type the Java type to convert the designated column to
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int)
* @since 4.1.3
*/
<T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnLabel the column label * @param columnLabel the column label
* @param type the Java type to convert the designated column to
* @return a Object representing the column value * @return a Object representing the column value
* @see java.sql.ResultSet#getObject(java.lang.String) * @see java.sql.ResultSet#getObject(int)
* @since 4.1.3
*/ */
Object getObject(String columnLabel) throws InvalidResultSetAccessException; <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a short. * as a short.
* @param columnIndex the column index * @param columnIndex the column index
* @return a short representing the column value * @return a short representing the column value
* @see java.sql.ResultSet#getShort(int) * @see java.sql.ResultSet#getShort(int)
@ -281,17 +323,17 @@ public interface SqlRowSet extends Serializable {
short getShort(int columnIndex) throws InvalidResultSetAccessException; short getShort(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a short. * as a short.
* @param columnLabel the column label * @param columnLabel the column label
* @return a short representing the column value * @return a short representing the column value
* @see java.sql.ResultSet#getShort(java.lang.String) * @see java.sql.ResultSet#getShort(String)
*/ */
short getShort(String columnLabel) throws InvalidResultSetAccessException; short getShort(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a String. * as a String.
* @param columnIndex the column index * @param columnIndex the column index
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getString(int) * @see java.sql.ResultSet#getString(int)
@ -299,27 +341,17 @@ public interface SqlRowSet extends Serializable {
String getString(int columnIndex) throws InvalidResultSetAccessException; String getString(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a String. * as a String.
* @param columnLabel the column label * @param columnLabel the column label
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getString(java.lang.String) * @see java.sql.ResultSet#getString(String)
*/ */
String getString(String columnLabel) throws InvalidResultSetAccessException; String getString(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Time object. * as a Time object.
* @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(int, java.util.Calendar)
*/
Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/**
* Retrieves the value of the indicated column in the current row as
* a Time object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Time object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(int) * @see java.sql.ResultSet#getTime(int)
@ -327,37 +359,37 @@ public interface SqlRowSet extends Serializable {
Time getTime(int columnIndex) throws InvalidResultSetAccessException; Time getTime(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Time object. * as a Time object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) * @see java.sql.ResultSet#getTime(String)
*/ */
Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException; Time getTime(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Time object. * as a Time object.
* @param columnLabel the column label * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(java.lang.String) * @see java.sql.ResultSet#getTime(int, Calendar)
*/ */
Time getTime(String columnLabel) throws InvalidResultSetAccessException; Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Timestamp object. * as a Time object.
* @param columnIndex the column index * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) * @see java.sql.ResultSet#getTime(String, Calendar)
*/ */
Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException; Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Timestamp object. * as a Timestamp object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(int) * @see java.sql.ResultSet#getTimestamp(int)
@ -365,123 +397,146 @@ public interface SqlRowSet extends Serializable {
Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException; Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Timestamp object. * as a Timestamp object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(String)
*/
Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as a Timestamp object.
* @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar) * @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/ */
Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException; Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieves the value of the indicated column in the current row as * Retrieve the value of the indicated column in the current row
* a Timestamp object. * as a Timestamp object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(java.lang.String) * @see java.sql.ResultSet#getTimestamp(String, Calendar)
*/ */
Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException; Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
// RowSet navigation methods // RowSet navigation methods
/** /**
* Moves the cursor to the given row number in the RowSet, just after the last row. * Move the cursor to the given row number in the row set,
* just after the last row.
* @param row the number of the row where the cursor should move * @param row the number of the row where the cursor should move
* @return true if the cursor is on the RowSet, false otherwise * @return {@code true} if the cursor is on the row set,
* {@code false} otherwise
* @see java.sql.ResultSet#absolute(int) * @see java.sql.ResultSet#absolute(int)
*/ */
boolean absolute(int row) throws InvalidResultSetAccessException; boolean absolute(int row) throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the end of this RowSet. * Move the cursor to the end of this row set.
* @see java.sql.ResultSet#afterLast() * @see java.sql.ResultSet#afterLast()
*/ */
void afterLast() throws InvalidResultSetAccessException; void afterLast() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the front of this RowSet, just before the first row. * Move the cursor to the front of this row set,
* just before the first row.
* @see java.sql.ResultSet#beforeFirst() * @see java.sql.ResultSet#beforeFirst()
*/ */
void beforeFirst() throws InvalidResultSetAccessException; void beforeFirst() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the first row of this RowSet. * Move the cursor to the first row of this row set.
* @return true if the cursor is on a valid row, false otherwise * @return {@code true} if the cursor is on a valid row,
* {@code false} otherwise
* @see java.sql.ResultSet#first() * @see java.sql.ResultSet#first()
*/ */
boolean first() throws InvalidResultSetAccessException; boolean first() throws InvalidResultSetAccessException;
/** /**
* Retrieves the current row number. * Retrieve the current row number.
* @return the current row number * @return the current row number
* @see java.sql.ResultSet#getRow() * @see java.sql.ResultSet#getRow()
*/ */
int getRow() throws InvalidResultSetAccessException; int getRow() throws InvalidResultSetAccessException;
/** /**
* Retrieves whether the cursor is after the last row of this RowSet. * Retrieve whether the cursor is after the last row of this row set.
* @return true if the cursor is after the last row, false otherwise * @return {@code true} if the cursor is after the last row,
* {@code false} otherwise
* @see java.sql.ResultSet#isAfterLast() * @see java.sql.ResultSet#isAfterLast()
*/ */
boolean isAfterLast() throws InvalidResultSetAccessException; boolean isAfterLast() throws InvalidResultSetAccessException;
/** /**
* Retrieves whether the cursor is after the first row of this RowSet. * Retrieve whether the cursor is before the first row of this row set.
* @return true if the cursor is after the first row, false otherwise * @return {@code true} if the cursor is before the first row,
* {@code false} otherwise
* @see java.sql.ResultSet#isBeforeFirst() * @see java.sql.ResultSet#isBeforeFirst()
*/ */
boolean isBeforeFirst() throws InvalidResultSetAccessException; boolean isBeforeFirst() throws InvalidResultSetAccessException;
/** /**
* Retrieves whether the cursor is on the first row of this RowSet. * Retrieve whether the cursor is on the first row of this row set.
* @return true if the cursor is after the first row, false otherwise * @return {@code true} if the cursor is after the first row,
* {@code false} otherwise
* @see java.sql.ResultSet#isFirst() * @see java.sql.ResultSet#isFirst()
*/ */
boolean isFirst() throws InvalidResultSetAccessException; boolean isFirst() throws InvalidResultSetAccessException;
/** /**
* Retrieves whether the cursor is on the last row of this RowSet. * Retrieve whether the cursor is on the last row of this row set.
* @return true if the cursor is after the last row, false otherwise * @return {@code true} if the cursor is after the last row,
* {@code false} otherwise
* @see java.sql.ResultSet#isLast() * @see java.sql.ResultSet#isLast()
*/ */
boolean isLast() throws InvalidResultSetAccessException; boolean isLast() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the last row of this RowSet. * Move the cursor to the last row of this row set.
* @return true if the cursor is on a valid row, false otherwise * @return {@code true} if the cursor is on a valid row,
* {@code false} otherwise
* @see java.sql.ResultSet#last() * @see java.sql.ResultSet#last()
*/ */
boolean last() throws InvalidResultSetAccessException; boolean last() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the next row. * Move the cursor to the next row.
* @return true if the new row is valid, false if there are no more rows * @return {@code true} if the new row is valid,
* {@code false} if there are no more rows
* @see java.sql.ResultSet#next() * @see java.sql.ResultSet#next()
*/ */
boolean next() throws InvalidResultSetAccessException; boolean next() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor to the previous row. * Move the cursor to the previous row.
* @return true if the new row is valid, false if it is off the RowSet * @return {@code true} if the new row is valid,
* {@code false} if it is off the row set
* @see java.sql.ResultSet#previous() * @see java.sql.ResultSet#previous()
*/ */
boolean previous() throws InvalidResultSetAccessException; boolean previous() throws InvalidResultSetAccessException;
/** /**
* Moves the cursor a relative number f rows, either positive or negative. * Move the cursor a relative number of rows,
* @return true if the cursor is on a row, false otherwise * either positive or negative.
* @return {@code true} if the cursor is on a row,
* {@code false} otherwise
* @see java.sql.ResultSet#relative(int) * @see java.sql.ResultSet#relative(int)
*/ */
boolean relative(int rows) throws InvalidResultSetAccessException; boolean relative(int rows) throws InvalidResultSetAccessException;
/** /**
* Reports whether the last column read had a value of SQL {@code NULL}. * Report whether the last column read had a value of SQL {@code NULL}.
* Note that you must first call one of the getter methods and then call * <p>Note that you must first call one of the getter methods
* the {@code wasNull} method. * and then call the {@code wasNull()} method.
* @return true if the most recent coumn retrieved was SQL {@code NULL}, * @return {@code true} if the most recent coumn retrieved was
* false otherwise * SQL {@code NULL}, {@code false} otherwise
* @see java.sql.ResultSet#wasNull() * @see java.sql.ResultSet#wasNull()
*/ */
boolean wasNull() throws InvalidResultSetAccessException; boolean wasNull() throws InvalidResultSetAccessException;

Loading…
Cancel
Save