Package org.apache.openjpa.jdbc.sql
Class ResultSetResult
- java.lang.Object
-
- org.apache.openjpa.jdbc.sql.AbstractResult
-
- org.apache.openjpa.jdbc.sql.ResultSetResult
-
- Direct Known Subclasses:
SelectImpl.SelectResult
public class ResultSetResult extends AbstractResult
BaseResult
implementation wrapped around a result set. Column objects, column names, or column indexes (asNumber
instances) can be used to retrieve result set data.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description ResultSetResult(java.sql.Connection conn, java.sql.ResultSet rs, DBDictionary dict)
Constructor.ResultSetResult(java.sql.Connection conn, java.sql.Statement stmnt, java.sql.ResultSet rs, JDBCStore store)
Constructor.ResultSetResult(java.sql.Connection conn, java.sql.Statement stmnt, java.sql.ResultSet rs, DBDictionary dict)
Constructor.ResultSetResult(java.sql.ResultSet rs, JDBCStore store)
JDBC 2 constructor.ResultSetResult(java.sql.ResultSet rs, DBDictionary dict)
JDBC 2 constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
absoluteInternal(int row)
Throws an exception by default.void
close()
Closes all eager results.protected boolean
containsInternal(java.lang.Object obj, Joins joins)
Return whether this result contains data for the given id or column.protected int
findObject(java.lang.Object obj, Joins joins)
Return the 1-based result set index for the given column or id, or a non-positive number if the column is not contained in this result.protected java.sql.Array
getArrayInternal(java.lang.Object obj, Joins joins)
protected java.io.InputStream
getAsciiStreamInternal(java.lang.Object obj, Joins joins)
protected java.math.BigDecimal
getBigDecimalInternal(java.lang.Object obj, Joins joins)
protected java.math.BigInteger
getBigIntegerInternal(java.lang.Object obj, Joins joins)
protected java.io.InputStream
getBinaryStreamInternal(java.lang.Object obj, Joins joins)
protected java.sql.Blob
getBlobInternal(java.lang.Object obj, Joins joins)
protected boolean
getBooleanInternal(java.lang.Object obj, Joins joins)
protected byte
getByteInternal(java.lang.Object obj, Joins joins)
protected byte[]
getBytesInternal(java.lang.Object obj, Joins joins)
protected java.util.Calendar
getCalendarInternal(java.lang.Object obj, Joins joins)
protected java.io.Reader
getCharacterStreamInternal(java.lang.Object obj, Joins joins)
protected char
getCharInternal(java.lang.Object obj, Joins joins)
protected java.sql.Clob
getClobInternal(java.lang.Object obj, Joins joins)
boolean
getCloseConnection()
Whether to close the backing connection when this result is closed.protected java.sql.Date
getDateInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)
protected java.util.Date
getDateInternal(java.lang.Object obj, Joins joins)
DBDictionary
getDBDictionary()
Return the dictionary in use.protected double
getDoubleInternal(java.lang.Object obj, Joins joins)
protected float
getFloatInternal(java.lang.Object obj, Joins joins)
protected int
getIntInternal(java.lang.Object obj, Joins joins)
protected java.io.InputStream
getLOBStreamInternal(JDBCStore store, java.lang.Object obj, Joins joins)
protected java.time.LocalDate
getLocalDateInternal(java.lang.Object obj, Joins joins)
protected java.time.LocalDateTime
getLocalDateTimeInternal(java.lang.Object obj, Joins joins)
protected java.util.Locale
getLocaleInternal(java.lang.Object obj, Joins joins)
protected java.time.LocalTime
getLocalTimeInternal(java.lang.Object obj, Joins joins)
protected long
getLongInternal(java.lang.Object obj, Joins joins)
protected java.lang.Number
getNumberInternal(java.lang.Object obj, Joins joins)
protected java.lang.Object
getObjectInternal(java.lang.Object obj, int metaTypeCode, java.lang.Object arg, Joins joins)
Return the value stored in the given id or column.protected java.time.OffsetDateTime
getOffsetDateTimeInternal(java.lang.Object obj, Joins joins)
protected java.time.OffsetTime
getOffsetTimeInternal(java.lang.Object obj, Joins joins)
protected java.sql.Ref
getRefInternal(java.lang.Object obj, java.util.Map map, Joins joins)
java.sql.ResultSet
getResultSet()
Return the backing result set.protected short
getShortInternal(java.lang.Object obj, Joins joins)
protected java.lang.Object
getSQLObjectInternal(java.lang.Object obj, java.util.Map map, Joins joins)
java.sql.Statement
getStatement()
Return the statement that produced this result.JDBCStore
getStore()
Optional store manager used to deserialize blobs containing references to persistent objects.protected java.lang.Object
getStreamInternal(JDBCStore store, java.lang.Object obj, int metaTypeCode, java.lang.Object arg, Joins joins)
protected java.lang.String
getStringInternal(java.lang.Object obj, Joins joins, boolean isClobString)
protected java.sql.Time
getTimeInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)
protected java.sql.Timestamp
getTimestampInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)
protected boolean
nextInternal()
Advance this row.void
setCloseConnection(boolean closeConn)
Whether to close the backing connection when this result is closed.void
setCloseStatement(boolean closeStatement)
void
setStore(JDBCStore store)
Optional store manager used to deserialize blobs containing references to persistent objects.int
size()
Return the number of rows in this result.boolean
supportsRandomAccess()
Returns false by default.protected java.lang.Object
translate(java.lang.Object obj, Joins joins)
Translate the user-given id or column.boolean
wasNull()
Return true if the last value fetched was null.-
Methods inherited from class org.apache.openjpa.jdbc.sql.AbstractResult
absolute, checkNull, closeEagerMap, contains, contains, containsAll, containsAll, containsAllInternal, endDataRequest, getArray, getArray, getAsciiStream, getAsciiStream, getBaseMapping, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCalendar, getCalendar, getChar, getChar, getCharacterStream, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getEager, getEagerMap, getFloat, getFloat, getInt, getInt, getLOBStream, getLocalDate, getLocalDateTime, getLocale, getLocale, getLocalTime, getLong, getLong, getMappedByFieldMapping, getMappedByValue, getNumber, getNumber, getObject, getObject, getOffsetDateTime, getOffsetTime, getRef, getRef, getShort, getShort, getSQLObject, getSQLObject, getString, getString, getTime, getTime, getTimestamp, getTimestamp, indexOf, isLocking, load, load, newJoins, next, pushBack, putEager, setBaseMapping, setEagerMap, setIndexOf, setLocking, setMappedByFieldMapping, setMappedByValue, startDataRequest
-
-
-
-
Constructor Detail
-
ResultSetResult
public ResultSetResult(java.sql.Connection conn, java.sql.Statement stmnt, java.sql.ResultSet rs, DBDictionary dict)
Constructor.
-
ResultSetResult
public ResultSetResult(java.sql.Connection conn, java.sql.Statement stmnt, java.sql.ResultSet rs, JDBCStore store)
Constructor.
-
ResultSetResult
public ResultSetResult(java.sql.Connection conn, java.sql.ResultSet rs, DBDictionary dict)
Constructor.
-
ResultSetResult
public ResultSetResult(java.sql.ResultSet rs, DBDictionary dict) throws java.sql.SQLException
JDBC 2 constructor. Relies on being able to retrieve the statement from the result set, and the connection from the statement.- Throws:
java.sql.SQLException
-
ResultSetResult
public ResultSetResult(java.sql.ResultSet rs, JDBCStore store) throws java.sql.SQLException
JDBC 2 constructor. Relies on being able to retrieve the statement from the result set, and the connection from the statement.- Throws:
java.sql.SQLException
-
-
Method Detail
-
getStatement
public java.sql.Statement getStatement()
Return the statement that produced this result.
-
getResultSet
public java.sql.ResultSet getResultSet()
Return the backing result set.
-
getDBDictionary
public DBDictionary getDBDictionary()
Return the dictionary in use.
-
getStore
public JDBCStore getStore()
Optional store manager used to deserialize blobs containing references to persistent objects.
-
setStore
public void setStore(JDBCStore store)
Optional store manager used to deserialize blobs containing references to persistent objects.
-
getCloseConnection
public boolean getCloseConnection()
Whether to close the backing connection when this result is closed. Defaults to true.
-
setCloseConnection
public void setCloseConnection(boolean closeConn)
Whether to close the backing connection when this result is closed. Defaults to true.
-
setCloseStatement
public void setCloseStatement(boolean closeStatement)
-
close
public void close()
Description copied from class:AbstractResult
Closes all eager results.
-
supportsRandomAccess
public boolean supportsRandomAccess() throws java.sql.SQLException
Description copied from class:AbstractResult
Returns false by default.- Specified by:
supportsRandomAccess
in interfaceResult
- Overrides:
supportsRandomAccess
in classAbstractResult
- Throws:
java.sql.SQLException
-
absoluteInternal
protected boolean absoluteInternal(int row) throws java.sql.SQLException
Description copied from class:AbstractResult
Throws an exception by default.- Overrides:
absoluteInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
nextInternal
protected boolean nextInternal() throws java.sql.SQLException
Description copied from class:AbstractResult
Advance this row.- Specified by:
nextInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
size
public int size() throws java.sql.SQLException
Description copied from interface:Result
Return the number of rows in this result.- Throws:
java.sql.SQLException
-
containsInternal
protected boolean containsInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
Description copied from class:AbstractResult
Return whether this result contains data for the given id or column. The id or column has not beed passed throughAbstractResult.translate(java.lang.Object, org.apache.openjpa.jdbc.sql.Joins)
.- Specified by:
containsInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getArrayInternal
protected java.sql.Array getArrayInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getArrayInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getAsciiStreamInternal
protected java.io.InputStream getAsciiStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getAsciiStreamInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBigDecimalInternal
protected java.math.BigDecimal getBigDecimalInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBigDecimalInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getNumberInternal
protected java.lang.Number getNumberInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getNumberInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBigIntegerInternal
protected java.math.BigInteger getBigIntegerInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBigIntegerInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBinaryStreamInternal
protected java.io.InputStream getBinaryStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBinaryStreamInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBlobInternal
protected java.sql.Blob getBlobInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBlobInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBooleanInternal
protected boolean getBooleanInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBooleanInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getByteInternal
protected byte getByteInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getByteInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getBytesInternal
protected byte[] getBytesInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getBytesInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getCalendarInternal
protected java.util.Calendar getCalendarInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getCalendarInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getLocalDateInternal
protected java.time.LocalDate getLocalDateInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLocalDateInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getLocalTimeInternal
protected java.time.LocalTime getLocalTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLocalTimeInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getLocalDateTimeInternal
protected java.time.LocalDateTime getLocalDateTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLocalDateTimeInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getOffsetTimeInternal
protected java.time.OffsetTime getOffsetTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getOffsetTimeInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getOffsetDateTimeInternal
protected java.time.OffsetDateTime getOffsetDateTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getOffsetDateTimeInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getCharInternal
protected char getCharInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getCharInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getCharacterStreamInternal
protected java.io.Reader getCharacterStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getCharacterStreamInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getClobInternal
protected java.sql.Clob getClobInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getClobInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getDateInternal
protected java.util.Date getDateInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getDateInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getDateInternal
protected java.sql.Date getDateInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins) throws java.sql.SQLException
- Overrides:
getDateInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getDoubleInternal
protected double getDoubleInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getDoubleInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getFloatInternal
protected float getFloatInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getFloatInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getIntInternal
protected int getIntInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getIntInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getLocaleInternal
protected java.util.Locale getLocaleInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLocaleInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getLongInternal
protected long getLongInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLongInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getStreamInternal
protected java.lang.Object getStreamInternal(JDBCStore store, java.lang.Object obj, int metaTypeCode, java.lang.Object arg, Joins joins) throws java.sql.SQLException
- Specified by:
getStreamInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getObjectInternal
protected java.lang.Object getObjectInternal(java.lang.Object obj, int metaTypeCode, java.lang.Object arg, Joins joins) throws java.sql.SQLException
Description copied from class:AbstractResult
Return the value stored in the given id or column.- Specified by:
getObjectInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getSQLObjectInternal
protected java.lang.Object getSQLObjectInternal(java.lang.Object obj, java.util.Map map, Joins joins) throws java.sql.SQLException
- Overrides:
getSQLObjectInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getRefInternal
protected java.sql.Ref getRefInternal(java.lang.Object obj, java.util.Map map, Joins joins) throws java.sql.SQLException
- Overrides:
getRefInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getShortInternal
protected short getShortInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getShortInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getStringInternal
protected java.lang.String getStringInternal(java.lang.Object obj, Joins joins, boolean isClobString) throws java.sql.SQLException
- Overrides:
getStringInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getTimeInternal
protected java.sql.Time getTimeInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins) throws java.sql.SQLException
- Overrides:
getTimeInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
getTimestampInternal
protected java.sql.Timestamp getTimestampInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins) throws java.sql.SQLException
- Overrides:
getTimestampInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
wasNull
public boolean wasNull() throws java.sql.SQLException
Description copied from interface:Result
Return true if the last value fetched was null.- Specified by:
wasNull
in interfaceResult
- Overrides:
wasNull
in classAbstractResult
- Throws:
java.sql.SQLException
-
translate
protected java.lang.Object translate(java.lang.Object obj, Joins joins) throws java.sql.SQLException
Description copied from class:AbstractResult
Translate the user-given id or column. This method is called before delegating to anyget*Internal
methods with the exception ofgetObjectInternal
. Return the original value by default.- Overrides:
translate
in classAbstractResult
- Throws:
java.sql.SQLException
-
findObject
protected int findObject(java.lang.Object obj, Joins joins) throws java.sql.SQLException
Return the 1-based result set index for the given column or id, or a non-positive number if the column is not contained in this result.- Throws:
java.sql.SQLException
-
getLOBStreamInternal
protected java.io.InputStream getLOBStreamInternal(JDBCStore store, java.lang.Object obj, Joins joins) throws java.sql.SQLException
- Overrides:
getLOBStreamInternal
in classAbstractResult
- Throws:
java.sql.SQLException
-
-