org.jpox.store.rdbms.columninfo
Class ColumnInfo

java.lang.Object
  extended byorg.jpox.store.rdbms.columninfo.ColumnInfo
Direct Known Subclasses:
DB2ColumnInfo, MSSQLServerColumnInfo, OracleColumnInfo, PostgreSQLColumnInfo, SybaseColumnInfo

public class ColumnInfo
extends java.lang.Object

Represents the metadata of a specific table column. This class is basically a data structure that makes accessing the JDBC column metadata easier. Each of the items returned by DatabaseMetaData.getColumns(String,String,String,String) is represented by a public field in this class. Subclasses of ColumnInfo can be created on a per-DBMS basis to supply missing metadata or correct faulty metadata obtained from that DBMS's JDBC driver(s).

Version:
$Revision: 1.4 $
See Also:
RDBMSAdapter.newColumnInfo(java.sql.ResultSet)

Field Summary
protected  int charOctetLength
          Indicates the maximum number of bytes in the column (for char types only).
protected  java.lang.String columnDef
          The default value for the column; may be null.
protected  java.lang.String columnName
          The column name.
protected  int columnSize
          Indicates the column size.
protected  short dataType
          Indicates the JDBC (SQL) data type from Types.
protected  int decimalDigits
          Indicates the number of fractional digits.
protected  java.lang.String isNullable
          Either "NO" indicating that the column definitely does not allow null values, "YES" indicating that the column might allow null values, or an empty string ("") indicating that nullability is unknown.
protected  int nullable
          Indicates whether the column can be NULL.
protected  int numPrecRadix
          Indicates the radix, which is typically either 10 or 2.
protected  int ordinalPosition
          Indicates the index of the column in its table; the first column is 1, the second column is 2, and so on.
protected  java.lang.String remarks
          An explanatory comment on the column; may be null.
protected  java.lang.String tableCat
          The table catalog, which may be null.
protected  java.lang.String tableName
          The table name.
protected  java.lang.String tableSchem
          The table schema, which may be null.
protected  java.lang.String typeName
          The local type name used by the data source.
 
Constructor Summary
ColumnInfo(java.sql.ResultSet rs)
          Constructs a column information object from the current row of the given result set.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some object is "equal to" this one.
 int getCharOctetLength()
          Accessor for the maximum no of bytes in a column
 java.lang.String getColumnDef()
          Accessor for default value for column.
 java.lang.String getColumnName()
          Accessor for column name
 int getColumnSize()
          Accessor for the column size.
 short getDataType()
          Accessor for the JDBC data type.
 int getDecimalDigits()
          Accessor for no of fractional digits
 java.lang.String getIsNullable()
          Accessor for nullable attribute.
 int getNullable()
          Accessor for whether the column can be null
 int getNumPrecRadix()
          Accessor for the radix
 int getOrdinalPosition()
          Accessor for the ordinal position.
 java.lang.String getRemarks()
          Accessor for column remarks
 java.lang.String getTableCat()
          Accessor for table catalog
 java.lang.String getTableName()
          Accessor for table name
 java.lang.String getTableSchem()
          Accessor for table schema
 java.lang.String getTypeName()
          Accessor for type name
 int hashCode()
          Returns a hash code value for this object.
 java.lang.String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tableCat

protected java.lang.String tableCat
The table catalog, which may be null.


tableSchem

protected java.lang.String tableSchem
The table schema, which may be null.


tableName

protected java.lang.String tableName
The table name.


columnName

protected java.lang.String columnName
The column name.


dataType

protected short dataType
Indicates the JDBC (SQL) data type from Types.


typeName

protected java.lang.String typeName
The local type name used by the data source.


columnSize

protected int columnSize
Indicates the column size. For char or date types, this is the maximum number of characters; for numeric/ decimal types, this is the precision.


decimalDigits

protected int decimalDigits
Indicates the number of fractional digits.


numPrecRadix

protected int numPrecRadix
Indicates the radix, which is typically either 10 or 2.


nullable

protected int nullable
Indicates whether the column can be NULL.


remarks

protected java.lang.String remarks
An explanatory comment on the column; may be null.


columnDef

protected java.lang.String columnDef
The default value for the column; may be null.


charOctetLength

protected int charOctetLength
Indicates the maximum number of bytes in the column (for char types only).


ordinalPosition

protected int ordinalPosition
Indicates the index of the column in its table; the first column is 1, the second column is 2, and so on.


isNullable

protected java.lang.String isNullable
Either "NO" indicating that the column definitely does not allow null values, "YES" indicating that the column might allow null values, or an empty string ("") indicating that nullability is unknown.

Constructor Detail

ColumnInfo

public ColumnInfo(java.sql.ResultSet rs)
           throws javax.jdo.JDOFatalDataStoreException
Constructs a column information object from the current row of the given result set. The ResultSet object passed must have been obtained from a call to java.sql.DatabaseMetaData.getColumns().

This method only retrieves the values from the current row; the caller is required to advance to the next row with ResultSet.next().

Parameters:
rs - The result set returned from java.sql.DatabaseMetaData.getColumns().
Throws:
javax.jdo.JDOFatalDataStoreException - if a column of column information could not be retrieved from the result set.
Method Detail

getDecimalDigits

public int getDecimalDigits()
Accessor for no of fractional digits

Returns:
The no of fractional digits

getIsNullable

public java.lang.String getIsNullable()
Accessor for nullable attribute.

Returns:
The nullability value

getNullable

public int getNullable()
Accessor for whether the column can be null

Returns:
Whether the column can be null

getColumnSize

public int getColumnSize()
Accessor for the column size.

Returns:
The column size.

getDataType

public short getDataType()
Accessor for the JDBC data type.

Returns:
The JDBC data type

getNumPrecRadix

public int getNumPrecRadix()
Accessor for the radix

Returns:
The radix

getCharOctetLength

public int getCharOctetLength()
Accessor for the maximum no of bytes in a column

Returns:
The maximum number of bytes in a column

getOrdinalPosition

public int getOrdinalPosition()
Accessor for the ordinal position.

Returns:
The ordinal position (index of column in table).

getColumnDef

public java.lang.String getColumnDef()
Accessor for default value for column.

Returns:
The default value for column

getRemarks

public java.lang.String getRemarks()
Accessor for column remarks

Returns:
The remarks on the column

getTypeName

public java.lang.String getTypeName()
Accessor for type name

Returns:
The type name for the column

getTableName

public java.lang.String getTableName()
Accessor for table name

Returns:
The table name for the column

getColumnName

public java.lang.String getColumnName()
Accessor for column name

Returns:
The column name

getTableCat

public java.lang.String getTableCat()
Accessor for table catalog

Returns:
The table catalog

getTableSchem

public java.lang.String getTableSchem()
Accessor for table schema

Returns:
The table schema

equals

public final boolean equals(java.lang.Object obj)
Indicates whether some object is "equal to" this one. Two ColumnInfo objects are considered equal if their catalog, schema, table, and column names are all equal.

Parameters:
obj - the reference object with which to compare
Returns:
true if this object is equal to the obj argument; false otherwise.

hashCode

public final int hashCode()
Returns a hash code value for this object.

Returns:
a hash code value for this object.

toString

public java.lang.String toString()
Returns the string representation of this object.

Returns:
string representation of this object.


Copyright © -2007 . All Rights Reserved.