jet.connect
Class DbValue

java.lang.Object
  extended by jet.connect.DbValue
All Implemented Interfaces:
jet.util.DbValueable, jet.util.QuickSortableNode
Direct Known Subclasses:
DbBinary, DbBit, DbChar, DbDateTime, DbNumber, fArray

public abstract class DbValue
extends java.lang.Object
implements jet.util.QuickSortableNode, jet.util.DbValueable

An abstract class that provides a set of methods to convert data between JDBC data type to Java data types.


Field Summary
 boolean bNull
          Deprecated.  
static DbColDesc CHAR_DESC
          An example value for SQL_CHAR indicates the significant information, which is only available for report example value.
static DbColDesc CURRENCY_DESC
          An example value for CURRENCY DbColDesc indicates the significant information, which is only available for report example value.
static DbColDesc DATE_DESC
          An example value for SQL_DATE indicates the significant information, which is only available for report example value.
 DbColDesc desc
          Deprecated.  
static DbColDesc DOUBLE_DESC
          An example value for SQL_DOUBLE indicates the significant information, which is only available for report example value.
static DbColDesc INTEGER_DESC
          An example value for SQL_INTEGER indicates the significant information, which is only available for report example value.
static DbColDesc TIME_DESC
          An example value for SQL_TIME indicates the significant information, which is only available for report example value.
 
Fields inherited from interface jet.util.DbValueable
EQUAL, GREATER, LESS
 
Constructor Summary
DbValue()
          Trusted package constructor.
DbValue(DbColDesc desc)
          Common constructor for a DbValue.
 
Method Summary
abstract  java.lang.Object clone()
          Creates a clone of this DbValue variable.
abstract  int compareTo(DbValue v)
          Compares with the DbValue object.
 int compareTo(jet.util.DbValueable other)
          A short cut for comparing DbValueable instances.
 int compareTo(jet.util.QuickSortableNode node)
          A short cut for comparing QuicksortableNode instances.
abstract  boolean equals(DbValue v)
          Determines if another DbValue object is of equal value as this DbValue Object.
 boolean equals(java.lang.Object v)
          A short cut and uniform method for comparing DbValues.
 DbColDesc getColDesc()
          Returns the column description and attributes.
 int getPrecision()
          Returns the precision (maximum length) of character or binary data, or the precision of decimal or numeric data for a column in a result set.
 int getScale()
          Returns the scale of a column in a result set for decimal or numeric data.
 int getSqlType()
          Returns the SqlType.
 boolean isCurrency()
          Is this object a cash value?
 boolean isNull()
          Returns the null state of the value.
static DbValue makeDbValue(DbColDesc desc)
          A factory pattern method to create the DbValue by the description of the column.
abstract  void set(DbValue v)
          Sets the value with DbValue.
 void set(JRHierarchicalDataset hds, int col)
          Deprecated.  
abstract  void set(java.sql.ResultSet rs, int col)
          Sets the value with the result set value specified by column index.
 void setColDesc(DbColDesc desc)
          Sets the column description and attributes.
 void setfoo(DbValue v)
          Deprecated.  
 void setNull()
          Sets the value to null.
 void setValue(DbValue v)
          A short cut and uniform method for setting DbValue.
abstract  void setValue(java.lang.String v)
          Set the value with a string.
abstract  java.lang.String toString()
          Converts the value to string.
abstract  java.lang.String toStringValue()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

desc

public DbColDesc desc
Deprecated. 
Column description and attributes for this column and its values. Note use getColDesc and setColDesc to access it instead of accessing it directly.


bNull

public boolean bNull
Deprecated. 
Indicates whether this DbValue is null or not. Note use isNull and setNull to access it instead of accessing it directly.


DOUBLE_DESC

public static DbColDesc DOUBLE_DESC
An example value for SQL_DOUBLE indicates the significant information, which is only available for report example value.

See Also:
ReportFormat

CURRENCY_DESC

public static DbColDesc CURRENCY_DESC
An example value for CURRENCY DbColDesc indicates the significant information, which is only available for report example value.

See Also:
ReportFormat

DATE_DESC

public static DbColDesc DATE_DESC
An example value for SQL_DATE indicates the significant information, which is only available for report example value.

See Also:
ReportFormat

TIME_DESC

public static DbColDesc TIME_DESC
An example value for SQL_TIME indicates the significant information, which is only available for report example value.

See Also:
ReportFormat

CHAR_DESC

public static DbColDesc CHAR_DESC
An example value for SQL_CHAR indicates the significant information, which is only available for report example value.

See Also:
ReportFormat

INTEGER_DESC

public static DbColDesc INTEGER_DESC
An example value for SQL_INTEGER indicates the significant information, which is only available for report example value.

See Also:
ReportFormat
Constructor Detail

DbValue

public DbValue()
Trusted package constructor. Trusted simply means if DbValue is not initialized yet, main instance method could not be accessed and setColDesc must be called.


DbValue

public DbValue(DbColDesc desc)
Common constructor for a DbValue.

Method Detail

getSqlType

public int getSqlType()
Returns the SqlType.

Returns:
SqlType, which is one of the following:
  • Db.SQL_BIGINT
  • Db.SQL_BINARY
  • Db.SQL_BIT
  • Db.SQL_CHAR
  • Db.SQL_DATE
  • Db.SQL_DECIMAL
  • Db.SQL_FLOAT
  • Db.SQL_INTEGER
  • Db.SQL_LONGVARBINARY
  • Db.SQL_LONGVARCHAR
  • Db.SQL_NUMERIC
  • Db.SQL_REAL
  • Db.SQL_SMALLINT
  • Db.SQL_TIME
  • Db.SQL_TIMESTAMP
  • Db.SQL_TINYINT
  • Db.SQL_VARBINARY
  • Db.SQL_VARCHAR

getPrecision

public int getPrecision()
Returns the precision (maximum length) of character or binary data, or the precision of decimal or numeric data for a column in a result set.

Returns:
precision. If the precision cannot be determined, returns 0.

See Also:
DbBinary, DbChar, DbDecimal, jet.connect.DbNumeric, jet.connect.DbLongVarBinary, jet.connect.DbLongVarChar, jet.connect.DbVarBinary, jet.connect.DbVarChar

getScale

public int getScale()
Returns the scale of a column in a result set for decimal or numeric data.

Returns:
Scale. If the precision cannot be determined, returns 0.

See Also:
DbDecimal, jet.connect.DbNumeric

getColDesc

public DbColDesc getColDesc()
Returns the column description and attributes.

Returns:

setColDesc

public void setColDesc(DbColDesc desc)
Sets the column description and attributes.

Parameters:
desc -

isCurrency

public boolean isCurrency()
Is this object a cash value?

Returns:
true if so.

See Also:
Db.SQL_DECIMAL
  • Db.SQL_NUMERIC, BigDecimal

  • isNull

    public boolean isNull()
    Returns the null state of the value.

    Specified by:
    isNull in interface jet.util.DbValueable
    Returns:
    true if the value is null.

    setNull

    public void setNull()
    Sets the value to null.


    set

    public abstract void set(java.sql.ResultSet rs,
                             int col)
                      throws java.sql.SQLException
    Sets the value with the result set value specified by column index.

    Parameters:
    rs - The source value result set.
    col - The source value column number in the rs.
    Throws:
    java.sql.SQLException

    set

    public void set(JRHierarchicalDataset hds,
                    int col)
             throws java.sql.SQLException
    Deprecated. 

    It's non-functional.

    Parameters:
    hds -
    col -
    Throws:
    java.sql.SQLException

    set

    public abstract void set(DbValue v)
    Sets the value with DbValue.


    setValue

    public final void setValue(DbValue v)
    A short cut and uniform method for setting DbValue.

    Parameters:
    v -

    setfoo

    public void setfoo(DbValue v)
    Deprecated. 

    Sets the value and the column description.

    Parameters:
    v -

    clone

    public abstract java.lang.Object clone()
    Creates a clone of this DbValue variable.

    Specified by:
    clone in interface jet.util.DbValueable
    Overrides:
    clone in class java.lang.Object

    equals

    public abstract boolean equals(DbValue v)
    Determines if another DbValue object is of equal value as this DbValue Object.


    equals

    public final boolean equals(java.lang.Object v)
    A short cut and uniform method for comparing DbValues.

    Overrides:
    equals in class java.lang.Object

    setValue

    public abstract void setValue(java.lang.String v)
    Set the value with a string.


    compareTo

    public abstract int compareTo(DbValue v)
    Compares with the DbValue object.

    Returns:
    LESS, EQUAL, or GREAT.
    See Also:
    DbValueable

    compareTo

    public int compareTo(jet.util.QuickSortableNode node)
    A short cut for comparing QuicksortableNode instances. it's converted into DbValue at last.

    Specified by:
    compareTo in interface jet.util.QuickSortableNode
    Returns:
    LESS, EQUAL, or GREAT.
    See Also:
    DbValueable

    compareTo

    public int compareTo(jet.util.DbValueable other)
    A short cut for comparing DbValueable instances. It's converted into DbValue at last.

    Specified by:
    compareTo in interface jet.util.DbValueable
    Returns:
    LESS, EQUAL, or GREAT.
    See Also:
    DbValueable

    makeDbValue

    public static final DbValue makeDbValue(DbColDesc desc)
    A factory pattern method to create the DbValue by the description of the column. Makes a DbValue with the column SQL type.


    toString

    public abstract java.lang.String toString()
    Converts the value to string.

    Overrides:
    toString in class java.lang.Object

    toStringValue

    public abstract java.lang.String toStringValue()
    Returns:
    a string which will represent the value in the DbValue(null flag and value). When compare StringValue from DbValues, we always assume that: the two DbValues have same DbColDesc. Two StringValue equals means the original DbValue equals. Does NOT transfer the compareTo(DbValue v) method. Only comparable dbValue implements this methods. String coding uses Base64.