wt.pds
Class WTPreparedStatement

java.lang.Object
  extended bywt.pds.AbstractPersistentStore
      extended bywt.pds.WTPreparedStatement
All Implemented Interfaces:
PersistentStoreIfc, WTAttributeNameIfc
Direct Known Subclasses:
OracleWTPreparedStatement, SQLServerWTPreparedStatement, WTCallableStatement

public abstract class WTPreparedStatement
extends AbstractPersistentStore
implements WTAttributeNameIfc

WTPreparedStatement


Field Summary
protected  Map attributeMap
           
private static Hashtable cache
           
private  ClassInfo classInfo
           
private static String CLASSNAME
           
private  String container
           
static boolean DEBUG
           
protected  int idx
           
protected  Map lobMap
           
protected  ObjectIdentifier lobOid
           
private static DebugWriter LOG
           
private static int MAX_SQL_STRING_SIZE
           
private  String[] namesByOffset
           
private static Object NULL_LOB
           
private  int offset
           
private static String RESOURCE
           
private static String SEPARATOR
           
private  int[] sizesByOffset
           
protected  boolean skip
           
private  int[] sqlTypes
           
protected  PreparedStatement stmt
           
private  String topContainer
           
protected  ObjectMappable topObject
           
 
Fields inherited from class wt.pds.AbstractPersistentStore
INLINE_BLOB_OVERFLOW
 
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.PersistentStoreIfc
versionID
 
Constructor Summary
WTPreparedStatement()
          Constructors
WTPreparedStatement(PreparedStatement aStmt, Map aMap)
           
 
Method Summary
 void clearParameters()
          Utilities
protected  int findColumn(String columnName)
           
 Map getAttributeMap()
           
(package private)  int getBindParameterIndex()
           
 List getBindParameters()
           
 String getContainer()
          Get the current container name.
protected  String getDescriptorName(ClassInfo aCI, String fullName)
           
protected  String getFullAttrName(String attrName)
           
protected  Map getLobMap()
           
 PreparedStatement getStatement()
           
 int indexOf(String attribute)
          Private methods
 boolean isSkip()
           
 void postProcessLobs(WTConnection a_connection, Map a_lobAttributeMap)
           
 void setAsciiStream(String attrName, InputStream aStream, int len)
          parameter setters
 void setAttributeMap(Map aMap)
           
 void setBigDecimal(String attrName, BigDecimal aBigDecimal)
          Set the value to a BigDecimal.
 void setBinaryStream(String attrName, InputStream aStream, int len)
          Set the value to a binary stream.
 void setBoolean(String attrName, boolean aBool)
          Set the value to a Java boolean.
 void setBooleanObject(String attrName, Boolean aBool)
          Set the value to a Boolean.
 void setByte(String attrName, byte aByte)
          Set the value to a Java byte.
 void setByteObject(String attrName, Byte aByte)
          Set the value to a Byte.
abstract  void setBytes(String attrName, byte[] bArray)
          Set the value to a Java byte array.
 void setChar(String attrName, char aChar)
          Set the value to a Java char.
 void setCharObject(String attrName, Character aChar)
          Set the value to a Character.
 void setDate(String attrName, Date aDate)
          Set the value to a java.util.Date.
 void setDouble(String attrName, double aDbl)
          Set the value to a Java double.
 void setDoubleObject(String attrName, Double aDouble)
          Set the value to a Double.
 void setFloat(String attrName, float aFloat)
          Set the value to a Java float.
 void setFloatObject(String attrName, Float aFloat)
          Set the value to a Float.
 void setInt(String attrName, int anInt)
          Set the value to a Java int.
 void setIntObject(String attrName, Integer anInt)
          Set the value to a Integer.
abstract  void setLobLocator(String attrName, LobLocator aLobLocator)
          Set the value to a Lob locator.
 void setLoggingEnabled(boolean a_enabled)
           
 void setLong(String attrName, long aLong)
          Set the value to a Java long.
 void setLongObject(String attrName, Long aLong)
          Set the value to a Long.
 void setNull(int idx, int sqlType)
           
 void setNull(String attrName, int sqlType)
          Set the value to a null.
abstract  void setObject(String attrName, Object anObj)
          Set the value to a Java object.
 void setShort(String attrName, short aShort)
          Set the value to a Java short.
 void setShortObject(String attrName, Short aShort)
          Set the value to a Short.
 void setSmallObject(String attrName, Serializable anObj)
          Set the value to a Java object.
 void setStatement(PreparedStatement aStmt)
           
 void setString(int idx, String a_string)
           
 void setString(String attrName, String aString)
          Set the value to a Java String.
 void setTime(String attrName, Time aTime)
          Set the value to a Java Timee.
 void setTimestamp(String attrName, Timestamp aTS)
          Set the value to a Java Timestamp.
 void setUnicodeStream(String attrName, InputStream aStream, int len)
          Set the value to a Java Unicode stream.
 void writeObject(String attribute_name, ObjectMappable obj, Class concrete_class, boolean is_required)
          Set the values corresponding to a nested ObjectMappable Object.
 
Methods inherited from class wt.pds.AbstractPersistentStore
getUserConnection, setInlineObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

private static final String SEPARATOR
See Also:
Constant Field Values

NULL_LOB

private static final Object NULL_LOB

stmt

protected PreparedStatement stmt

attributeMap

protected Map attributeMap

lobMap

protected Map lobMap

lobOid

protected ObjectIdentifier lobOid

cache

private static Hashtable cache

classInfo

private ClassInfo classInfo

topContainer

private String topContainer

container

private String container

namesByOffset

private String[] namesByOffset

sizesByOffset

private int[] sizesByOffset

sqlTypes

private int[] sqlTypes

offset

private int offset

skip

protected boolean skip

topObject

protected ObjectMappable topObject

idx

protected int idx

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

MAX_SQL_STRING_SIZE

private static final int MAX_SQL_STRING_SIZE

CLASSNAME

private static final String CLASSNAME

DEBUG

public static final boolean DEBUG

LOG

private static final DebugWriter LOG
Constructor Detail

WTPreparedStatement

public WTPreparedStatement()
Constructors


WTPreparedStatement

public WTPreparedStatement(PreparedStatement aStmt,
                           Map aMap)
Method Detail

getStatement

public PreparedStatement getStatement()

getAttributeMap

public Map getAttributeMap()

getBindParameters

public List getBindParameters()

setStatement

public void setStatement(PreparedStatement aStmt)

setAttributeMap

public void setAttributeMap(Map aMap)

setLoggingEnabled

public void setLoggingEnabled(boolean a_enabled)

getLobMap

protected Map getLobMap()

getBindParameterIndex

int getBindParameterIndex()

setAsciiStream

public void setAsciiStream(String attrName,
                           InputStream aStream,
                           int len)
                    throws SQLException
parameter setters

Specified by:
setAsciiStream in interface PersistentStoreIfc
Specified by:
setAsciiStream in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aStream - the parameter value
len - the length of the input stream
Throws:
SQLException - if a database-access error occurs.

setBigDecimal

public void setBigDecimal(String attrName,
                          BigDecimal aBigDecimal)
                   throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a BigDecimal. This maps to SQL type Number(precision,scale).

Specified by:
setBigDecimal in interface PersistentStoreIfc
Specified by:
setBigDecimal in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aBigDecimal - the parameter value
Throws:
SQLException - if a database-access error occurs.

setBinaryStream

public void setBinaryStream(String attrName,
                            InputStream aStream,
                            int len)
                     throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a binary stream. This maps to SQL type LONGVARBINARY

Specified by:
setBinaryStream in interface PersistentStoreIfc
Specified by:
setBinaryStream in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aStream - the parameter value
len - the length of the input stream
Throws:
SQLException - if a database-access error occurs.

setBoolean

public void setBoolean(String attrName,
                       boolean aBool)
                throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java boolean. This maps to SQL type BIT

Specified by:
setBoolean in interface PersistentStoreIfc
Specified by:
setBoolean in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aBool - the parameter value
Throws:
SQLException - if a database-access error occurs.

setBooleanObject

public void setBooleanObject(String attrName,
                             Boolean aBool)
                      throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Boolean. This maps to SQL type BIT

Specified by:
setBooleanObject in interface PersistentStoreIfc
Specified by:
setBooleanObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aBool - the parameter value
Throws:
SQLException - if a database-access error occurs.

setByte

public void setByte(String attrName,
                    byte aByte)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java byte. This maps to SQL type TINYINT

Specified by:
setByte in interface PersistentStoreIfc
Specified by:
setByte in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aByte - the parameter value
Throws:
SQLException - if a database-access error occurs.

setByteObject

public void setByteObject(String attrName,
                          Byte aByte)
                   throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Byte. This maps to SQL type TINYINT

Specified by:
setByteObject in interface PersistentStoreIfc
Specified by:
setByteObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aByte - the parameter value
Throws:
SQLException - if a database-access error occurs.

setBytes

public abstract void setBytes(String attrName,
                              byte[] bArray)
                       throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java byte array. This maps to either SQL type LONGVARBINARY or BLOB

Specified by:
setBytes in interface PersistentStoreIfc
Specified by:
setBytes in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
bArray - the parameter value
Throws:
SQLException - if a database-access error occurs.

setChar

public void setChar(String attrName,
                    char aChar)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java char. This maps to SQL type CHAR(1)

Specified by:
setChar in interface PersistentStoreIfc
Specified by:
setChar in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aChar - the parameter value
Throws:
SQLException - if a database-access error occurs.

setCharObject

public void setCharObject(String attrName,
                          Character aChar)
                   throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Character. This maps to SQL type CHAR(1)

Specified by:
setCharObject in interface PersistentStoreIfc
Specified by:
setCharObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aChar - the parameter value
Throws:
SQLException - if a database-access error occurs.

setDate

public void setDate(String attrName,
                    Date aDate)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a java.util.Date. This maps to SQL type DATE

Specified by:
setDate in interface PersistentStoreIfc
Specified by:
setDate in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aDate - the parameter value
Throws:
SQLException - if a database-access error occurs.

setDouble

public void setDouble(String attrName,
                      double aDbl)
               throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java double. This maps to SQL type DOUBLE

Specified by:
setDouble in interface PersistentStoreIfc
Specified by:
setDouble in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aDbl - the parameter value
Throws:
SQLException - if a database-access error occurs.

setDoubleObject

public void setDoubleObject(String attrName,
                            Double aDouble)
                     throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Double. This maps to SQL type DOUBLE

Specified by:
setDoubleObject in interface PersistentStoreIfc
Specified by:
setDoubleObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aDouble - the parameter value
Throws:
SQLException - if a database-access error occurs.

setFloat

public void setFloat(String attrName,
                     float aFloat)
              throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java float. This maps to SQL type FLOAT

Specified by:
setFloat in interface PersistentStoreIfc
Specified by:
setFloat in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aFloat - the parameter value
Throws:
SQLException - if a database-access error occurs.

setFloatObject

public void setFloatObject(String attrName,
                           Float aFloat)
                    throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Float. This maps to SQL type FLOAT

Specified by:
setFloatObject in interface PersistentStoreIfc
Specified by:
setFloatObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aFloat - the parameter value
Throws:
SQLException - if a database-access error occurs.

setInt

public void setInt(String attrName,
                   int anInt)
            throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java int. This maps to SQL type INTEGER

Specified by:
setInt in interface PersistentStoreIfc
Specified by:
setInt in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
anInt - the parameter value
Throws:
SQLException - if a database-access error occurs.

setIntObject

public void setIntObject(String attrName,
                         Integer anInt)
                  throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Integer. This maps to SQL type INTEGER

Specified by:
setIntObject in interface PersistentStoreIfc
Specified by:
setIntObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
anInt - the parameter value
Throws:
SQLException - if a database-access error occurs.

setLong

public void setLong(String attrName,
                    long aLong)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java long. This maps to SQL type BIGINT

Specified by:
setLong in interface PersistentStoreIfc
Specified by:
setLong in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aLong - the parameter value
Throws:
SQLException - if a database-access error occurs.

setLongObject

public void setLongObject(String attrName,
                          Long aLong)
                   throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Long. This maps to SQL type BIGINT

Specified by:
setLongObject in interface PersistentStoreIfc
Specified by:
setLongObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aLong - the parameter value
Throws:
SQLException - if a database-access error occurs.

setNull

public void setNull(String attrName,
                    int sqlType)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a null. This maps to SQL type SQLNULL

Specified by:
setNull in interface PersistentStoreIfc
Specified by:
setNull in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
sqlType - the SQL type of the attribute
Throws:
SQLException - if a database-access error occurs.

setNull

public void setNull(int idx,
                    int sqlType)
             throws SQLException
Specified by:
setNull in class AbstractPersistentStore
Throws:
SQLException

setObject

public abstract void setObject(String attrName,
                               Object anObj)
                        throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java object. This maps to SQL type LONGVARBINARY or BLOB.

Specified by:
setObject in interface PersistentStoreIfc
Specified by:
setObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
anObj - the parameter value
Throws:
SQLException - if a database-access error occurs.

setSmallObject

public void setSmallObject(String attrName,
                           Serializable anObj)
                    throws SQLException,
                           DatastoreException
Description copied from class: AbstractPersistentStore
Set the value to a Java object. This maps to SQL type LONGVARBINARY or BLOB.

Specified by:
setSmallObject in interface PersistentStoreIfc
Specified by:
setSmallObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
anObj - the parameter value
Throws:
SQLException - if a database-access error occurs.
DatastoreException

setShort

public void setShort(String attrName,
                     short aShort)
              throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java short. This maps to SQL type SMALLINT

Specified by:
setShort in interface PersistentStoreIfc
Specified by:
setShort in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aShort - the parameter value
Throws:
SQLException - if a database-access error occurs.

setShortObject

public void setShortObject(String attrName,
                           Short aShort)
                    throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Short. This maps to SQL type SMALLINT

Specified by:
setShortObject in interface PersistentStoreIfc
Specified by:
setShortObject in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aShort - the parameter value
Throws:
SQLException - if a database-access error occurs.

setString

public void setString(String attrName,
                      String aString)
               throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java String. This maps to SQL type VARCHAR

Specified by:
setString in interface PersistentStoreIfc
Specified by:
setString in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aString - the parameter value
Throws:
SQLException - if a database-access error occurs.

setTime

public void setTime(String attrName,
                    Time aTime)
             throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java Timee. This maps to SQL type TIME

Specified by:
setTime in interface PersistentStoreIfc
Specified by:
setTime in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aTime - the parameter value
Throws:
SQLException - if a database-access error occurs.

setTimestamp

public void setTimestamp(String attrName,
                         Timestamp aTS)
                  throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java Timestamp. This maps to SQL type TIMESTAMP

Specified by:
setTimestamp in interface PersistentStoreIfc
Specified by:
setTimestamp in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aTS - the parameter value
Throws:
SQLException - if a database-access error occurs.

setUnicodeStream

public void setUnicodeStream(String attrName,
                             InputStream aStream,
                             int len)
                      throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Java Unicode stream. This maps to SQL type LONGVARCHAR

Specified by:
setUnicodeStream in interface PersistentStoreIfc
Specified by:
setUnicodeStream in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aStream - the parameter value
Throws:
SQLException - if a database-access error occurs.

setLobLocator

public abstract void setLobLocator(String attrName,
                                   LobLocator aLobLocator)
                            throws SQLException
Description copied from class: AbstractPersistentStore
Set the value to a Lob locator.

Specified by:
setLobLocator in interface PersistentStoreIfc
Specified by:
setLobLocator in class AbstractPersistentStore
Parameters:
attrName - a class attribute name
aLobLocator - the parameter value
Throws:
SQLException - if a database-access error occurs.

postProcessLobs

public void postProcessLobs(WTConnection a_connection,
                            Map a_lobAttributeMap)
                     throws WTException
Throws:
WTException

writeObject

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

Specified by:
writeObject in interface PersistentStoreIfc
Specified by:
writeObject in class AbstractPersistentStore
Parameters:
attribute_name - a class attribute name
obj - the nested object
concrete_class - the class of the object (in case obj is null)
Throws:
SQLException - if a database-access error occurs.
DatastoreException

getContainer

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

Specified by:
getContainer in interface PersistentStoreIfc
Specified by:
getContainer in class AbstractPersistentStore
Returns:
the current container name

clearParameters

public void clearParameters()
                     throws SQLException
Utilities

Throws:
SQLException

indexOf

public int indexOf(String attribute)
Private methods

Specified by:
indexOf in class AbstractPersistentStore

findColumn

protected int findColumn(String columnName)

getFullAttrName

protected String getFullAttrName(String attrName)

getDescriptorName

protected String getDescriptorName(ClassInfo aCI,
                                   String fullName)

isSkip

public boolean isSkip()
Specified by:
isSkip in class AbstractPersistentStore

setString

public void setString(int idx,
                      String a_string)
               throws SQLException
Specified by:
setString in class AbstractPersistentStore
Throws:
SQLException