com.im.commons.db 5.9.2

com.im.commons.db.ddl
Interface DBTableInfo

All Superinterfaces:
Serializable
All Known Implementing Classes:
DBTableInfoImpl, DBTableInfoProxy

public interface DBTableInfo
extends Serializable

Database info class for a database table. The term table is used in a generic sense meaning any database artifact that can behave in a tabular fashion, and includes views (and in future synonyms, materialised views etc.). All of these will have some things like a name, columns but the different sub-types will differ in some respects e.g. views have SQL that define the view whereas plain tables so not. The properties of this class are a superset of all the properties and not all will be used for any particular sub-type. Note: this class may be refactored in future be better distinguish the different sub-types.


Nested Class Summary
static class DBTableInfo.Type
          Enum of supported physical database artifacts that can be used.
 
Method Summary
 DBTableInfo copy()
           
 DBConstraintInfo findUniqueConstraintNameForColumns(String[] columns)
          Retrieves constraint name for the named columns.
 DBColInfo getColumn(String name)
           
 String[] getColumnNamesAsArray()
          Convenience method to get the column names as an array.
 List<String> getColumnNamesAsList()
          Convenience method to get the column names as a list.
 List<DBColInfo> getColumns()
          Getter for property columns.
 long getCreationTime()
           
 List<DBForeignKeyInfo> getExportedFKInfo()
          Get the foreign keys that involve this table but are defined in a foreign key constraint definition that is defined in another table (though possibly this table).
 List<DBForeignKeyInfo> getImportedFKInfo()
          Get the foreign keys that this table defines.
 List<DBIndexInfo> getIndexInfo()
           
 String getName()
           
 List<String> getPrimaryKeyColumns()
          Get the value of primary key columns for the table.
 String getSchema()
           
 String getSQL()
          Getter for SQL that defines this view if it is a view, otherwise null.
 List<DBTriggerInfo> getTriggerInfo()
           
 DBTableInfo.Type getType()
           
 List<DBConstraintInfo> getUniqueConstraints()
           
 boolean isReadOnly()
           
 String schemaPlusTable()
           
 DBTableInfo updateColumns(List<DBColInfo> cols)
           
 DBTableInfo updateExportedForeignKeys(List<DBForeignKeyInfo> fkKeys)
           
 DBTableInfo updateImportedForeignKeys(List<DBForeignKeyInfo> pkKeys)
           
 DBTableInfo updateIndexInfos(List<DBIndexInfo> indexes)
           
 DBTableInfo updateUniqueConstraintInfos(List<DBConstraintInfo> constraints)
           
 

Method Detail

getType

DBTableInfo.Type getType()

getName

String getName()

getSchema

String getSchema()
Returns:
The schema this item belongs to.

schemaPlusTable

String schemaPlusTable()

isReadOnly

boolean isReadOnly()

getSQL

String getSQL()
Getter for SQL that defines this view if it is a view, otherwise null.

Returns:
Value of property sql.

copy

DBTableInfo copy()

findUniqueConstraintNameForColumns

DBConstraintInfo findUniqueConstraintNameForColumns(String[] columns)
Retrieves constraint name for the named columns. The method will return name of the unique constraint for the given set of columns. The constraint name may be DatabasePlatform.NAME_PRIMARY_KEY_CONSTRAINT, which may be handled differently in some databases - for drop, use DatabasePlatform.sqlDropPrimaryConstraint(String, String, String[]).

Parameters:
columns - DB columns
Returns:
The constraint, or null if there's no unique constraint.

getColumn

DBColInfo getColumn(String name)

getColumnNamesAsArray

String[] getColumnNamesAsArray()
Convenience method to get the column names as an array.

Returns:
The names of the columns.

getColumnNamesAsList

List<String> getColumnNamesAsList()
Convenience method to get the column names as a list.

Returns:
The names of the columns.

getColumns

List<DBColInfo> getColumns()
Getter for property columns.

Returns:
Value of property columns.

getCreationTime

long getCreationTime()

getExportedFKInfo

List<DBForeignKeyInfo> getExportedFKInfo()
Get the foreign keys that involve this table but are defined in a foreign key constraint definition that is defined in another table (though possibly this table). e.g. the keys in this table that are referred to in a foreign key constraint definition somewhere.

Returns:
A list of foreign keys

getImportedFKInfo

List<DBForeignKeyInfo> getImportedFKInfo()
Get the foreign keys that this table defines. e.g. the primary keys of other tables (or possibly this table) that are referred to in a foreign key constraint definition.

Returns:
A list of foreign keys

getIndexInfo

List<DBIndexInfo> getIndexInfo()

getPrimaryKeyColumns

List<String> getPrimaryKeyColumns()
Get the value of primary key columns for the table.

Returns:
The primary key columns for the table in the order that they are defined

getTriggerInfo

List<DBTriggerInfo> getTriggerInfo()

getUniqueConstraints

List<DBConstraintInfo> getUniqueConstraints()

updateColumns

DBTableInfo updateColumns(List<DBColInfo> cols)

updateImportedForeignKeys

DBTableInfo updateImportedForeignKeys(List<DBForeignKeyInfo> pkKeys)

updateExportedForeignKeys

DBTableInfo updateExportedForeignKeys(List<DBForeignKeyInfo> fkKeys)

updateIndexInfos

DBTableInfo updateIndexInfos(List<DBIndexInfo> indexes)

updateUniqueConstraintInfos

DBTableInfo updateUniqueConstraintInfos(List<DBConstraintInfo> constraints)

com.im.commons.db 5.9.2