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:
- Result sets: These are JDBC ResultSet objects either passed
to DBMSToDOM or generated by DBMSToDOM when transferring data from the
database to XML.
- Row object: This is an intermediate object used by both
DBMSToDOM and DOMToDBMS to buffer column values.
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
-
create(String)
- Create a new column.
-
getFormatter()
- Get the column formatting object.
-
getLength()
- Get the column length.
-
getName()
- Get the column name.
-
getNullability()
- Whether the column is nullable.
-
getPrecision()
- Get the column precision.
-
getResultSetIndex()
- Get the result set index.
-
getScale()
- Get the column scale.
-
getType()
- Get the column type.
-
isMetadataSet()
- Checks whether metadata has been set for the column.
-
lengthExists()
- Whether a length value exists.
-
precisionExists()
- Whether a precision value exists.
-
resetMetadata()
- Sets the metadata (type, length, etc.) to its initial state.
-
scaleExists()
- Whether a scale value exists.
-
setFormatter(StringFormatter)
- Set the column formatting object.
-
setLength(int)
- Set the column length.
-
setNullability(int)
- Set whether the column is nullable.
-
setPrecision(int)
- Set the column precision.
-
setResultSetIndex(int)
- Set the result set index.
-
setScale(int)
- Set the column scale.
-
setType(int)
- Set the column type.
create
public static Column create(String columnName)
- Create a new column.
- Parameters:
- columnName - Name of the column.
- Returns:
- The column.
getName
public final String getName()
- Get the column name.
- Returns:
- The column name.
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.
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.
getType
public final int getType()
- Get the column type.
This is one of the types in the JDBC Types class.
- Returns:
- The column type.
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.
lengthExists
public final boolean lengthExists()
- Whether a length value exists.
- Returns:
- Whether a length value exists
getLength
public final int getLength()
- Get the column length.
- Returns:
- The column length. This is -1 if the length is not set.
setLength
public void setLength(int length)
- Set the column length.
- Returns:
- The column length.
precisionExists
public final boolean precisionExists()
- Whether a precision value exists.
- Returns:
- Whether a precision value exists
getPrecision
public final int getPrecision()
- Get the column precision.
- Returns:
- The column precision.
setPrecision
public void setPrecision(int precision)
- Set the column precision.
- Returns:
- The column precision.
scaleExists
public final boolean scaleExists()
- Whether a scale value exists.
- Returns:
- Whether a scale value exists
getScale
public final int getScale()
- Get the column scale.
- Returns:
- The column scale.
setScale
public void setScale(int scale)
- Set the column scale.
- Returns:
- The column scale.
getNullability
public final int getNullability()
- Whether the column is nullable.
- Returns:
- DatabaseMetaData.columnNullableUnknown, .columnNullable, or .columnNoNulls.
setNullability
public void setNullability(int nullability)
- Set whether the column is nullable.
- Parameters:
- nullability - DatabaseMetaData.columnNullableUnknown, .columnNullable,
or .columnNoNulls.
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.
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.
resetMetadata
public void resetMetadata()
- Sets the metadata (type, length, etc.) to its initial state. Does not change the name.
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