All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.xmldbms.maps.Table
java.lang.Object
|
+----org.xmlmiddleware.xmldbms.maps.MapBase
|
+----org.xmlmiddleware.xmldbms.maps.Table
- public class Table
- extends MapBase
Describes a table; not for general
use.
Table contains information about a table. Tables are stored in Maps,
ClassMaps, PropertyMaps, ClassTableMaps, and PropertyTableMaps.
In XML-DBMS, tables have four-part names: database, catalog, schema,
and table name. The database name is the name of the XML-DBMS database
to use; it describes the connection information to use and has nothing
to do with clusters, which are the fourth (top) level of names in SQL '92.
Catalog, schema, and table names are as in SQL '92.
XML-DBMS also has "universal table names", which have the following
form:
"database-name"."catalog-name"."schema-name"."table-name"
These are used in error messages. XML-DBMS applications do not need to use
them. Note that it is probably possible to construct two different tables with
the same universal name, but since these names are only used in error messages,
it shouldn't matter much.
- Version:
- 2.0
- Author:
- Ronald Bourret, 1998-1999, 2001
-
addColumn(Column)
- Add a Column.
-
addForeignKey(Key)
- Add a foreign key to the table.
-
addPrimaryKey(Key)
- Add a primary key to the table.
-
addUniqueKey(Key)
- Add a unique key (except the primary key) to the table.
-
checkMetadata()
- Checks whether metadata has been set for the columns in the table.
-
create(String, String, String, String)
- Create a new Table.
-
createColumn(String)
- Create a Column and add it to the Table.
-
createForeignKey(String)
- Create a foreign key and add it to the table.
-
createPrimaryKey(String)
- Create a primary key and add it to the table.
-
createUniqueKey(String)
- Create a unique key (except the primary key) and add it to the table.
-
getCatalogName()
- Get the catalog name.
-
getColumn(String)
- Get a Column.
-
getColumns()
- Get all Columns.
-
getDatabaseName()
- Get the database name.
-
getForeignKey(String)
- Get a foreign key.
-
getForeignKeys()
- Get all foreign keys.
-
getHashName()
- Get a "universal" name that is safe for hashing.
-
getHashName(String, String, String, String)
- Get a "universal" name that is safe for hashing.
-
getNumberOfColumns()
- Get number of Columns.
-
getPrimaryKey()
- Get the primary key.
-
getResultSetColumns()
- Get all Columns in ascending order according to their result set index.
-
getSchemaName()
- Get the schema name.
-
getTableName()
- Get the table name.
-
getUniqueKey(String)
- Get a unique key (except the primary key).
-
getUniqueKeys()
- Get all unique keys (except the primary key).
-
getUniversalName()
- Get the universal name of the table.
-
getUniversalName(String, String, String, String)
- Construct a universal table name from the specified names.
-
removeAllColumns()
- Remove all columns.
-
removeAllForeignKeys()
- Remove all foreign keys.
-
removeAllUniqueKeys()
- Remove all unique keys (except the primary key).
-
removeColumn(String)
- Remove a Column.
-
removeForeignKey(String)
- Remove a foreign key.
-
removePrimaryKey()
- Remove the primary key.
-
removeUniqueKey(String)
- Remove a unique key (except the primary key).
create
public static Table create(String databaseName,
String catalogName,
String schemaName,
String tableName)
- Create a new Table.
- Parameters:
- databaseName - Name of the database. If this is null, uses "Default".
- catalogName - Name of the catalog. May be null.
- schemaName - Name of the schema. May be null.
- tableName - Name of the table.
- Returns:
- The Table.
getDatabaseName
public final String getDatabaseName()
- Get the database name.
- Returns:
- The database name.
getCatalogName
public final String getCatalogName()
- Get the catalog name.
- Returns:
- The catalog name.
getSchemaName
public final String getSchemaName()
- Get the schema name.
- Returns:
- The schema name.
getTableName
public final String getTableName()
- Get the table name.
- Returns:
- The table name.
getUniversalName
public final String getUniversalName()
- Get the universal name of the table.
This name should be used only in error messages. For a "universal" name
that can safely be hashed on, use getHashName().
- Returns:
- The universal name.
getUniversalName
public static String getUniversalName(String databaseName,
String catalogName,
String schemaName,
String tableName)
- Construct a universal table name from the specified names.
This name should be used only in error messages. For a "universal" name
that can safely be hashed on, use getHashName(String, String, String, String).
- Parameters:
- databaseName - Name of the database. If this is null, uses "Default".
- catalogName - Name of the catalog. May be null.
- schemaName - Name of the schema. May be null.
- tableName - Name of the table.
- Returns:
- The universal name.
getHashName
public final String getHashName()
- Get a "universal" name that is safe for hashing.
- Returns:
- The hash name.
getHashName
public static String getHashName(String databaseName,
String catalogName,
String schemaName,
String tableName)
- Get a "universal" name that is safe for hashing.
- Parameters:
- databaseName - Name of the database. If this is null, uses "Default".
- catalogName - Name of the catalog. May be null.
- schemaName - Name of the schema. May be null.
- tableName - Name of the table.
- Returns:
- The hash name.
getNumberOfColumns
public final int getNumberOfColumns()
- Get number of Columns.
- Returns:
- The number of Columns.
getColumn
public final Column getColumn(String columnName)
- Get a Column.
- Parameters:
- columnName - Name of the column.
- Returns:
- The Column. Null if the column does not exist.
getColumns
public final Enumeration getColumns()
- Get all Columns.
- Returns:
- An Enumeration of all Columns. May be empty.
getResultSetColumns
public final Column[] getResultSetColumns()
- Get all Columns in ascending order according to their result set index.
For more information, see the Column class.
- Returns:
- The columns
createColumn
public Column createColumn(String columnName)
- Create a Column and add it to the Table.
If the Column already exists, returns the existing Column.
- Parameters:
- columnName - Name of the column.
- Returns:
- The Column.
addColumn
public void addColumn(Column column) throws XMLMiddlewareException
- Add a Column.
- Parameters:
- column - The Column.
- Throws: XMLMiddlewareException
- Thrown if the Column already exists.
removeColumn
public void removeColumn(String columnName) throws XMLMiddlewareException
- Remove a Column.
This method should be used carefully, as numerous other map objects
point to Columns. Those objects should be deleted before this method is called.
- Parameters:
- columnName - Name of the column.
- Throws: XMLMiddlewareException
- Thrown if the column does not exist.
removeAllColumns
public void removeAllColumns()
- Remove all columns.
This method should be used carefully, as numerous other map objects
point to Columns. Those objects should be deleted before this method is called.
getPrimaryKey
public final Key getPrimaryKey()
- Get the primary key.
- Returns:
- The primary key. Null if the primary key does not exist.
createPrimaryKey
public Key createPrimaryKey(String keyName)
- Create a primary key and add it to the table.
If the primary key already exists, returns the existing primary key.
- Parameters:
- keyName - Name of the key. Used in map documents and CREATE TABLE
statements. If this is null, "PrimaryKey" is used.
- Returns:
- The primary key.
addPrimaryKey
public void addPrimaryKey(Key key) throws XMLMiddlewareException
- Add a primary key to the table.
- Parameters:
- key - The primary key.
- Throws: XMLMiddlewareException
- Thrown if the primary key already exists.
removePrimaryKey
public void removePrimaryKey() throws XMLMiddlewareException
- Remove the primary key.
- Throws: XMLMiddlewareException
- Thrown if a primary key does not exist.
getUniqueKey
public final Key getUniqueKey(String keyName)
- Get a unique key (except the primary key).
- Parameters:
- keyName - Name of the key.
- Returns:
- The unique key. Null if the key is not found.
getUniqueKeys
public final Enumeration getUniqueKeys()
- Get all unique keys (except the primary key).
- Returns:
- An Enumeration of all unique keys. May be empty.
createUniqueKey
public Key createUniqueKey(String keyName)
- Create a unique key (except the primary key) and add it to the table.
If the key already exists, returns the existing key.
- Parameters:
- keyName - Name of the key.
- Returns:
- The unique key.
addUniqueKey
public void addUniqueKey(Key key) throws XMLMiddlewareException
- Add a unique key (except the primary key) to the table.
- Parameters:
- key - The unique key.
- Throws: XMLMiddlewareException
- Thrown if the unique key already exists.
removeUniqueKey
public void removeUniqueKey(String keyName) throws XMLMiddlewareException
- Remove a unique key (except the primary key).
- Parameters:
- keyName - Name of the key.
- Throws: XMLMiddlewareException
- Thrown if the unique key does not exist.
removeAllUniqueKeys
public void removeAllUniqueKeys()
- Remove all unique keys (except the primary key).
getForeignKey
public final Key getForeignKey(String keyName)
- Get a foreign key.
- Parameters:
- keyName - Name of the key.
- Returns:
- The foreign key. Null if the key is not found.
getForeignKeys
public final Enumeration getForeignKeys()
- Get all foreign keys.
- Returns:
- An Enumeration of all foreign keys. May be empty.
createForeignKey
public Key createForeignKey(String keyName)
- Create a foreign key and add it to the table.
If the key already exists, returns the existing key.
- Parameters:
- keyName - Name of the key.
- Returns:
- The foreign key.
addForeignKey
public void addForeignKey(Key key) throws XMLMiddlewareException
- Add a foreign key to the table.
- Parameters:
- key - The foreign key.
- Throws: XMLMiddlewareException
- Thrown if the foreign key already exists.
removeForeignKey
public void removeForeignKey(String keyName) throws XMLMiddlewareException
- Remove a foreign key.
- Parameters:
- keyName - Name of the key.
- Throws: XMLMiddlewareException
- Thrown if the foreign key does not exist.
removeAllForeignKeys
public void removeAllForeignKeys()
- Remove all foreign keys.
checkMetadata
public Column checkMetadata()
- Checks whether metadata has been set for the columns in the table.
- Returns:
- The first Column for which metadata has not been set or
null if metadata has been set for all columns.
All Packages Class Hierarchy This Package Previous Next Index