Browse Source

Polishing

Issue: SPR-12476
(cherry picked from commit 3b15849)
pull/710/head
Juergen Hoeller 11 years ago
parent
commit
c89d8ec382
  1. 133
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java
  2. 13
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java
  3. 118
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java
  4. 44
      spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java

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

@ -31,12 +31,11 @@ import java.util.Map; @@ -31,12 +31,11 @@ import java.util.Map;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
* Default implementation of Spring's {@link SqlRowSet} interface.
* The default implementation of Spring's {@link SqlRowSet} interface, wrapping a
* {@link java.sql.ResultSet}, catching any {@link SQLException}s and translating
* them to a corresponding Spring {@link InvalidResultSetAccessException}.
*
* <p>This implementation wraps a {@code javax.sql.ResultSet}, catching any SQLExceptions
* and translating them to the appropriate Spring {@link InvalidResultSetAccessException}.
*
* <p>The passed-in ResultSets should already be disconnected if the SqlRowSet is supposed
* <p>The passed-in ResultSet should already be disconnected if the SqlRowSet is supposed
* to be usable in a disconnected fashion. This means that you will usually pass in a
* {@code javax.sql.rowset.CachedRowSet}, which implements the ResultSet interface.
*
@ -221,12 +220,12 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -221,12 +220,12 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getDate(int, java.util.Calendar)
* @see java.sql.ResultSet#getDate(int)
*/
@Override
public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getDate(columnIndex, cal);
return this.resultSet.getDate(columnIndex);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@ -234,33 +233,34 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -234,33 +233,34 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getDate(int)
* @see java.sql.ResultSet#getDate(String)
*/
@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 {
return this.resultSet.getDate(columnIndex);
return this.resultSet.getDate(columnIndex, cal);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
/**
* @see java.sql.ResultSet#getDate(String, java.util.Calendar)
* @see java.sql.ResultSet#getDate(String, Calendar)
*/
@Override
public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
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)
*/
@ -302,6 +302,7 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -302,6 +302,7 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
public float getFloat(String columnLabel) throws InvalidResultSetAccessException {
return getFloat(findColumn(columnLabel));
}
/**
* @see java.sql.ResultSet#getInt(int)
*/
@ -345,12 +346,12 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -345,12 +346,12 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getObject(int, java.util.Map)
* @see java.sql.ResultSet#getObject(int)
*/
@Override
public Object getObject(int i, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
public Object getObject(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getObject(i, map);
return this.resultSet.getObject(columnIndex);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@ -358,12 +359,20 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -358,12 +359,20 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getObject(int)
* @see java.sql.ResultSet#getObject(String)
*/
@Override
public Object getObject(int columnIndex) 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);
return this.resultSet.getObject(columnIndex, map);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@ -371,21 +380,13 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -371,21 +380,13 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getObject(String, java.util.Map)
* @see java.sql.ResultSet#getObject(String, Map)
*/
@Override
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), map);
}
/**
* @see java.sql.ResultSet#getObject(String)
*/
@Override
public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel));
}
/**
* @see java.sql.ResultSet#getShort(int)
*/
@ -428,19 +429,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -428,19 +429,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
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)
*/
@ -454,14 +442,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -454,14 +442,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)
*/
@ -471,18 +451,26 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -471,18 +451,26 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
* @see java.sql.ResultSet#getTime(int, Calendar)
*/
@Override
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
return this.resultSet.getTimestamp(columnIndex, cal);
return this.resultSet.getTime(columnIndex, cal);
}
catch (SQLException 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)
*/
@ -497,19 +485,32 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet { @@ -497,19 +485,32 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
* @see java.sql.ResultSet#getTimestamp(String, java.util.Calendar)
* @see java.sql.ResultSet#getTimestamp(String)
*/
@Override
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel), cal);
public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel));
}
/**
* @see java.sql.ResultSet#getTimestamp(String)
* @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/
@Override
public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
return getTimestamp(findColumn(columnLabel));
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
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);
}

13
spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -22,17 +22,16 @@ import java.sql.SQLException; @@ -22,17 +22,16 @@ import java.sql.SQLException;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
* Default implementation of Spring's SqlRowSetMetaData interface.
* Used by ResultSetWrappingSqlRowSet.
* The default implementation of Spring's {@link SqlRowSetMetaData} interface, wrapping
* a {@link java.sql.ResultSetMetaData} instance, catching any {@link SQLException}s
* and translating them to a corresponding Spring {@link InvalidResultSetAccessException}.
*
* <p>This implementation wraps a {@code javax.sql.ResultSetMetaData}
* instance, catching any SQLExceptions and translating them to the
* appropriate Spring DataAccessException.
* <p>Used by {@link ResultSetWrappingSqlRowSet}.
*
* @author Thomas Risberg
* @author Juergen Hoeller
* @since 1.2
* @see ResultSetWrappingSqlRowSet#getMetaData
* @see ResultSetWrappingSqlRowSet#getMetaData()
*/
public class ResultSetWrappingSqlRowSetMetaData implements SqlRowSetMetaData {

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

@ -30,14 +30,14 @@ import org.springframework.jdbc.InvalidResultSetAccessException; @@ -30,14 +30,14 @@ import org.springframework.jdbc.InvalidResultSetAccessException;
* Mirror interface for {@link javax.sql.RowSet}, representing
* disconnected {@link java.sql.ResultSet} data.
*
* <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
* to deal with checked exceptions. A SqlRowSet will throw Spring's
* {@code org.springframework.jdbc.InvalidResultSetAccessException}
* <p>The main difference to the standard JDBC RowSet is that a
* {@link java.sql.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 {@link InvalidResultSetAccessException}
* instead (when appropriate).
*
* <p>Note: This interface extends the {@code java.io.Serializable}
* marker interface. Implementations, which typically hold disconnected data,
* <p>Note: This interface extends the {@code java.io.Serializable} marker
* interface. Implementations, which typically hold disconnected data,
* are encouraged to be actually serializable (as far as possible).
*
* @author Thomas Risberg
@ -83,7 +83,7 @@ public interface SqlRowSet extends Serializable { @@ -83,7 +83,7 @@ public interface SqlRowSet extends Serializable {
* as a BigDecimal object.
* @param columnLabel the column label
* @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;
@ -101,7 +101,7 @@ public interface SqlRowSet extends Serializable { @@ -101,7 +101,7 @@ public interface SqlRowSet extends Serializable {
* as a boolean.
* @param columnLabel the column label
* @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;
@ -119,7 +119,7 @@ public interface SqlRowSet extends Serializable { @@ -119,7 +119,7 @@ public interface SqlRowSet extends Serializable {
* as a byte.
* @param columnLabel the column label
* @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;
@ -127,39 +127,39 @@ public interface SqlRowSet extends Serializable { @@ -127,39 +127,39 @@ public interface SqlRowSet extends Serializable {
* Retrieve the value of the indicated column in the current row
* as a Date object.
* @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @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;
/**
* Retrieve the value of the indicated column in the current row
* as a Date object.
* @param columnIndex the column index
* @param columnLabel the column label
* @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;
/**
* Retrieve the value of the indicated column in the current row
* as a Date object.
* @param columnLabel the column label
* @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @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;
/**
* Retrieve the value of the indicated column in the current row
* as a Date object.
* @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @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;
/**
* Retrieve the value of the indicated column in the current row
@ -175,7 +175,7 @@ public interface SqlRowSet extends Serializable { @@ -175,7 +175,7 @@ public interface SqlRowSet extends Serializable {
* as a Double object.
* @param columnLabel the column label
* @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;
@ -193,7 +193,7 @@ public interface SqlRowSet extends Serializable { @@ -193,7 +193,7 @@ public interface SqlRowSet extends Serializable {
* as a float.
* @param columnLabel the column label
* @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;
@ -211,7 +211,7 @@ public interface SqlRowSet extends Serializable { @@ -211,7 +211,7 @@ public interface SqlRowSet extends Serializable {
* as an int.
* @param columnLabel the column label
* @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;
@ -229,7 +229,7 @@ public interface SqlRowSet extends Serializable { @@ -229,7 +229,7 @@ public interface SqlRowSet extends Serializable {
* as a long.
* @param columnLabel the column label
* @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;
@ -237,39 +237,39 @@ public interface SqlRowSet extends Serializable { @@ -237,39 +237,39 @@ public interface SqlRowSet extends Serializable {
* 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
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int, java.util.Map)
* @see java.sql.ResultSet#getObject(int)
*/
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
Object getObject(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnIndex the column index
* @param columnLabel the column label
* @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int)
* @see java.sql.ResultSet#getObject(String)
*/
Object getObject(int columnIndex) throws InvalidResultSetAccessException;
Object getObject(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as an Object.
* @param columnLabel the column label
* @param columnIndex the column index
* @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(java.lang.String, java.util.Map)
* @see java.sql.ResultSet#getObject(int, Map)
*/
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
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(java.lang.String)
* @see java.sql.ResultSet#getObject(String, Map)
*/
Object getObject(String columnLabel) throws InvalidResultSetAccessException;
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
@ -285,7 +285,7 @@ public interface SqlRowSet extends Serializable { @@ -285,7 +285,7 @@ public interface SqlRowSet extends Serializable {
* as a short.
* @param columnLabel the column label
* @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;
@ -303,7 +303,7 @@ public interface SqlRowSet extends Serializable { @@ -303,7 +303,7 @@ public interface SqlRowSet extends Serializable {
* as a String.
* @param columnLabel the column label
* @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;
@ -311,77 +311,77 @@ public interface SqlRowSet extends Serializable { @@ -311,77 +311,77 @@ public interface SqlRowSet extends Serializable {
* Retrieve the value of the indicated column in the current row
* 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)
* @see java.sql.ResultSet#getTime(int)
*/
Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
Time getTime(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as a Time object.
* @param columnIndex the column index
* @param columnLabel the column label
* @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(int)
* @see java.sql.ResultSet#getTime(String)
*/
Time getTime(int columnIndex) throws InvalidResultSetAccessException;
Time getTime(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* 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
* @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
* @see java.sql.ResultSet#getTime(int, Calendar)
*/
Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as a Time object.
* @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(java.lang.String)
* @see java.sql.ResultSet#getTime(String, Calendar)
*/
Time getTime(String columnLabel) throws InvalidResultSetAccessException;
Time getTime(String columnLabel, Calendar cal) 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
* @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
* @see java.sql.ResultSet#getTimestamp(int)
*/
Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as a Timestamp object.
* @param columnIndex the column index
* @param columnLabel the column label
* @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(int)
* @see java.sql.ResultSet#getTimestamp(String)
*/
Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException;
Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
/**
* Retrieve the value of the indicated column in the current row
* as a Timestamp object.
* @param columnLabel the column label
* @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @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;
/**
* Retrieve the value of the indicated column in the current row
* as a Timestamp object.
* @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
* @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

44
spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java

@ -1,5 +1,5 @@ @@ -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");
* you may not use this file except in compliance with the License.
@ -19,25 +19,27 @@ package org.springframework.jdbc.support.rowset; @@ -19,25 +19,27 @@ package org.springframework.jdbc.support.rowset;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
* Meta data interface for Spring's SqlRowSet,
* analogous to {@code javax.sql.ResultSetMetaData}
* Metadata interface for Spring's {@link SqlRowSet}, analogous to JDBC's
* {@link java.sql.ResultSetMetaData}.
*
* <p>The main difference to the standard JDBC RowSetMetaData is that an SQLException
* is never thrown here. This allows a SqlRowSetMetaData to be used without having
* to deal with checked exceptions. A SqlRowSetMetaData will throw Spring's
* {@code org.springframework.jdbc.InvalidResultSetAccessException}
* <p>The main difference to the standard JDBC ResultSetMetaData is that a
* {@link java.sql.SQLException} is never thrown here. This allows
* SqlRowSetMetaData to be used without having to deal with checked exceptions.
* SqlRowSetMetaData will throw Spring's {@link InvalidResultSetAccessException}
* instead (when appropriate).
*
* @author Thomas Risberg
* @author Juergen Hoeller
* @since 1.2
* @see SqlRowSet#getMetaData
* @see SqlRowSet#getMetaData()
* @see java.sql.ResultSetMetaData
* @see org.springframework.jdbc.InvalidResultSetAccessException
*/
public interface SqlRowSetMetaData {
/**
* Retrieves the catalog name of the table that served as the source for the specified column.
* Retrieve the catalog name of the table that served as the source for the
* specified column.
* @param columnIndex the index of the column
* @return the catalog name
* @see java.sql.ResultSetMetaData#getCatalogName(int)
@ -45,7 +47,7 @@ public interface SqlRowSetMetaData { @@ -45,7 +47,7 @@ public interface SqlRowSetMetaData {
String getCatalogName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the fully qualified class that the specified column will be mapped to.
* Retrieve the fully qualified class that the specified column will be mapped to.
* @param columnIndex the index of the column
* @return the class name as a String
* @see java.sql.ResultSetMetaData#getColumnClassName(int)
@ -53,7 +55,7 @@ public interface SqlRowSetMetaData { @@ -53,7 +55,7 @@ public interface SqlRowSetMetaData {
String getColumnClassName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrives the number of columns in the RowSet.
* Retrieve the number of columns in the RowSet.
* @return the number of columns
* @see java.sql.ResultSetMetaData#getColumnCount()
*/
@ -66,7 +68,7 @@ public interface SqlRowSetMetaData { @@ -66,7 +68,7 @@ public interface SqlRowSetMetaData {
String[] getColumnNames() throws InvalidResultSetAccessException;
/**
* Retrieves the maximum width of the designated column.
* Retrieve the maximum width of the designated column.
* @param columnIndex the index of the column
* @return the width of the column
* @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
@ -99,7 +101,7 @@ public interface SqlRowSetMetaData { @@ -99,7 +101,7 @@ public interface SqlRowSetMetaData {
int getColumnType(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the DBMS-specific type name for the indicated column.
* Retrieve the DBMS-specific type name for the indicated column.
* @param columnIndex the index of the column
* @return the type name
* @see java.sql.ResultSetMetaData#getColumnTypeName(int)
@ -107,7 +109,7 @@ public interface SqlRowSetMetaData { @@ -107,7 +109,7 @@ public interface SqlRowSetMetaData {
String getColumnTypeName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the precision for the indicated column.
* Retrieve the precision for the indicated column.
* @param columnIndex the index of the column
* @return the precision
* @see java.sql.ResultSetMetaData#getPrecision(int)
@ -115,7 +117,7 @@ public interface SqlRowSetMetaData { @@ -115,7 +117,7 @@ public interface SqlRowSetMetaData {
int getPrecision(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the scale of the indicated column.
* Retrieve the scale of the indicated column.
* @param columnIndex the index of the column
* @return the scale
* @see java.sql.ResultSetMetaData#getScale(int)
@ -123,7 +125,8 @@ public interface SqlRowSetMetaData { @@ -123,7 +125,8 @@ public interface SqlRowSetMetaData {
int getScale(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the schema name of the table that served as the source for the specified column.
* Retrieve the schema name of the table that served as the source for the
* specified column.
* @param columnIndex the index of the column
* @return the schema name
* @see java.sql.ResultSetMetaData#getSchemaName(int)
@ -131,7 +134,8 @@ public interface SqlRowSetMetaData { @@ -131,7 +134,8 @@ public interface SqlRowSetMetaData {
String getSchemaName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Retrieves the name of the table that served as the source for the specified column.
* Retrieve the name of the table that served as the source for the
* specified column.
* @param columnIndex the index of the column
* @return the name of the table
* @see java.sql.ResultSetMetaData#getTableName(int)
@ -139,7 +143,7 @@ public interface SqlRowSetMetaData { @@ -139,7 +143,7 @@ public interface SqlRowSetMetaData {
String getTableName(int columnIndex) throws InvalidResultSetAccessException;
/**
* Indicates whether the case of the designated column is significant.
* Indicate whether the case of the designated column is significant.
* @param columnIndex the index of the column
* @return true if the case sensitive, false otherwise
* @see java.sql.ResultSetMetaData#isCaseSensitive(int)
@ -147,7 +151,7 @@ public interface SqlRowSetMetaData { @@ -147,7 +151,7 @@ public interface SqlRowSetMetaData {
boolean isCaseSensitive(int columnIndex) throws InvalidResultSetAccessException;
/**
* Indicates whether the designated column contains a currency value.
* Indicate whether the designated column contains a currency value.
* @param columnIndex the index of the column
* @return true if the value is a currency value, false otherwise
* @see java.sql.ResultSetMetaData#isCurrency(int)
@ -155,7 +159,7 @@ public interface SqlRowSetMetaData { @@ -155,7 +159,7 @@ public interface SqlRowSetMetaData {
boolean isCurrency(int columnIndex) throws InvalidResultSetAccessException;
/**
* Indicates whether the designated column contains a signed number.
* Indicate whether the designated column contains a signed number.
* @param columnIndex the index of the column
* @return true if the column contains a signed number, false otherwise
* @see java.sql.ResultSetMetaData#isSigned(int)

Loading…
Cancel
Save