jet.connect
Class DbColDesc

java.lang.Object
  extended by jet.connect.DbColDesc
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, jet.util.ColumnIndexable

public class DbColDesc
extends java.lang.Object
implements jet.util.ColumnIndexable, java.io.Externalizable

A class that encapsulates all description information about a column in a result set.

Note that a DbColDesc can be used to get information about the types and properties of the columns in a DbValue object. The following code fragment creates the DbValue object value.


     DbColDesc intDesc = new DbColDesc("",Db.SQL_INTEGER,15,0,Db.SQL_NULLABLE_UNKNOWN);
     DbValue value= new DbValue(intDesc);

 

See Also:
Serialized Form

Field Summary
static int ARRAY
          The constant referred to as an attribute type code identifies it's ARRAY Type.
 int bigDecimalLength
          The length of the BigDecimal type column for writing idx report.
 java.lang.String colName
          Deprecated.  
static int CONSTANT
          The constant referred to as an attribute type code identifies it's CONSTANT Type.
static int CURRENCY
          The constant referred to as an attribute type code identifies it's CURRENCY Type.
static int ENCODE
          The constant referred to as an attribute type code identifies it's ENCODE Type, which means the name for this column is encoded.
static int GLOBAL
          The constant referred to as an attribute type code identifies it's GLOBAL Type.
static int GROUPABLE
          The constant referred to as an attribute type code identifies it's GROUPABLE Type, which means it can be used in SQL Group By clause.
static int GROUPLEVEL
          The constant referred to as an attribute type code identifies it's GROUPLEVEL Type, which means this column indicates the value in this DbValue is the level of the group(i.e.
static int IGNORECASE
          The constant referred to as an attribute type code identifies it's IGNORECASE Type, which means cases of the column name will be ignored.
static int NOTAUTOENCODE
          The constant referred to as an attribute type code identifies it's NOTAUTOENCODE Type, which means the name for this column will not be encoded by default "8859_1".
 int nullable
          Deprecated.  
static int PARAMETER
          The constant referred to as an attribute type code identifies it's PARAMETER Type.
 int precision
          Deprecated.  
 int scale
          Deprecated.  
 int sqlType
          Deprecated.  
static int USER_DEFINED
          The constant referred to as an attribute type code identifies it's USER_DEFINED Type, which means a user defined column, like formula.
 
Constructor Summary
DbColDesc()
          Constructs an uninitialized DbColDesc.
DbColDesc(DbColDesc desc)
          Constructs an initialized DbColDesc.
DbColDesc(java.lang.String ColName, int SqlType, int Precision, int Scale, int Nullable)
          Constructs an initialized DbColDesc.
DbColDesc(java.lang.String ColName, int SqlType, int Precision, int Scale, int Nullable, boolean bCurrency)
          Constructs an initialized DbColDesc.
 
Method Summary
 java.lang.Object clone()
          Deep clones this object.
 boolean equals(java.lang.Object colDesc)
          Compares the column names to see if they are equal.
 int getColIndex()
          Retrieves the integer index for this column.
 java.lang.String getColName()
          Returns the name of a column.
 java.lang.String getEncodingName()
          Retrieves the encoding name for this column.
 int getFlag()
          Returns the column flag which is composed of all supported attributes for the column description object.
 int getFromEncoding()
          Retrieves the integer value for converted encoding.
 int getNullable()
          Returns information of whether a column result set can have null values.
 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.
 java.lang.String getRealColName()
          Retrieves the real name for this column.
 int getScale()
          Returns the scale of a column in a result set for decimal or numeric data.
 int getSqlType()
          Returns the SqlType.
 int getToEncoding()
          Retrieves the integer value for original encoding.
 boolean isArray()
          Retrieves the indicator that shows whether the column is Array type.
 boolean isConstant()
          Returns the constant indicator to show whether the column is a constant.
 boolean isCurrency()
          Returns the currency type indicator to show whether the column is a currency type.
 boolean isEncode()
          Retrieves the indicator that shows whether the column is encoded.
 boolean isGlobal()
          Returns the global indicator to show whether the column is for global.
 boolean isGroupable()
          Returns the group indicator to show whether the column can be used for group clause.
 boolean isGroupLevel()
          Retrieves the indicator that shows whether the column is grouped.
 boolean isIgnoreCase()
          Returns the indicator of ignoring case.
 boolean isNotAutoEncode()
          Retrieves the indicator that keeps the original coding.
 boolean isParameter()
          Returns the parameter type indicator to show whether the column is a parameter type.
 boolean isReadOnly()
          Retrieves an indicator for the read only column.
 boolean isUserDef()
          Returns the user define column indicator to show whether the column is a user define column.
 void readExternal(java.io.ObjectInput in)
           
 void setArray(boolean b)
          Sets the indicator that shows whether the column is Array type.
 void setColIndex(int index)
          Sets the integer index for this column.
 void setColName(java.lang.String name)
          Sets the name of the column.
 void setConstant(boolean b)
          Sets the constant indicator.
 void setConvertEncoding(int fromEncoding, int toEncoding)
          Sets the encoding for the column encoding change.
 void setCurrency(boolean bCurrency)
          Sets the currency type indicator.
 void setEncode(boolean b)
          Sets the indicator that shows whether the column is encoded.
 void setEncodingName(java.lang.String enc)
          Sets the encoding name for this column.
 void setFlag(int flag)
          Sets the column flag which is composed of all supported attributes for the column description object.
 void setGlobal(boolean b)
          Sets the global indicator.
 void setGroupable(boolean g)
          Sets the group indicator.
 void setGroupLevel(boolean b)
          Sets the indicator that shows whether the column is grouped.
 void setIgnoreCase(boolean b)
          Sets the indicator of ignoring case.
 void setNotAutoEncode(boolean b)
          Sets the indicator that keeps the original coding.
 void setParameter(boolean b)
          Sets the parameter type indicator.
 void setReadOnly(boolean readOnly)
          Sets an indicator for the read only column.
 void setRealColName(java.lang.String realName)
          Sets the real column name for this column which is identified by the data source.
 void setSqlType(int type)
           
 void setUserDef(boolean b)
          Sets the user define column indicator.
 java.lang.String toString()
          Retrieves a string to show the main parts of this DbColDesc object.
 boolean typeEquals(DbColDesc colDesc)
          Equality compared by the values of two DbColDesc objects.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENCY

public static final int CURRENCY

The constant referred to as an attribute type code identifies it's CURRENCY Type.

Note that it can be set with other attributes.

See Also:
Constant Field Values

CONSTANT

public static final int CONSTANT

The constant referred to as an attribute type code identifies it's CONSTANT Type.

Note that it can be set with other attributes.

See Also:
Constant Field Values

GROUPABLE

public static final int GROUPABLE

The constant referred to as an attribute type code identifies it's GROUPABLE Type, which means it can be used in SQL Group By clause.

Note that it can be set with other attributes.

See Also:
Constant Field Values

USER_DEFINED

public static final int USER_DEFINED

The constant referred to as an attribute type code identifies it's USER_DEFINED Type, which means a user defined column, like formula.

Note that it can be set with other attributes.

See Also:
Constant Field Values

PARAMETER

public static final int PARAMETER

The constant referred to as an attribute type code identifies it's PARAMETER Type.

Note that it can be set with other attributes.

See Also:
Constant Field Values

GLOBAL

public static final int GLOBAL

The constant referred to as an attribute type code identifies it's GLOBAL Type.

Note that it can be set with other attributes.

See Also:
Constant Field Values

IGNORECASE

public static final int IGNORECASE

The constant referred to as an attribute type code identifies it's IGNORECASE Type, which means cases of the column name will be ignored.

Note that it can be set with other attributes.

See Also:
Constant Field Values

NOTAUTOENCODE

public static final int NOTAUTOENCODE

The constant referred to as an attribute type code identifies it's NOTAUTOENCODE Type, which means the name for this column will not be encoded by default "8859_1".

Note that it can be set with other attributes.

See Also:
Constant Field Values

ENCODE

public static final int ENCODE

The constant referred to as an attribute type code identifies it's ENCODE Type, which means the name for this column is encoded.

Note that it can be set with other attributes.

See Also:
Constant Field Values

GROUPLEVEL

public static final int GROUPLEVEL

The constant referred to as an attribute type code identifies it's GROUPLEVEL Type, which means this column indicates the value in this DbValue is the level of the group(i.e. members of the group).

Note that it can be set with other attributes.

See Also:
Constant Field Values

ARRAY

public static final int ARRAY

The constant referred to as an attribute type code identifies it's ARRAY Type.

Note that it can be set with other attributes.

See Also:
Constant Field Values

colName

public java.lang.String colName
Deprecated. 
Column Name for JReport package private usage. Note use getColName and setColName to access it instead of accessing it directly.


sqlType

public int sqlType
Deprecated. 
SQL Type for JReport package private usage. Note use getSqlType and setSqlType to access it instead of accessing it directly.


precision

public int precision
Deprecated. 
The Number types' precision for JReport package private usage. Note use getPrecision and setPrecision to access it instead of accessing it directly.


scale

public int scale
Deprecated. 
The Number types' scale for JReport package private usage. Note use getScale and setScale to access it instead of accessing it directly.


nullable

public int nullable
Deprecated. 
Nullable indicator for JReport package private usage. Note use getNullable and setNullable to access it instead of accessing it directly.


bigDecimalLength

public int bigDecimalLength
The length of the BigDecimal type column for writing idx report.

See Also:
bigDecimalLength
Constructor Detail

DbColDesc

public DbColDesc()
Constructs an uninitialized DbColDesc. This DbColDesc object is mutable until nonzero is set.


DbColDesc

public DbColDesc(java.lang.String ColName,
                 int SqlType,
                 int Precision,
                 int Scale,
                 int Nullable,
                 boolean bCurrency)
Constructs an initialized DbColDesc.

Note that the scale's value should be greater than or equal to zero.

Parameters:
ColName - The Column Name in the source.
SqlType - A valid constant Name from Db.
Precision - Indicates the precision value.
Scale - Indicates the scale value.
Nullable - A valid constant Name from Db.
bCurrency - Indicates whether the column is for currency type.

     DbColDesc intDesc = new DbColDesc("",Db.SQL_INTEGER,15,0,Db.SQL_NULLABLE_UNKNOWN,true);
     
 

DbColDesc

public DbColDesc(java.lang.String ColName,
                 int SqlType,
                 int Precision,
                 int Scale,
                 int Nullable)
Constructs an initialized DbColDesc.

Note that the scale's value should be greater than or equal to zero.

Parameters:
ColName - The Column Name in the source.
SqlType - A valid constant Name from Db.
Precision - Indicates the precision value.
Scale - Indicates the scale value.
Nullable - A valid constant Name from Db.

     DbColDesc intDesc = new DbColDesc("",Db.SQL_INTEGER,15,0,Db.SQL_NULLABLE_UNKNOWN);
     
 

DbColDesc

public DbColDesc(DbColDesc desc)
Constructs an initialized DbColDesc.

Note that the scale's value should be greater than or equal to zero.

Parameters:
desc - The column description object for duplication.
Method Detail

setConvertEncoding

public void setConvertEncoding(int fromEncoding,
                               int toEncoding)
Sets the encoding for the column encoding change. A few of the encoding related Chinese conversions are supported.

Parameters:
fromEncoding - The original encoding.
toEncoding - The target encoding.
See Also:
Converter

getFlag

public int getFlag()
Returns the column flag which is composed of all supported attributes for the column description object. The usage for this flag is like the following code:
 (flag & GROUPABLE) != 0;
 


setFlag

public void setFlag(int flag)
Sets the column flag which is composed of all supported attributes for the column description object.


setGroupable

public final void setGroupable(boolean g)
Sets the group indicator.

Parameters:
g - Indicates whether the column can be used for group clause.

isGroupable

public final boolean isGroupable()
Returns the group indicator to show whether the column can be used for group clause.

Returns:
true if it can be used for group clause.

setConstant

public void setConstant(boolean b)
Sets the constant indicator.

Parameters:
b - Indicates whether the column is a constant.

isConstant

public boolean isConstant()
Returns the constant indicator to show whether the column is a constant.

Returns:
true if it is a constant.

setCurrency

public void setCurrency(boolean bCurrency)
Sets the currency type indicator.

Parameters:
bCurrency - Indicates whether the column is a currency type.

isCurrency

public boolean isCurrency()
Returns the currency type indicator to show whether the column is a currency type.

Returns:
true is a currency type.

setUserDef

public void setUserDef(boolean b)
Sets the user define column indicator.

Parameters:
b - Indicates whether the column is a user define column.

isUserDef

public boolean isUserDef()
Returns the user define column indicator to show whether the column is a user define column.

Returns:
true if it is a user define column.

setGlobal

public void setGlobal(boolean b)
Sets the global indicator.

Parameters:
b - Indicates whether the column is for global.

isGlobal

public boolean isGlobal()
Returns the global indicator to show whether the column is for global.

Returns:
true if it is for global.

setParameter

public void setParameter(boolean b)
Sets the parameter type indicator.

Parameters:
b - Indicates whether the column is a parameter type.

isParameter

public boolean isParameter()
Returns the parameter type indicator to show whether the column is a parameter type.

Returns:
true if it is a parameter type.

setIgnoreCase

public void setIgnoreCase(boolean b)
Sets the indicator of ignoring case.

Parameters:
b - Indicates whether to ignore case in the column.

isIgnoreCase

public boolean isIgnoreCase()
Returns the indicator of ignoring case.

Returns:
true if the case in the column is to be ignored.

setNotAutoEncode

public void setNotAutoEncode(boolean b)
Sets the indicator that keeps the original coding.

Parameters:
b - Indicates whether the column keeps the original coding.

isNotAutoEncode

public boolean isNotAutoEncode()
Retrieves the indicator that keeps the original coding.

Returns:
true if the column keeps the original coding.

setEncode

public void setEncode(boolean b)
Sets the indicator that shows whether the column is encoded.

Parameters:
b - Indicates whether the column is encoded.

isEncode

public boolean isEncode()
Retrieves the indicator that shows whether the column is encoded.

Returns:
true if the column is encoded.

setGroupLevel

public void setGroupLevel(boolean b)
Sets the indicator that shows whether the column is grouped.

Parameters:
b - Indicates whether the column is grouped.

isGroupLevel

public boolean isGroupLevel()
Retrieves the indicator that shows whether the column is grouped.

Returns:
true if the column is grouped.

setArray

public void setArray(boolean b)
Sets the indicator that shows whether the column is Array type.

Parameters:
b - Indicates whether the column is Array type.

isArray

public boolean isArray()
Retrieves the indicator that shows whether the column is Array type.

Returns:
true if the column is Array type.

setEncodingName

public void setEncodingName(java.lang.String enc)
Sets the encoding name for this column.

Parameters:
enc - The name of the encoding.

getEncodingName

public java.lang.String getEncodingName()
Retrieves the encoding name for this column.

Returns:
encoding name.

setColIndex

public void setColIndex(int index)
Sets the integer index for this column.

Parameters:
index - for this column, which should not be negative.

getColIndex

public int getColIndex()
Retrieves the integer index for this column.

Specified by:
getColIndex in interface jet.util.ColumnIndexable
Returns:
integer index.

getColName

public java.lang.String getColName()
Returns the name of a column.

Returns:
name of a column in a result set. If the name cannot be determined, returns an empty string ("").

setColName

public void setColName(java.lang.String name)
Sets the name of the column.


setRealColName

public void setRealColName(java.lang.String realName)
Sets the real column name for this column which is identified by the data source.

Parameters:
The - real name for this column.

getRealColName

public java.lang.String getRealColName()
Retrieves the real name for this column.

Returns:
real column name.

getSqlType

public int getSqlType()
Returns the SqlType.

Returns:
SqlType of a column in a result set. SqlType 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

If SqlType cannot be determined, returns 0.


setSqlType

public void setSqlType(int type)

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

getNullable

public int getNullable()
Returns information of whether a column result set can have null values.

Returns:
one of the following values:
  • Db.SQL_NO_NULLS: the column cannot contain null values.
  • DB.SQL_NULLABLE: the column can contain null values.
  • Db.SQL_NULLABLE_UNKNOWN: cannot determine whether the column can contain null values.

clone

public java.lang.Object clone()
Deep clones this object.

Overrides:
clone in class java.lang.Object

typeEquals

public boolean typeEquals(DbColDesc colDesc)
Equality compared by the values of two DbColDesc objects. This method does not need the column names to be the same, and it just compares the sql types, precisions, scales and whether they are nullable.

Parameters:
colDesc - Compared one.
Returns:
true if both equals each other.

toString

public java.lang.String toString()
Retrieves a string to show the main parts of this DbColDesc object.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object colDesc)
Compares the column names to see if they are equal.

Overrides:
equals in class java.lang.Object

isReadOnly

public boolean isReadOnly()
Retrieves an indicator for the read only column.

Returns:
true if the column is read Only.

setReadOnly

public void setReadOnly(boolean readOnly)
Sets an indicator for the read only column.

Parameters:
readOnly - True indicates the column is read Only.

getToEncoding

public int getToEncoding()
Retrieves the integer value for original encoding.

Returns:
ToEncoding when converting string encoding.
See Also:
Converter

getFromEncoding

public int getFromEncoding()
Retrieves the integer value for converted encoding.

Returns:
fromEncoding when converting string encoding.
See Also:
Converter

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException