Constructor and Description |
---|
DbTable(DbSchema parent,
String name) |
DbTable(DbSchema parent,
String name,
String alias) |
Modifier and Type | Method and Description |
---|---|
DbColumn |
addColumn(String name)
Creates and adds an untyped column with the given name to this table.
|
DbColumn |
addColumn(String name,
int type,
Integer typeLength)
Creates and adds an typed column with the given parameters to this table.
|
DbColumn |
addColumn(String name,
int type,
Integer typePrecision,
Integer typeScale)
Creates and adds an typed column with the given parameters to this table.
|
DbColumn |
addColumn(String name,
String typeName,
Integer typeLength)
Creates and adds an typed column with the given parameters to this table.
|
DbColumn |
addColumn(String name,
String typeName,
Integer typePrecision,
Integer typeScale)
Creates and adds an typed column with the given parameters to this table.
|
<T extends DbColumn> |
addColumn(T column)
Adds the given column to this table.
|
<T extends DbConstraint> |
addConstraint(T constraint)
Adds the given constraint to this table.
|
DbCheckConstraint |
checkCondition(String name,
Condition condition)
Creates and adds check constraint with the given parameters to this
table.
|
DbColumn |
findColumn(String name) |
DbColumn[] |
findColumns(String... names) |
DbForeignKeyConstraint |
foreignKey(String name,
DbColumn[] columns,
DbTable referencedTable,
DbColumn[] refColumns)
Creates and adds foreign key constraint with the given parameters to this
table.
|
DbForeignKeyConstraint |
foreignKey(String name,
String[] colNames,
String referencedTableName,
String[] referencedColNames)
Creates and adds foreign key constraint with the given parameters to this
table.
|
DbForeignKeyConstraint |
foreignKey(String name,
String[] colNames,
String referencedSchemaName,
String referencedTableName,
String[] referencedColNames)
Creates and adds foreign key constraint with the given parameters to this
table.
|
String |
getAlias() |
List<DbColumn> |
getColumns() |
List<DbConstraint> |
getConstraints() |
String |
getTableNameSQL() |
DbConstraint |
primaryKey(String name,
String... colNames)
Creates and adds primary key constraint with the given parameters to this
table.
|
RejoinTable |
rejoin(String newAlias)
Convenience method for creating a new RejoinTable instance for this table
with the given alias.
|
String |
toString() |
DbConstraint |
unique(String name,
String... colNames)
Creates and adds unique constraint with the given parameters to this
table.
|
addObjects, checkOwnership, checkOwnership, findObject, getAbsoluteName, getName, getParent, getSpec
public String getAlias()
public String getTableNameSQL()
getTableNameSQL
in interface Table
public List<DbColumn> getColumns()
getColumns
in interface Table
public List<DbConstraint> getConstraints()
getConstraints
in interface Table
public DbColumn findColumn(String name)
name
- name of the column to findnull
if none.public DbColumn[] findColumns(String... names)
names
- name(s) of the column(s) to findnull
if none.public DbColumn addColumn(String name)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new columnpublic DbColumn addColumn(String name, String typeName, Integer typeLength)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new columntypeName
- type name for the columntypeLength
- optional length specification for the columnpublic DbColumn addColumn(String name, String typeName, Integer typePrecision, Integer typeScale)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new columntypeName
- type name for the columntypePrecision
- optional precision specification for the columntypeScale
- optional scale specification for the columnpublic DbColumn addColumn(String name, int type, Integer typeLength)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new columntype
- type for the column (one of Types
)typeLength
- optional length specification for the columnpublic DbColumn addColumn(String name, int type, Integer typePrecision, Integer typeScale)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new columntype
- type for the column (one of Types
)typePrecision
- optional precision specification for the columntypeScale
- optional scale specification for the columnpublic <T extends DbColumn> T addColumn(T column)
Note, no effort is made to make sure the column is unique.
column
- the column to be addedpublic DbConstraint unique(String name, String... colNames)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new constraintcolNames
- the name of the constrained columnspublic DbConstraint primaryKey(String name, String... colNames)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new constraintcolNames
- the name of the constrained columnspublic DbForeignKeyConstraint foreignKey(String name, String[] colNames, String referencedTableName, String[] referencedColNames)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new constraintcolNames
- the name of the constrained columnsreferencedTableName
- the name of the referenced tablereferencedColNames
- the names of the referenced columnspublic DbForeignKeyConstraint foreignKey(String name, String[] colNames, String referencedSchemaName, String referencedTableName, String[] referencedColNames)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new constraintcolNames
- the name of the constrained columnsreferencedSchemaName
- the name of the referenced schemareferencedTableName
- the name of the referenced tablereferencedColNames
- the names of the referenced columnspublic DbForeignKeyConstraint foreignKey(String name, DbColumn[] columns, DbTable referencedTable, DbColumn[] refColumns)
Note, no effort is made to make sure the given name is unique.
name
- the name of the new constraintcolumns
- the constrained columnsreferencedTable
- the referenced tablerefColumns
- the referenced columnspublic DbCheckConstraint checkCondition(String name, Condition condition)
Note, no effort is made to make sure the given name is unique.
condition
- the check conditionpublic <T extends DbConstraint> T addConstraint(T constraint)
Note, no effort is made to make sure the given constraint is unique.
constraint
- the constraint to be addedpublic RejoinTable rejoin(String newAlias)
Copyright © 2006–2021 OpenHMS. All rights reserved.