All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.maps.Column

java.lang.Object
   |
   +----org.xmlmiddleware.xmldbms.maps.MapBase
           |
           +----org.xmlmiddleware.xmldbms.maps.Column

public class Column
extends MapBase
Describes a column; not for general use.

Column contains information about a column. The column metadata (type, length, nullability, etc.) can be set from a database or from a map document. Columns are stored in Tables, PropertyMaps, PropertyTableMaps, OrderInfos, and Keys.

Note that column values are stored in two separate objects in XML-DBMS:

Row objects are hashtable-based and return column values by Column object. These are designed for random access.

Result sets are index-based and must be accessed in ascending order for interoperability reasons. To make this possible, each Column is given a result set index and the Table that owns the Column can return the Columns as an array sorted by result set index. This array must be used when (a) building SELECT statements to retrieve the columns in the table, and (b) when retrieving column values from those result sets.

Version:
2.0
Author:
Ronald Bourret, 1998-1999, 2001

Method Index

 o create(String)
Create a new column.
 o getFormatter()
Get the column formatting object.
 o getLength()
Get the column length.
 o getName()
Get the column name.
 o getNullability()
Whether the column is nullable.
 o getPrecision()
Get the column precision.
 o getResultSetIndex()
Get the result set index.
 o getScale()
Get the column scale.
 o getType()
Get the column type.
 o isMetadataSet()
Checks whether metadata has been set for the column.
 o lengthExists()
Whether a length value exists.
 o precisionExists()
Whether a precision value exists.
 o resetMetadata()
Sets the metadata (type, length, etc.) to its initial state.
 o scaleExists()
Whether a scale value exists.
 o setFormatter(StringFormatter)
Set the column formatting object.
 o setLength(int)
Set the column length.
 o setNullability(int)
Set whether the column is nullable.
 o setPrecision(int)
Set the column precision.
 o setResultSetIndex(int)
Set the result set index.
 o setScale(int)
Set the column scale.
 o setType(int)
Set the column type.

Methods

 o create
 public static Column create(String columnName)
Create a new column.

Parameters:
columnName - Name of the column.
Returns:
The column.
 o getName
 public final String getName()
Get the column name.

Returns:
The column name.
 o getResultSetIndex
 public final int getResultSetIndex()
Get the result set index.

This is the index of the column value in the ResultSet. 1-based.

Returns:
The result set index.
 o setResultSetIndex
 public void setResultSetIndex(int index)
Set the result set index.

This is the index of the column value in a JDBC ResultSet. 1-based.

Parameters:
index - The result set index.
 o getType
 public final int getType()
Get the column type.

This is one of the types in the JDBC Types class.

Returns:
The column type.
 o setType
 public void setType(int type)
Set the column type.

This is one of the types in the JDBC Types class. If the type is not binary or character, this method sets the length to -1.

Parameters:
type - The column type.
 o lengthExists
 public final boolean lengthExists()
Whether a length value exists.

Returns:
Whether a length value exists
 o getLength
 public final int getLength()
Get the column length.

Returns:
The column length. This is -1 if the length is not set.
 o setLength
 public void setLength(int length)
Set the column length.

Returns:
The column length.
 o precisionExists
 public final boolean precisionExists()
Whether a precision value exists.

Returns:
Whether a precision value exists
 o getPrecision
 public final int getPrecision()
Get the column precision.

Returns:
The column precision.
 o setPrecision
 public void setPrecision(int precision)
Set the column precision.

Returns:
The column precision.
 o scaleExists
 public final boolean scaleExists()
Whether a scale value exists.

Returns:
Whether a scale value exists
 o getScale
 public final int getScale()
Get the column scale.

Returns:
The column scale.
 o setScale
 public void setScale(int scale)
Set the column scale.

Returns:
The column scale.
 o getNullability
 public final int getNullability()
Whether the column is nullable.

Returns:
DatabaseMetaData.columnNullableUnknown, .columnNullable, or .columnNoNulls.
 o setNullability
 public void setNullability(int nullability)
Set whether the column is nullable.

Parameters:
nullability - DatabaseMetaData.columnNullableUnknown, .columnNullable, or .columnNoNulls.
 o getFormatter
 public final StringFormatter getFormatter()
Get the column formatting object.

This method returns an object that implements the org.xmlmiddleware.conversions.formatters.StringFormatter interface.

Returns:
The formatting object. For a correctly initialized Column object, this will never be null.
 o setFormatter
 public void setFormatter(StringFormatter formatter)
Set the column formatting object.

The formatting object must implement the org.xmlmiddleware.conversions.formatters.StringFormatter interface.

WARNING! Map factories must set a formatter for each column.

Parameters:
formatter - The formatting object. May not be null.
 o resetMetadata
 public void resetMetadata()
Sets the metadata (type, length, etc.) to its initial state. Does not change the name.

 o isMetadataSet
 public boolean isMetadataSet()
Checks whether metadata has been set for the column.

Returns:
Whether metadata has been set for the column.

All Packages  Class Hierarchy  This Package  Previous  Next  Index