All Packages Class Hierarchy This Package Previous Next Index
Class de.tudarmstadt.ito.xmldbms.Column
java.lang.Object
|
+----de.tudarmstadt.ito.xmldbms.Column
- public class Column
- extends Object
Describes a column; not for
general use.
Column contains information about a column in a table. The table
is not named; instead, Columns are included in Tables and ColumnMaps.
Note that column values are stored in three 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.
- INSERT statement: These are JDBC PreparedStatement objects
created by DOMToDBMS when transferring data from XML to the database.
The position of a column value can be different in each of these
three objects. For example, it could be in column 5 in the result set,
array index 3 in the Row object, and parameter 4 in the INSERT
statement. Thus, three sets of column numbers are needed:
- Result set column number: This is the number of the column in
the result set in which the value is stored. The number is 1-based and is
stored in the Table.rsColumnNumbers array. (Note that the order in which
result set column numbers are stored in this array guarantees that columns
in the result set will be accessed in increasing order.)
- Row object column number: This is the index of the position in
the Row.columnValues array in which the value is stored. The index is
0-based and is stored in the rowObjectIndex variable of Column. It is
also the index of the Table.rsColumnNumbers array; that is, column values
are stored in the Row object in the same order they occur in the result
set. In XML-DBMS version 1.0, this was named Column.number.
- INSERT statement parameter number: This is the number of the
parameter in the INSERT statement in which the column value is stored. The
number is 1-based and corresponds to the order in which the Column object is
stored in the Table.columns array; it is therefore not stored separately.
In virtually all cases, these three column numbers are the same, except for
differences due to being 0- or 1-based. This is because XML-DBMS generates
SELECT and INSERT statements itself and therefore places the columns in the
same order in each. The only time that they differ is when the calling
application passes a result set to DBMSToDOM.retrieveDocument. In this case,
the number and order of columns in the result set can differ from the
order of the columns as they appear in the Table.columns array. Because of
this, the three different numbers are needed.
In the future, the Column class should contain information about the
nullability and data type of the column as well. This will be used when creating
CREATE TABLE statements.
- Version:
- 1.01
- Author:
- Ronald Bourret, Technical University of Darmstadt
-
length
- Length of the column.
-
name
- Name of the column.
-
rowObjectIndex
- Index of the column value in the Rows.columnValues
array.
-
type
- Data type of the column.
-
Column()
-
-
Column(String, int, int, int)
-
name
public String name
- Name of the column.
rowObjectIndex
public int rowObjectIndex
- Index of the column value in the Rows.columnValues
array. 0-based.
type
public int type
- Data type of the column. This must be one of the values in
java.sql.Types.
length
public int length
- Length of the column. Used only for character and binary data.
Column
public Column()
Column
public Column(String name,
int rowObjectIndex,
int type,
int length)
All Packages Class Hierarchy This Package Previous Next Index