- java.lang.Object
-
- org.postgresql.pljava.jdbc.AbstractResultSet
-
- org.postgresql.pljava.jdbc.ObjectResultSet
-
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
- Direct Known Subclasses:
ReadOnlyResultSet
,SingleRowResultSet
public abstract class ObjectResultSet extends AbstractResultSet
Implements most getters in terms ofgetValue(int, java.lang.Class<T>)
,getNumber(int, java.lang.Class)
, or a few otherResultSet
getters that are so implemented, trackswasNull
, and providesgetObjectValue(int)
as the chief method for subclasses to implement; turns most updaters intoResultSet.updateObject(int,Object)
.- Author:
- Thomas Hallgren
-
-
Field Summary
-
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
-
-
Constructor Summary
Constructors Constructor Description ObjectResultSet()
-
Method Summary
Modifier and Type Method Description void
clearWarnings()
This is a noop since warnings are not supported.Array
getArray(int columnIndex)
Implemented overgetValue
.InputStream
getAsciiStream(int columnIndex)
Implemented overgetClob
.BigDecimal
getBigDecimal(int columnIndex)
Implemented overgetValue
.BigDecimal
getBigDecimal(int columnIndex, int scale)
Throws "unsupported" exception.InputStream
getBinaryStream(int columnIndex)
Implemented overgetBlob
.Blob
getBlob(int columnIndex)
Implemented overgetBytes
.boolean
getBoolean(int columnIndex)
Implemented overgetValue
.byte
getByte(int columnIndex)
Implemented overgetNumber
.byte[]
getBytes(int columnIndex)
Implemented overgetValue
.Reader
getCharacterStream(int columnIndex)
Implemented overgetClob
.Clob
getClob(int columnIndex)
Implemented overgetString
.Date
getDate(int columnIndex)
Implemented overgetValue
.Date
getDate(int columnIndex, Calendar cal)
Implemented overgetValue
.double
getDouble(int columnIndex)
Implemented overgetNumber
.float
getFloat(int columnIndex)
Implemented overgetNumber
.int
getInt(int columnIndex)
Implemented overgetNumber
.long
getLong(int columnIndex)
Implemented overgetNumber
.ResultSetMetaData
getMetaData()
Throws "unsupported" exception if not overridden in a subclass.protected Number
getNumber(int columnIndex, Class cls)
Implemented overgetObjectValue(int, java.util.Map)
, trackswasNull
, appliesSPIConnection.basicNumericCoercion(java.lang.Class, java.lang.Object)
tocls
.Object
getObject(int columnIndex)
Implemented overgetObjectValue
.<T> T
getObject(int columnIndex, Class<T> type)
Implemented overgetObjectValue
.Object
getObject(int columnIndex, Map map)
Implemented overgetObjectValue
.protected Object
getObjectValue(int columnIndex)
Implemented overgetObjectValue(int,Class)
, passing null for the class.protected abstract Object
getObjectValue(int columnIndex, Class<?> type)
Primary method for subclass to override to retrieve a value.protected Object
getObjectValue(int columnIndex, Map typeMap)
Implemented overgetObjectValue(int)
, complains iftypeMap
is non-null.Ref
getRef(int columnIndex)
Implemented overgetValue
.short
getShort(int columnIndex)
Implemented overgetNumber
.String
getString(int columnIndex)
Implemented overgetValue
.Time
getTime(int columnIndex)
Implemented overgetValue
.Time
getTime(int columnIndex, Calendar cal)
Implemented overgetValue
.Timestamp
getTimestamp(int columnIndex)
Implemented overgetValue
.Timestamp
getTimestamp(int columnIndex, Calendar cal)
Implemented overgetValue
.InputStream
getUnicodeStream(int columnIndex)
Throws "unsupported" exception.URL
getURL(int columnIndex)
Implemented overgetValue
.protected <T> T
getValue(int columnIndex, Class<T> cls)
Implemented overgetObject(int)
, appliesSPIConnection.basicCoercion(java.lang.Class<T>, java.lang.Object)
tocls
.protected <T> T
getValue(int columnIndex, Class<T> cls, Calendar cal)
Implemented overgetObject(int)
, appliesSPIConnection.basicCalendricalCoercion(java.lang.Class<T>, java.lang.Object, java.util.Calendar)
tocls
.SQLWarning
getWarnings()
Returns null if not overridden in a subclass.void
refreshRow()
Refresh row is not yet implemented.void
updateArray(int columnIndex, Array x)
Implemented overupdateObject
.void
updateAsciiStream(int columnIndex, InputStream x, int length)
Implemented overClobValue
andupdateObject
.void
updateBigDecimal(int columnIndex, BigDecimal x)
Implemented overupdateObject
.void
updateBinaryStream(int columnIndex, InputStream x, int length)
Implemented overBlobValue
andupdateBlob
.void
updateBlob(int columnIndex, Blob x)
Implemented overupdateObject
.void
updateBoolean(int columnIndex, boolean x)
Implemented overupdateObject
.void
updateByte(int columnIndex, byte x)
Implemented overupdateObject
.void
updateBytes(int columnIndex, byte[] x)
Implemented overupdateObject
.void
updateCharacterStream(int columnIndex, Reader x, int length)
Implemented overClobValue
andupdateClob
.void
updateClob(int columnIndex, Clob x)
Implemented overupdateObject
.void
updateDate(int columnIndex, Date x)
Implemented overupdateObject
.void
updateDouble(int columnIndex, double x)
Implemented overupdateObject
.void
updateFloat(int columnIndex, float x)
Implemented overupdateObject
.void
updateInt(int columnIndex, int x)
Implemented overupdateObject
.void
updateLong(int columnIndex, long x)
Implemented overupdateObject
.void
updateNull(int columnIndex)
Implemented overupdateObject
.void
updateRef(int columnIndex, Ref x)
Implemented overupdateObject
.void
updateShort(int columnIndex, short x)
Implemented overupdateObject
.void
updateString(int columnIndex, String x)
Implemented overupdateObject
.void
updateTime(int columnIndex, Time x)
Implemented overupdateObject
.void
updateTimestamp(int columnIndex, Timestamp x)
Implemented overupdateObject
.boolean
wasNull()
Returns a private value updated by final methods in this class.-
Methods inherited from class org.postgresql.pljava.jdbc.AbstractResultSet
getArray, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getClob, getCursorName, getDate, getDate, getDouble, getFloat, getInt, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getRef, getRowId, getRowId, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTimestamp, getTimestamp, getUnicodeStream, getURL, isWrapperFor, unwrap, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateByte, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDouble, updateFloat, updateInt, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateObject, updateObject, updateRef, updateRowId, updateRowId, updateShort, updateSQLXML, updateSQLXML, updateString, updateTime, updateTimestamp
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.ResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, close, deleteRow, findColumn, first, getConcurrency, getFetchDirection, getFetchSize, getHoldability, getRow, getType, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRow
-
-
-
-
Method Detail
-
wasNull
public boolean wasNull()
Returns a private value updated by final methods in this class.
-
clearWarnings
public void clearWarnings() throws SQLException
This is a noop since warnings are not supported.- Throws:
SQLException
-
getWarnings
public SQLWarning getWarnings() throws SQLException
Returns null if not overridden in a subclass.- Throws:
SQLException
-
getMetaData
public ResultSetMetaData getMetaData() throws SQLException
Throws "unsupported" exception if not overridden in a subclass.- Throws:
SQLException
- indicating that this feature is not supported.
-
getArray
public Array getArray(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getAsciiStream
public InputStream getAsciiStream(int columnIndex) throws SQLException
Implemented overgetClob
.- Throws:
SQLException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException
Throws "unsupported" exception.- Throws:
SQLException
-
getBinaryStream
public InputStream getBinaryStream(int columnIndex) throws SQLException
Implemented overgetBlob
.- Throws:
SQLException
-
getBlob
public Blob getBlob(int columnIndex) throws SQLException
Implemented overgetBytes
.- Throws:
SQLException
-
getBoolean
public boolean getBoolean(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getByte
public byte getByte(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getBytes
public byte[] getBytes(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getCharacterStream
public Reader getCharacterStream(int columnIndex) throws SQLException
Implemented overgetClob
.- Throws:
SQLException
-
getClob
public Clob getClob(int columnIndex) throws SQLException
Implemented overgetString
.- Throws:
SQLException
-
getDate
public Date getDate(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getDate
public Date getDate(int columnIndex, Calendar cal) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getDouble
public double getDouble(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getFloat
public float getFloat(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getInt
public int getInt(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getLong
public long getLong(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getObject
public final Object getObject(int columnIndex) throws SQLException
Implemented overgetObjectValue
. Final because it recordswasNull
for use by other methods.- Throws:
SQLException
-
getObject
public final Object getObject(int columnIndex, Map map) throws SQLException
Implemented overgetObjectValue
. Final because it recordswasNull
for use by other methods.- Throws:
SQLException
-
getRef
public Ref getRef(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getShort
public short getShort(int columnIndex) throws SQLException
Implemented overgetNumber
.- Throws:
SQLException
-
getString
public String getString(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getTime
public Time getTime(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getTime
public Time getTime(int columnIndex, Calendar cal) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getTimestamp
public Timestamp getTimestamp(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getTimestamp
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
getUnicodeStream
public InputStream getUnicodeStream(int columnIndex) throws SQLException
Throws "unsupported" exception.- Throws:
SQLException
-
getURL
public URL getURL(int columnIndex) throws SQLException
Implemented overgetValue
.- Throws:
SQLException
-
refreshRow
public void refreshRow() throws SQLException
Refresh row is not yet implemented.- Throws:
SQLException
- indicating that this feature is not supported.
-
updateArray
public void updateArray(int columnIndex, Array x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateAsciiStream
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException
Implemented overClobValue
andupdateObject
.- Throws:
SQLException
-
updateBigDecimal
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateBinaryStream
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException
Implemented overBlobValue
andupdateBlob
.- Throws:
SQLException
-
updateBlob
public void updateBlob(int columnIndex, Blob x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateBoolean
public void updateBoolean(int columnIndex, boolean x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateByte
public void updateByte(int columnIndex, byte x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateBytes
public void updateBytes(int columnIndex, byte[] x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateCharacterStream
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException
Implemented overClobValue
andupdateClob
.- Throws:
SQLException
-
updateClob
public void updateClob(int columnIndex, Clob x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateDate
public void updateDate(int columnIndex, Date x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateDouble
public void updateDouble(int columnIndex, double x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateFloat
public void updateFloat(int columnIndex, float x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateInt
public void updateInt(int columnIndex, int x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateLong
public void updateLong(int columnIndex, long x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateNull
public void updateNull(int columnIndex) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateRef
public void updateRef(int columnIndex, Ref x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateShort
public void updateShort(int columnIndex, short x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateString
public void updateString(int columnIndex, String x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateTime
public void updateTime(int columnIndex, Time x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
updateTimestamp
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException
Implemented overupdateObject
.- Throws:
SQLException
-
getObject
public final <T> T getObject(int columnIndex, Class<T> type) throws SQLException
Implemented overgetObjectValue
. Final because it recordswasNull
for use by other methods.- Throws:
SQLException
-
getNumber
protected final Number getNumber(int columnIndex, Class cls) throws SQLException
Implemented overgetObjectValue(int, java.util.Map)
, trackswasNull
, appliesSPIConnection.basicNumericCoercion(java.lang.Class, java.lang.Object)
tocls
.- Throws:
SQLException
-
getValue
protected final <T> T getValue(int columnIndex, Class<T> cls) throws SQLException
Implemented overgetObject(int)
, appliesSPIConnection.basicCoercion(java.lang.Class<T>, java.lang.Object)
tocls
.- Throws:
SQLException
-
getValue
protected <T> T getValue(int columnIndex, Class<T> cls, Calendar cal) throws SQLException
Implemented overgetObject(int)
, appliesSPIConnection.basicCalendricalCoercion(java.lang.Class<T>, java.lang.Object, java.util.Calendar)
tocls
.- Throws:
SQLException
-
getObjectValue
protected Object getObjectValue(int columnIndex, Map typeMap) throws SQLException
Implemented overgetObjectValue(int)
, complains iftypeMap
is non-null.- Throws:
SQLException
-
getObjectValue
protected Object getObjectValue(int columnIndex) throws SQLException
Implemented overgetObjectValue(int,Class)
, passing null for the class.To preserve back-compatible behavior in the 1.5.x branch, this is still what ends up getting called in all cases that do not explicitly use the JDBC 4.1 new
getObject(int,Class)
.- Throws:
SQLException
-
getObjectValue
protected abstract Object getObjectValue(int columnIndex, Class<?> type) throws SQLException
Primary method for subclass to override to retrieve a value.The signature does not constrain this to return an object of the requested class, so it can still be used as before by methods that may do additional coercions. When called by
getObject(int,Class)
, that caller enforces the class of the result.- Throws:
SQLException
-
-