wt.pds
Class WTResultSet

java.lang.Object
  extended bywt.pds.AbstractPersistentRetrieve
      extended bywt.pds.WTResultSet
All Implemented Interfaces:
PersistentRetrieveIfc, WTAttributeNameIfc

public class WTResultSet
extends AbstractPersistentRetrieve
implements WTAttributeNameIfc

WTResultSet


Field Summary
(package private)  ResultSet aResultSet
           
(package private)  Map attributeMap
           
private  boolean autoNavigate
           
private static Hashtable autoNavigateCache
           
(package private)  int base
           
private  boolean blobRewriteEnabled
           
private  boolean buildMaps
           
private static Hashtable cache
           
private static Hashtable constrainedClassMap
           
private  String container
           
private  Class currentContainerClass
           
private static RoleDescriptor[] EMPTY_AUTO_NAVIGATE_ROLES
           
private static Object EMPTY_MAP_VALUE
           
private  String[] namesByOffset
           
(package private)  ObjectTable objectTable
           
private  int offset
           
private  HashMap offsetByName
           
private  int[] sizesByOffset
           
private static String SURROGATE_CLASS_NAME
           
private  String topContainerOidName
           
private  ObjectMappable topObject
           
 
Fields inherited from class wt.pds.AbstractPersistentRetrieve
LOBS_DISABLED_KEY
 
Fields inherited from interface wt.util.WTAttributeNameIfc
CREATE_STAMP_NAME, ID_NAME, LATEST_ITERATION, LINK_REFA, LINK_REFB, MODIFY_STAMP_NAME, OBJECT_IDENTIFIER, OID_CLASSNAME, PERSIST_INFO, REF_CLASSNAME, REF_OBJECT_ID, REF_SUFFIX, ROLE_AOBJECT_ROLE, ROLE_BOBJECT_ROLE, ROLEA_CLASSNAME, ROLEA_OBJECT_ID, ROLEA_VERSION_ID, ROLEB_CLASSNAME, ROLEB_OBJECT_ID, ROLEB_VERSION_ID, UPDATE_COUNT_NAME, UPDATE_STAMP_NAME
 
Fields inherited from interface wt.pds.PersistentRetrieveIfc
versionID
 
Constructor Summary
WTResultSet(ResultSet aRS, Map aMap)
           
WTResultSet(ResultSet aRS, Map aMap, ObjectTable aObjectTable, int base)
           
 
Method Summary
private  String buildFullAttrName(String attrName)
           
 void clearWarnings()
           
 void close()
          Immediately release a ResultSet's datastore and connection resources
private  ObjectMappable createObject(String a_attributeName, Class a_staticClass)
           
 int findColumn(String columnName)
           
 InputStream getAsciiStream(String attrName)
          Getters
 Map getAttributeMap()
           
 boolean getAutoNavigate()
           
 BigDecimal getBigDecimal(String attrName)
          Get the value of a column in the current row as a BigDecimal
 InputStream getBinaryStream(String attrName)
          Get the value of a column in the current row as a stream of uninterpreted bytes.
 boolean getBlobRewriteEnabled()
           
 boolean getBoolean(String attrName)
          Get the value of a column in the current row as a Java boolean.
 Boolean getBooleanObject(String attrName)
          Get the value of a column in the current row as a Boolean.
 boolean getBuildMaps()
           
 byte getByte(String attrName)
          Get the value of a column in the current row as a Java byte.
 Byte getByteObject(String attrName)
          Get the value of a column in the current row as a Byte.
 byte[] getBytes(String attrName)
          Get the value of a column in the current row as a Java byte array.
 char getChar(String attrName)
          Get the value of a column in the current row as a Java char.
 Character getCharObject(String attrName)
          Get the value of a column in the current row as a Character.
 String getContainer()
          Get the current container name.
 String getCursorName()
           
 Date getDate(String attrName)
          Get the value of a column in the current row as a java.sql.Date object.
private  String getDescriptorName(ClassInfo aCI, String fullName)
           
 double getDouble(String attrName)
          Get the value of a column in the current row as a Java double.
 Double getDoubleObject(String attrName)
          Get the value of a column in the current row as a Double.
 float getFloat(String attrName)
          Get the value of a column in the current row as a Java float.
 Float getFloatObject(String attrName)
          Get the value of a column in the current row as a Float.
 String getFullAttrName(String attrName)
           
 int getInt(String attrName)
          Get the value of a column in the current row as a Java int.
 Integer getIntObject(String attrName)
          Get the value of a column in the current row as an Integer.
private  byte[] getLobAsByteArray(WTConnection connection, Object b)
           
private  Object getLobAsObject(WTConnection connection, Object b)
           
 LobLocator getLobLocator(String attrName)
          Get a LobLocator for the given attribute.
 long getLong(String attrName)
          Get the value of a column in the current row as a Java long.
 Long getLongObject(String attrName)
          Get the value of a column in the current row as a Long.
 ResultSetMetaData getMetaData()
           
 Object getObject(String attrName)
          Get the value of a column in the current row as a Java object.
 short getShort(String attrName)
          Get the value of a column in the current row as a Java short.
 Short getShortObject(String attrName)
          Get the value of a column in the current row as a Short.
 Object getSmallObject(String attrName)
          Get the value of a column in the current row as a Java object.
 String getString(String attrName)
          Get the value of a column in the current row as a Java String.
 Time getTime(String attrName)
          Get the value of a column in the current row as a java.sql.Time object.
 Timestamp getTimestamp(String attrName)
          Get the value of a column in the current row as a java.sql.Timestamp object.
 ObjectMappable getTopObject()
           
 InputStream getUnicodeStream(String attrName)
          Get the value of a column in the current row as a stream of Unicode characters and then read in chunks.
 SQLWarning getWarnings()
          Utilities
private  int indexOf(String attribute)
           
 boolean next()
          Positioning , Testing
 ObjectMappable readObject(String attribute_name, ObjectMappable obj, Class concrete_class, boolean is_required)
          Get the values corresponding to a nested ObjectMappable Object.
 void setAutoNavigate(boolean autoNavigate)
           
static boolean setLobsDisabled(boolean disabled)
           
private  void setOffset(String attrName)
          Private methods
 boolean wasNull()
          A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value.
 
Methods inherited from class wt.pds.AbstractPersistentRetrieve
getInlineObject, getLobsDisabled, getUserConnection, rewriteBlob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constrainedClassMap

private static Hashtable constrainedClassMap

EMPTY_MAP_VALUE

private static final Object EMPTY_MAP_VALUE

aResultSet

ResultSet aResultSet

attributeMap

Map attributeMap

objectTable

ObjectTable objectTable

base

int base

cache

private static Hashtable cache

autoNavigateCache

private static Hashtable autoNavigateCache

EMPTY_AUTO_NAVIGATE_ROLES

private static final RoleDescriptor[] EMPTY_AUTO_NAVIGATE_ROLES

container

private String container

namesByOffset

private String[] namesByOffset

sizesByOffset

private int[] sizesByOffset

offsetByName

private HashMap offsetByName

offset

private int offset

topObject

private ObjectMappable topObject

autoNavigate

private boolean autoNavigate

buildMaps

private boolean buildMaps

currentContainerClass

private Class currentContainerClass

topContainerOidName

private String topContainerOidName

blobRewriteEnabled

private final boolean blobRewriteEnabled

SURROGATE_CLASS_NAME

private static final String SURROGATE_CLASS_NAME
Constructor Detail

WTResultSet

public WTResultSet(ResultSet aRS,
                   Map aMap)

WTResultSet

public WTResultSet(ResultSet aRS,
                   Map aMap,
                   ObjectTable aObjectTable,
                   int base)
Method Detail

getAsciiStream

public InputStream getAsciiStream(String attrName)
                           throws SQLException
Getters

Specified by:
getAsciiStream in interface PersistentRetrieveIfc
Specified by:
getAsciiStream in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getBinaryStream

public InputStream getBinaryStream(String attrName)
                            throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a stream of uninterpreted bytes.

Specified by:
getBinaryStream in interface PersistentRetrieveIfc
Specified by:
getBinaryStream in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getBoolean

public boolean getBoolean(String attrName)
                   throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java boolean.

Specified by:
getBoolean in interface PersistentRetrieveIfc
Specified by:
getBoolean in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is false
Throws:
SQLException - if a database-access error occurs.

getByte

public byte getByte(String attrName)
             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java byte.

Specified by:
getByte in interface PersistentRetrieveIfc
Specified by:
getByte in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getBytes

public byte[] getBytes(String attrName)
                throws SQLException,
                       DatastoreException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java byte array.

Specified by:
getBytes in interface PersistentRetrieveIfc
Specified by:
getBytes in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.
DatastoreException

getChar

public char getChar(String attrName)
             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java char.

Specified by:
getChar in interface PersistentRetrieveIfc
Specified by:
getChar in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getBigDecimal

public BigDecimal getBigDecimal(String attrName)
                         throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a BigDecimal

Specified by:
getBigDecimal in interface PersistentRetrieveIfc
Specified by:
getBigDecimal in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getDate

public Date getDate(String attrName)
             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a java.sql.Date object.

Specified by:
getDate in interface PersistentRetrieveIfc
Specified by:
getDate in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getDouble

public double getDouble(String attrName)
                 throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java double.

Specified by:
getDouble in interface PersistentRetrieveIfc
Specified by:
getDouble in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getFloat

public float getFloat(String attrName)
               throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java float.

Specified by:
getFloat in interface PersistentRetrieveIfc
Specified by:
getFloat in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getInt

public int getInt(String attrName)
           throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java int.

Specified by:
getInt in interface PersistentRetrieveIfc
Specified by:
getInt in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getLong

public long getLong(String attrName)
             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java long.

Specified by:
getLong in interface PersistentRetrieveIfc
Specified by:
getLong in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getObject

public Object getObject(String attrName)
                 throws SQLException,
                        DatastoreException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java object.

Specified by:
getObject in interface PersistentRetrieveIfc
Specified by:
getObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.
DatastoreException

getSmallObject

public Object getSmallObject(String attrName)
                      throws SQLException,
                             DatastoreException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java object.

Specified by:
getSmallObject in interface PersistentRetrieveIfc
Specified by:
getSmallObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.
DatastoreException

getShort

public short getShort(String attrName)
               throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java short.

Specified by:
getShort in interface PersistentRetrieveIfc
Specified by:
getShort in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is 0
Throws:
SQLException - if a database-access error occurs.

getString

public String getString(String attrName)
                 throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Java String.

Specified by:
getString in interface PersistentRetrieveIfc
Specified by:
getString in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getTime

public Time getTime(String attrName)
             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a java.sql.Time object.

Specified by:
getTime in interface PersistentRetrieveIfc
Specified by:
getTime in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getTimestamp

public Timestamp getTimestamp(String attrName)
                       throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a java.sql.Timestamp object.

Specified by:
getTimestamp in interface PersistentRetrieveIfc
Specified by:
getTimestamp in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getUnicodeStream

public InputStream getUnicodeStream(String attrName)
                             throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a stream of Unicode characters and then read in chunks.

Specified by:
getUnicodeStream in interface PersistentRetrieveIfc
Specified by:
getUnicodeStream in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database-access error occurs.

getLobLocator

public LobLocator getLobLocator(String attrName)
                         throws SQLException,
                                DatastoreException
Description copied from class: AbstractPersistentRetrieve
Get a LobLocator for the given attribute.

Specified by:
getLobLocator in interface PersistentRetrieveIfc
Specified by:
getLobLocator in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Throws:
SQLException - if a database-access error occurs.
DatastoreException

getBooleanObject

public Boolean getBooleanObject(String attrName)
                         throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Boolean.

Specified by:
getBooleanObject in interface PersistentRetrieveIfc
Specified by:
getBooleanObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getByteObject

public Byte getByteObject(String attrName)
                   throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Byte.

Specified by:
getByteObject in interface PersistentRetrieveIfc
Specified by:
getByteObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getCharObject

public Character getCharObject(String attrName)
                        throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Character.

Specified by:
getCharObject in interface PersistentRetrieveIfc
Specified by:
getCharObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getDoubleObject

public Double getDoubleObject(String attrName)
                       throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Double.

Specified by:
getDoubleObject in interface PersistentRetrieveIfc
Specified by:
getDoubleObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getFloatObject

public Float getFloatObject(String attrName)
                     throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Float.

Specified by:
getFloatObject in interface PersistentRetrieveIfc
Specified by:
getFloatObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getIntObject

public Integer getIntObject(String attrName)
                     throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as an Integer.

Specified by:
getIntObject in interface PersistentRetrieveIfc
Specified by:
getIntObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getLongObject

public Long getLongObject(String attrName)
                   throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Long.

Specified by:
getLongObject in interface PersistentRetrieveIfc
Specified by:
getLongObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

getShortObject

public Short getShortObject(String attrName)
                     throws SQLException
Description copied from class: AbstractPersistentRetrieve
Get the value of a column in the current row as a Short.

Specified by:
getShortObject in interface PersistentRetrieveIfc
Specified by:
getShortObject in class AbstractPersistentRetrieve
Parameters:
attrName - a class attribute name
Returns:
the column value; if the value is SQL NULL, then null is returned
Throws:
SQLException - if a database-access error occurs.

readObject

public ObjectMappable readObject(String attribute_name,
                                 ObjectMappable obj,
                                 Class concrete_class,
                                 boolean is_required)
                          throws SQLException,
                                 DatastoreException
Description copied from class: AbstractPersistentRetrieve
Get the values corresponding to a nested ObjectMappable Object. This results in a call to the nested object's readExternal method.

Specified by:
readObject in interface PersistentRetrieveIfc
Specified by:
readObject in class AbstractPersistentRetrieve
Parameters:
attribute_name - a class attribute name
obj - the nested object
concrete_class - the class to instantiate if needed
Throws:
SQLException - if a database-access error occurs.
DatastoreException - if any other internal error occurs.

getContainer

public String getContainer()
Description copied from class: AbstractPersistentRetrieve
Get the current container name. The container name is set by calls to readObject.

Specified by:
getContainer in interface PersistentRetrieveIfc
Specified by:
getContainer in class AbstractPersistentRetrieve
Returns:
the current container name

createObject

private ObjectMappable createObject(String a_attributeName,
                                    Class a_staticClass)
                             throws InstantiationException,
                                    IllegalAccessException
Throws:
InstantiationException
IllegalAccessException

next

public boolean next()
             throws SQLException
Positioning , Testing

Specified by:
next in interface PersistentRetrieveIfc
Specified by:
next in class AbstractPersistentRetrieve
Returns:
true if new row is valid, false if there are no more rows
Throws:
SQLException - if a database-access error occurs.

close

public void close()
           throws SQLException
Description copied from class: AbstractPersistentRetrieve
Immediately release a ResultSet's datastore and connection resources

Specified by:
close in interface PersistentRetrieveIfc
Specified by:
close in class AbstractPersistentRetrieve
Throws:
SQLException - if a database-access error occurs.

wasNull

public boolean wasNull()
                throws SQLException
Description copied from class: AbstractPersistentRetrieve
A column may have the value of SQL NULL; wasNull reports whether the last column read had this special value. Note that you must first call getXXX on a column to try to read its value and then call wasNull() to find if the value was the SQL NULL.

Specified by:
wasNull in interface PersistentRetrieveIfc
Specified by:
wasNull in class AbstractPersistentRetrieve
Returns:
true if last column was a null value
Throws:
SQLException - if a database-access error occurs.

getWarnings

public SQLWarning getWarnings()
                       throws SQLException
Utilities

Throws:
SQLException

clearWarnings

public void clearWarnings()
                   throws SQLException
Throws:
SQLException

getCursorName

public String getCursorName()
                     throws SQLException
Throws:
SQLException

getMetaData

public ResultSetMetaData getMetaData()
                              throws SQLException
Throws:
SQLException

findColumn

public int findColumn(String columnName)

getAttributeMap

public Map getAttributeMap()

getLobAsByteArray

private byte[] getLobAsByteArray(WTConnection connection,
                                 Object b)
                          throws DatastoreException
Throws:
DatastoreException

getLobAsObject

private Object getLobAsObject(WTConnection connection,
                              Object b)
                       throws DatastoreException
Throws:
DatastoreException

getAutoNavigate

public boolean getAutoNavigate()

setAutoNavigate

public void setAutoNavigate(boolean autoNavigate)

setOffset

private void setOffset(String attrName)
Private methods


indexOf

private int indexOf(String attribute)

getBuildMaps

public boolean getBuildMaps()
Specified by:
getBuildMaps in class AbstractPersistentRetrieve

getFullAttrName

public String getFullAttrName(String attrName)
Specified by:
getFullAttrName in class AbstractPersistentRetrieve

buildFullAttrName

private String buildFullAttrName(String attrName)

getDescriptorName

private String getDescriptorName(ClassInfo aCI,
                                 String fullName)

getTopObject

public ObjectMappable getTopObject()
Specified by:
getTopObject in class AbstractPersistentRetrieve

getBlobRewriteEnabled

public boolean getBlobRewriteEnabled()
Specified by:
getBlobRewriteEnabled in class AbstractPersistentRetrieve

setLobsDisabled

public static boolean setLobsDisabled(boolean disabled)