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
BaseResultimplementation wrapped around a result set. Column objects, column names, or column indexes (asNumberinstances) 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 booleanabsoluteInternal(int row)Throws an exception by default.voidclose()Closes all eager results.protected booleancontainsInternal(java.lang.Object obj, Joins joins)Return whether this result contains data for the given id or column.protected intfindObject(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.ArraygetArrayInternal(java.lang.Object obj, Joins joins)protected java.io.InputStreamgetAsciiStreamInternal(java.lang.Object obj, Joins joins)protected java.math.BigDecimalgetBigDecimalInternal(java.lang.Object obj, Joins joins)protected java.math.BigIntegergetBigIntegerInternal(java.lang.Object obj, Joins joins)protected java.io.InputStreamgetBinaryStreamInternal(java.lang.Object obj, Joins joins)protected java.sql.BlobgetBlobInternal(java.lang.Object obj, Joins joins)protected booleangetBooleanInternal(java.lang.Object obj, Joins joins)protected bytegetByteInternal(java.lang.Object obj, Joins joins)protected byte[]getBytesInternal(java.lang.Object obj, Joins joins)protected java.util.CalendargetCalendarInternal(java.lang.Object obj, Joins joins)protected java.io.ReadergetCharacterStreamInternal(java.lang.Object obj, Joins joins)protected chargetCharInternal(java.lang.Object obj, Joins joins)protected java.sql.ClobgetClobInternal(java.lang.Object obj, Joins joins)booleangetCloseConnection()Whether to close the backing connection when this result is closed.protected java.sql.DategetDateInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)protected java.util.DategetDateInternal(java.lang.Object obj, Joins joins)DBDictionarygetDBDictionary()Return the dictionary in use.protected doublegetDoubleInternal(java.lang.Object obj, Joins joins)protected floatgetFloatInternal(java.lang.Object obj, Joins joins)protected intgetIntInternal(java.lang.Object obj, Joins joins)protected java.io.InputStreamgetLOBStreamInternal(JDBCStore store, java.lang.Object obj, Joins joins)protected java.time.LocalDategetLocalDateInternal(java.lang.Object obj, Joins joins)protected java.time.LocalDateTimegetLocalDateTimeInternal(java.lang.Object obj, Joins joins)protected java.util.LocalegetLocaleInternal(java.lang.Object obj, Joins joins)protected java.time.LocalTimegetLocalTimeInternal(java.lang.Object obj, Joins joins)protected longgetLongInternal(java.lang.Object obj, Joins joins)protected java.lang.NumbergetNumberInternal(java.lang.Object obj, Joins joins)protected java.lang.ObjectgetObjectInternal(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.OffsetDateTimegetOffsetDateTimeInternal(java.lang.Object obj, Joins joins)protected java.time.OffsetTimegetOffsetTimeInternal(java.lang.Object obj, Joins joins)protected java.sql.RefgetRefInternal(java.lang.Object obj, java.util.Map map, Joins joins)java.sql.ResultSetgetResultSet()Return the backing result set.protected shortgetShortInternal(java.lang.Object obj, Joins joins)protected java.lang.ObjectgetSQLObjectInternal(java.lang.Object obj, java.util.Map map, Joins joins)java.sql.StatementgetStatement()Return the statement that produced this result.JDBCStoregetStore()Optional store manager used to deserialize blobs containing references to persistent objects.protected java.lang.ObjectgetStreamInternal(JDBCStore store, java.lang.Object obj, int metaTypeCode, java.lang.Object arg, Joins joins)protected java.lang.StringgetStringInternal(java.lang.Object obj, Joins joins, boolean isClobString)protected java.sql.TimegetTimeInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)protected java.sql.TimestampgetTimestampInternal(java.lang.Object obj, java.util.Calendar cal, Joins joins)protected booleannextInternal()Advance this row.voidsetCloseConnection(boolean closeConn)Whether to close the backing connection when this result is closed.voidsetCloseStatement(boolean closeStatement)voidsetStore(JDBCStore store)Optional store manager used to deserialize blobs containing references to persistent objects.intsize()Return the number of rows in this result.booleansupportsRandomAccess()Returns false by default.protected java.lang.Objecttranslate(java.lang.Object obj, Joins joins)Translate the user-given id or column.booleanwasNull()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.SQLExceptionJDBC 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.SQLExceptionJDBC 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:AbstractResultCloses all eager results.
-
supportsRandomAccess
public boolean supportsRandomAccess() throws java.sql.SQLExceptionDescription copied from class:AbstractResultReturns false by default.- Specified by:
supportsRandomAccessin interfaceResult- Overrides:
supportsRandomAccessin classAbstractResult- Throws:
java.sql.SQLException
-
absoluteInternal
protected boolean absoluteInternal(int row) throws java.sql.SQLExceptionDescription copied from class:AbstractResultThrows an exception by default.- Overrides:
absoluteInternalin classAbstractResult- Throws:
java.sql.SQLException
-
nextInternal
protected boolean nextInternal() throws java.sql.SQLExceptionDescription copied from class:AbstractResultAdvance this row.- Specified by:
nextInternalin classAbstractResult- Throws:
java.sql.SQLException
-
size
public int size() throws java.sql.SQLExceptionDescription copied from interface:ResultReturn the number of rows in this result.- Throws:
java.sql.SQLException
-
containsInternal
protected boolean containsInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLExceptionDescription copied from class:AbstractResultReturn 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:
containsInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getArrayInternal
protected java.sql.Array getArrayInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getArrayInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getAsciiStreamInternal
protected java.io.InputStream getAsciiStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getAsciiStreamInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBigDecimalInternal
protected java.math.BigDecimal getBigDecimalInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBigDecimalInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getNumberInternal
protected java.lang.Number getNumberInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getNumberInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBigIntegerInternal
protected java.math.BigInteger getBigIntegerInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBigIntegerInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBinaryStreamInternal
protected java.io.InputStream getBinaryStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBinaryStreamInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBlobInternal
protected java.sql.Blob getBlobInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBlobInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBooleanInternal
protected boolean getBooleanInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBooleanInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getByteInternal
protected byte getByteInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getByteInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getBytesInternal
protected byte[] getBytesInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getBytesInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getCalendarInternal
protected java.util.Calendar getCalendarInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getCalendarInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getLocalDateInternal
protected java.time.LocalDate getLocalDateInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getLocalDateInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getLocalTimeInternal
protected java.time.LocalTime getLocalTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getLocalTimeInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getLocalDateTimeInternal
protected java.time.LocalDateTime getLocalDateTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getLocalDateTimeInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getOffsetTimeInternal
protected java.time.OffsetTime getOffsetTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getOffsetTimeInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getOffsetDateTimeInternal
protected java.time.OffsetDateTime getOffsetDateTimeInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getOffsetDateTimeInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getCharInternal
protected char getCharInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getCharInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getCharacterStreamInternal
protected java.io.Reader getCharacterStreamInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getCharacterStreamInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getClobInternal
protected java.sql.Clob getClobInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getClobInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getDateInternal
protected java.util.Date getDateInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getDateInternalin 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:
getDateInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getDoubleInternal
protected double getDoubleInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getDoubleInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getFloatInternal
protected float getFloatInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getFloatInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getIntInternal
protected int getIntInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getIntInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getLocaleInternal
protected java.util.Locale getLocaleInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getLocaleInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getLongInternal
protected long getLongInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getLongInternalin 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:
getStreamInternalin 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.SQLExceptionDescription copied from class:AbstractResultReturn the value stored in the given id or column.- Specified by:
getObjectInternalin 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:
getSQLObjectInternalin 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:
getRefInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getShortInternal
protected short getShortInternal(java.lang.Object obj, Joins joins) throws java.sql.SQLException- Overrides:
getShortInternalin classAbstractResult- Throws:
java.sql.SQLException
-
getStringInternal
protected java.lang.String getStringInternal(java.lang.Object obj, Joins joins, boolean isClobString) throws java.sql.SQLException- Overrides:
getStringInternalin 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:
getTimeInternalin 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:
getTimestampInternalin classAbstractResult- Throws:
java.sql.SQLException
-
wasNull
public boolean wasNull() throws java.sql.SQLExceptionDescription copied from interface:ResultReturn true if the last value fetched was null.- Specified by:
wasNullin interfaceResult- Overrides:
wasNullin classAbstractResult- Throws:
java.sql.SQLException
-
translate
protected java.lang.Object translate(java.lang.Object obj, Joins joins) throws java.sql.SQLExceptionDescription copied from class:AbstractResultTranslate the user-given id or column. This method is called before delegating to anyget*Internalmethods with the exception ofgetObjectInternal. Return the original value by default.- Overrides:
translatein classAbstractResult- Throws:
java.sql.SQLException
-
findObject
protected int findObject(java.lang.Object obj, Joins joins) throws java.sql.SQLExceptionReturn 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:
getLOBStreamInternalin classAbstractResult- Throws:
java.sql.SQLException
-
-