com.ibm.db.base
Class DatabaseTypeField

java.lang.Object
  |
  +--com.ibm.db.base.DatabaseTypeField
Direct Known Subclasses:
DatabaseBinaryField, DatabaseBLOBField, DatabaseBooleanField, DatabaseCLOBField, DatabaseDateField, DatabaseDecimalField, DatabaseDoubleField, DatabaseFloatField, DatabaseIntegerField, DatabaseLongBinaryField, DatabaseLongIntegerField, DatabaseLongStringField, DatabaseShortIntegerField, DatabaseStringField, DatabaseTimeField, DatabaseTimestampField

public abstract class DatabaseTypeField
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

See Also:
Serialized Form

Field Summary
private static java.lang.String copyright
           
static int INOUT
           
static int INPUT
           
private  int length
           
protected  int mode
           
private  java.lang.String name
           
static int OUTPUT
           
private  int scale
           
private  boolean searchable
           
(package private) static long serialVersionUID
           
protected  int sqlType
           
protected  java.lang.String sqlTypeName
           
 
Constructor Summary
DatabaseTypeField()
          Constructs a new DatabaseTypeField.
DatabaseTypeField(java.lang.String aName)
          Constructs a new DatabaseTypeField with the specified name.
 
Method Summary
 java.lang.Object clone()
          This method was created by a SmartGuide.
abstract  java.lang.Class getFieldClass()
          Returns the Java class used to hold a value of this field.
 int getLength()
          Returns the length associated with the source SQLType.
 int getMode()
          Returns the mode of this field (input, output, inout).
 java.lang.String getName()
          Returns the name of the DatabaseTypeField.
 java.lang.Object getObject(java.sql.CallableStatement aStatement, int anIndex)
          Retrieves the parameter value at the specified column index from the specified CallableStatement
abstract  java.lang.Object getObject(java.sql.ResultSet aResultSet, int anIndex)
          Retrieves the column value at the specified column index from the specified ResultSet
 int getScale()
          Returns the scale associated with the source SQLType.
abstract  int getSQLType()
          Returns the SQLType associated with this DatabaseTypeField.
 java.lang.String getSQLTypeName()
          Returns the name of the SQL type associated with this DatabaseTypeField.
 boolean isSearchable()
          Returns true if the column is searchable.
abstract  void setFieldObject(java.lang.Object anObject, java.sql.PreparedStatement aStatement, int anIndex)
          Sets the parameter with the specified index in the specified PreparedStatement to the specified value.
 void setLength(int aLength)
          Sets the length to be associated with the SQLType of the field.
 void setMode(int aMode)
          Sets the mode of the DatabaseTypeField.
 void setName(java.lang.String aName)
          Sets the name of the DatabaseTypeField.
 void setObject(java.lang.Object anObject, java.sql.PreparedStatement aStatement, int anIndex)
          Sets the parameter with the specified index in the specified PreparedStatement to the specified value.
 void setScale(int aScale)
          Sets the scale to be associated with the SQLType of the field.
 void setSearchable(boolean aSearchable)
          Sets if the column is searchable
 void setSQLType(int anSQLType)
          Sets the SQLType of this DatabaseTypeField.
 void setSQLTypeName(java.lang.String aTypeName)
          Sets the SQLTypeName of this DatabaseTypeField.
 java.lang.String toString()
          Returns the string 'javaClass:fieldName', where javaClass is the Java class of the field and fieldName is the name of the DatabaseTypeField.
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

INPUT

public static final int INPUT

INOUT

public static final int INOUT

OUTPUT

public static final int OUTPUT

name

private java.lang.String name

sqlType

protected int sqlType

length

private int length

scale

private int scale

searchable

private boolean searchable

mode

protected int mode

sqlTypeName

protected java.lang.String sqlTypeName

serialVersionUID

static final long serialVersionUID

copyright

private static final java.lang.String copyright
Constructor Detail

DatabaseTypeField

public DatabaseTypeField()
Constructs a new DatabaseTypeField.

DatabaseTypeField

public DatabaseTypeField(java.lang.String aName)
Constructs a new DatabaseTypeField with the specified name.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
This method was created by a SmartGuide.
Overrides:
clone in class java.lang.Object
Returns:
java.lang.Object

getFieldClass

public abstract java.lang.Class getFieldClass()
Returns the Java class used to hold a value of this field.
Returns:
the java class of the field

getLength

public int getLength()
Returns the length associated with the source SQLType.

getMode

public int getMode()
Returns the mode of this field (input, output, inout). (used only for fields that are parameters)

getName

public java.lang.String getName()
Returns the name of the DatabaseTypeField.

getObject

public java.lang.Object getObject(java.sql.CallableStatement aStatement,
                                  int anIndex)
                           throws java.sql.SQLException
Retrieves the parameter value at the specified column index from the specified CallableStatement
Parameters:
anIndex - the index of column
aStatement - the CallableStatement that contains the values

getObject

public abstract java.lang.Object getObject(java.sql.ResultSet aResultSet,
                                           int anIndex)
                                    throws java.sql.SQLException
Retrieves the column value at the specified column index from the specified ResultSet
Parameters:
aResult - the ResultSet that contains the values
anIndex - the index of column

getScale

public int getScale()
Returns the scale associated with the source SQLType.

getSQLType

public abstract int getSQLType()
Returns the SQLType associated with this DatabaseTypeField. If no SQLType has been specified, the default SQLType for this DatabaseTypeField is returned.

getSQLTypeName

public java.lang.String getSQLTypeName()
Returns the name of the SQL type associated with this DatabaseTypeField.

isSearchable

public boolean isSearchable()
Returns true if the column is searchable.

setFieldObject

public abstract void setFieldObject(java.lang.Object anObject,
                                    java.sql.PreparedStatement aStatement,
                                    int anIndex)
                             throws java.sql.SQLException
Sets the parameter with the specified index in the specified PreparedStatement to the specified value.
Parameters:
anObject - the object value for the parameter
sStatement - the PreparedStatement
anIndex - the index of the parameter

setLength

public void setLength(int aLength)
Sets the length to be associated with the SQLType of the field.
Parameters:
aLength - the length

setMode

public void setMode(int aMode)
Sets the mode of the DatabaseTypeField.
Parameters:
aMode - the mode (input, output, inout) (used only for fields that are parameters)

setName

public void setName(java.lang.String aName)
Sets the name of the DatabaseTypeField.
Parameters:
aName - the name

setObject

public void setObject(java.lang.Object anObject,
                      java.sql.PreparedStatement aStatement,
                      int anIndex)
               throws java.sql.SQLException
Sets the parameter with the specified index in the specified PreparedStatement to the specified value. If the specified parameter value is null, the parameter is set to null.
Parameters:
anObject - the object value for the parameter
sStatement - the PreparedStatement
anIndex - the index of the parameter

setScale

public void setScale(int aScale)
Sets the scale to be associated with the SQLType of the field.
Parameters:
aScale - the scale

setSearchable

public void setSearchable(boolean aSearchable)
Sets if the column is searchable
Parameters:
aScale - the scale

setSQLType

public void setSQLType(int anSQLType)
Sets the SQLType of this DatabaseTypeField.
Parameters:
anSQLType - the SQLType

setSQLTypeName

public void setSQLTypeName(java.lang.String aTypeName)
Sets the SQLTypeName of this DatabaseTypeField.
Parameters:
aTypeName - the name of the SQL Type

toString

public java.lang.String toString()
Returns the string 'javaClass:fieldName', where javaClass is the Java class of the field and fieldName is the name of the DatabaseTypeField.
Overrides:
toString in class java.lang.Object