org.apache.openjpa.jdbc.sql
Class ResultSetResult

java.lang.Object
  extended by org.apache.openjpa.jdbc.sql.AbstractResult
      extended by org.apache.openjpa.jdbc.sql.ResultSetResult
All Implemented Interfaces:
Result, Closeable
Direct Known Subclasses:
SelectImpl.SelectResult

public class ResultSetResult
extends AbstractResult

Base Result implementation wrapped around a result set. Column objects, column names, or column indexes (as Number instances) can be used to retrieve result set data.

Author:
Abe White

Constructor Summary
ResultSetResult(Connection conn, ResultSet rs, DBDictionary dict)
          Constructor.
ResultSetResult(Connection conn, Statement stmnt, ResultSet rs, DBDictionary dict)
          Constructor.
ResultSetResult(Connection conn, Statement stmnt, ResultSet rs, JDBCStore store)
          Constructor.
ResultSetResult(ResultSet rs, DBDictionary dict)
          JDBC 2 constructor.
ResultSetResult(ResultSet rs, JDBCStore store)
          JDBC 2 constructor.
 
Method Summary
protected  boolean absoluteInternal(int row)
          Throws an exception by default.
 void close()
          Closes all eager results.
protected  boolean containsInternal(Object obj, Joins joins)
          Return whether this result contains data for the given id or column.
protected  int findObject(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  Array getArrayInternal(Object obj, Joins joins)
           
protected  InputStream getAsciiStreamInternal(Object obj, Joins joins)
           
protected  BigDecimal getBigDecimalInternal(Object obj, Joins joins)
           
protected  BigInteger getBigIntegerInternal(Object obj, Joins joins)
           
protected  InputStream getBinaryStreamInternal(Object obj, Joins joins)
           
protected  Blob getBlobInternal(Object obj, Joins joins)
           
protected  boolean getBooleanInternal(Object obj, Joins joins)
           
protected  byte getByteInternal(Object obj, Joins joins)
           
protected  byte[] getBytesInternal(Object obj, Joins joins)
           
protected  Calendar getCalendarInternal(Object obj, Joins joins)
           
protected  Reader getCharacterStreamInternal(Object obj, Joins joins)
           
protected  char getCharInternal(Object obj, Joins joins)
           
protected  Clob getClobInternal(Object obj, Joins joins)
           
 boolean getCloseConnection()
          Whether to close the backing connection when this result is closed.
protected  Date getDateInternal(Object obj, Calendar cal, Joins joins)
           
protected  Date getDateInternal(Object obj, Joins joins)
           
 DBDictionary getDBDictionary()
          Return the dictionary in use.
protected  double getDoubleInternal(Object obj, Joins joins)
           
protected  float getFloatInternal(Object obj, Joins joins)
           
protected  int getIntInternal(Object obj, Joins joins)
           
protected  InputStream getLOBStreamInternal(JDBCStore store, Object obj, Joins joins)
           
protected  Locale getLocaleInternal(Object obj, Joins joins)
           
protected  long getLongInternal(Object obj, Joins joins)
           
protected  Number getNumberInternal(Object obj, Joins joins)
           
protected  Object getObjectInternal(Object obj, int metaTypeCode, Object arg, Joins joins)
          Return the value stored in the given id or column.
protected  Ref getRefInternal(Object obj, Map map, Joins joins)
           
 ResultSet getResultSet()
          Return the backing result set.
protected  short getShortInternal(Object obj, Joins joins)
           
protected  Object getSQLObjectInternal(Object obj, Map map, Joins joins)
           
 Statement getStatement()
          Return the statement that produced this result.
 JDBCStore getStore()
          Optional store manager used to deserialize blobs containing references to persistent objects.
protected  Object getStreamInternal(JDBCStore store, Object obj, int metaTypeCode, Object arg, Joins joins)
           
protected  String getStringInternal(Object obj, Joins joins)
           
protected  Time getTimeInternal(Object obj, Calendar cal, Joins joins)
           
protected  Timestamp getTimestampInternal(Object obj, 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 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  Object translate(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, getLocale, getLocale, getLong, getLong, getMappedByFieldMapping, getMappedByValue, getNumber, getNumber, getObject, getObject, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetResult

public ResultSetResult(Connection conn,
                       Statement stmnt,
                       ResultSet rs,
                       DBDictionary dict)
Constructor.


ResultSetResult

public ResultSetResult(Connection conn,
                       Statement stmnt,
                       ResultSet rs,
                       JDBCStore store)
Constructor.


ResultSetResult

public ResultSetResult(Connection conn,
                       ResultSet rs,
                       DBDictionary dict)
Constructor.


ResultSetResult

public ResultSetResult(ResultSet rs,
                       DBDictionary dict)
                throws SQLException
JDBC 2 constructor. Relies on being able to retrieve the statement from the result set, and the connection from the statement.

Throws:
SQLException

ResultSetResult

public ResultSetResult(ResultSet rs,
                       JDBCStore store)
                throws SQLException
JDBC 2 constructor. Relies on being able to retrieve the statement from the result set, and the connection from the statement.

Throws:
SQLException
Method Detail

getStatement

public Statement getStatement()
Return the statement that produced this result.


getResultSet

public 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.


close

public void close()
Description copied from class: AbstractResult
Closes all eager results.

Specified by:
close in interface Result
Specified by:
close in interface Closeable
Overrides:
close in class AbstractResult

supportsRandomAccess

public boolean supportsRandomAccess()
                             throws SQLException
Description copied from class: AbstractResult
Returns false by default.

Specified by:
supportsRandomAccess in interface Result
Overrides:
supportsRandomAccess in class AbstractResult
Throws:
SQLException

absoluteInternal

protected boolean absoluteInternal(int row)
                            throws SQLException
Description copied from class: AbstractResult
Throws an exception by default.

Overrides:
absoluteInternal in class AbstractResult
Throws:
SQLException

nextInternal

protected boolean nextInternal()
                        throws SQLException
Description copied from class: AbstractResult
Advance this row.

Specified by:
nextInternal in class AbstractResult
Throws:
SQLException

size

public int size()
         throws SQLException
Description copied from interface: Result
Return the number of rows in this result.

Throws:
SQLException

containsInternal

protected boolean containsInternal(Object obj,
                                   Joins joins)
                            throws 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 through AbstractResult.translate(java.lang.Object, org.apache.openjpa.jdbc.sql.Joins).

Specified by:
containsInternal in class AbstractResult
Throws:
SQLException

getArrayInternal

protected Array getArrayInternal(Object obj,
                                 Joins joins)
                          throws SQLException
Overrides:
getArrayInternal in class AbstractResult
Throws:
SQLException

getAsciiStreamInternal

protected InputStream getAsciiStreamInternal(Object obj,
                                             Joins joins)
                                      throws SQLException
Overrides:
getAsciiStreamInternal in class AbstractResult
Throws:
SQLException

getBigDecimalInternal

protected BigDecimal getBigDecimalInternal(Object obj,
                                           Joins joins)
                                    throws SQLException
Overrides:
getBigDecimalInternal in class AbstractResult
Throws:
SQLException

getNumberInternal

protected Number getNumberInternal(Object obj,
                                   Joins joins)
                            throws SQLException
Overrides:
getNumberInternal in class AbstractResult
Throws:
SQLException

getBigIntegerInternal

protected BigInteger getBigIntegerInternal(Object obj,
                                           Joins joins)
                                    throws SQLException
Overrides:
getBigIntegerInternal in class AbstractResult
Throws:
SQLException

getBinaryStreamInternal

protected InputStream getBinaryStreamInternal(Object obj,
                                              Joins joins)
                                       throws SQLException
Overrides:
getBinaryStreamInternal in class AbstractResult
Throws:
SQLException

getBlobInternal

protected Blob getBlobInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getBlobInternal in class AbstractResult
Throws:
SQLException

getBooleanInternal

protected boolean getBooleanInternal(Object obj,
                                     Joins joins)
                              throws SQLException
Overrides:
getBooleanInternal in class AbstractResult
Throws:
SQLException

getByteInternal

protected byte getByteInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getByteInternal in class AbstractResult
Throws:
SQLException

getBytesInternal

protected byte[] getBytesInternal(Object obj,
                                  Joins joins)
                           throws SQLException
Overrides:
getBytesInternal in class AbstractResult
Throws:
SQLException

getCalendarInternal

protected Calendar getCalendarInternal(Object obj,
                                       Joins joins)
                                throws SQLException
Overrides:
getCalendarInternal in class AbstractResult
Throws:
SQLException

getCharInternal

protected char getCharInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getCharInternal in class AbstractResult
Throws:
SQLException

getCharacterStreamInternal

protected Reader getCharacterStreamInternal(Object obj,
                                            Joins joins)
                                     throws SQLException
Overrides:
getCharacterStreamInternal in class AbstractResult
Throws:
SQLException

getClobInternal

protected Clob getClobInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getClobInternal in class AbstractResult
Throws:
SQLException

getDateInternal

protected Date getDateInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getDateInternal in class AbstractResult
Throws:
SQLException

getDateInternal

protected Date getDateInternal(Object obj,
                               Calendar cal,
                               Joins joins)
                        throws SQLException
Overrides:
getDateInternal in class AbstractResult
Throws:
SQLException

getDoubleInternal

protected double getDoubleInternal(Object obj,
                                   Joins joins)
                            throws SQLException
Overrides:
getDoubleInternal in class AbstractResult
Throws:
SQLException

getFloatInternal

protected float getFloatInternal(Object obj,
                                 Joins joins)
                          throws SQLException
Overrides:
getFloatInternal in class AbstractResult
Throws:
SQLException

getIntInternal

protected int getIntInternal(Object obj,
                             Joins joins)
                      throws SQLException
Overrides:
getIntInternal in class AbstractResult
Throws:
SQLException

getLocaleInternal

protected Locale getLocaleInternal(Object obj,
                                   Joins joins)
                            throws SQLException
Overrides:
getLocaleInternal in class AbstractResult
Throws:
SQLException

getLongInternal

protected long getLongInternal(Object obj,
                               Joins joins)
                        throws SQLException
Overrides:
getLongInternal in class AbstractResult
Throws:
SQLException

getStreamInternal

protected Object getStreamInternal(JDBCStore store,
                                   Object obj,
                                   int metaTypeCode,
                                   Object arg,
                                   Joins joins)
                            throws SQLException
Specified by:
getStreamInternal in class AbstractResult
Throws:
SQLException

getObjectInternal

protected Object getObjectInternal(Object obj,
                                   int metaTypeCode,
                                   Object arg,
                                   Joins joins)
                            throws SQLException
Description copied from class: AbstractResult
Return the value stored in the given id or column.

Specified by:
getObjectInternal in class AbstractResult
Throws:
SQLException

getSQLObjectInternal

protected Object getSQLObjectInternal(Object obj,
                                      Map map,
                                      Joins joins)
                               throws SQLException
Overrides:
getSQLObjectInternal in class AbstractResult
Throws:
SQLException

getRefInternal

protected Ref getRefInternal(Object obj,
                             Map map,
                             Joins joins)
                      throws SQLException
Overrides:
getRefInternal in class AbstractResult
Throws:
SQLException

getShortInternal

protected short getShortInternal(Object obj,
                                 Joins joins)
                          throws SQLException
Overrides:
getShortInternal in class AbstractResult
Throws:
SQLException

getStringInternal

protected String getStringInternal(Object obj,
                                   Joins joins)
                            throws SQLException
Overrides:
getStringInternal in class AbstractResult
Throws:
SQLException

getTimeInternal

protected Time getTimeInternal(Object obj,
                               Calendar cal,
                               Joins joins)
                        throws SQLException
Overrides:
getTimeInternal in class AbstractResult
Throws:
SQLException

getTimestampInternal

protected Timestamp getTimestampInternal(Object obj,
                                         Calendar cal,
                                         Joins joins)
                                  throws SQLException
Overrides:
getTimestampInternal in class AbstractResult
Throws:
SQLException

wasNull

public boolean wasNull()
                throws SQLException
Description copied from interface: Result
Return true if the last value fetched was null.

Specified by:
wasNull in interface Result
Overrides:
wasNull in class AbstractResult
Throws:
SQLException

translate

protected Object translate(Object obj,
                           Joins joins)
                    throws SQLException
Description copied from class: AbstractResult
Translate the user-given id or column. This method is called before delegating to any get*Internal methods. Return the original value by default.

Overrides:
translate in class AbstractResult
Throws:
SQLException

findObject

protected int findObject(Object obj,
                         Joins joins)
                  throws 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:
SQLException

getLOBStreamInternal

protected InputStream getLOBStreamInternal(JDBCStore store,
                                           Object obj,
                                           Joins joins)
                                    throws SQLException
Overrides:
getLOBStreamInternal in class AbstractResult
Throws:
SQLException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.