public abstract class BasicTable extends DataGrainElement implements TableElement
Table
and ReadOnlyTable
that encompasses common logic
for both table types.MAX_IDENTIFIER_LENGTH
YOU_CANNOT_DROP_A_COLUMN_THAT_BELONGS_TO
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column<?> column)
Adds a column to the table.
|
void |
finalizePK()
Finalizes the creation of the primary key.
|
Column<?> |
getColumn(String colName)
Returns a column by its name or throws an exception with a message that
the column is not found.
|
int |
getColumnIndex(String name)
Column index in the list of columns.
|
Map<String,Column<?>> |
getColumns()
Unmodified list of table columns.
|
Set<ForeignKey> |
getForeignKeys()
Returns a set of foreign keys for the table.
|
List<String> |
getImplements()
Returns interfaces that are implemented by the cursor (values of
'implements' property) for this table.
|
Set<Index> |
getIndices()
Returns a set of indices for the table.
|
String |
getPkConstraintName()
Returns PK constraint name.
|
Map<String,Column<?>> |
getPrimaryKey()
Returns unmodified map of primary key columns.
|
boolean |
isAutoUpdate()
Whether autoupdate is on/off.
false value indicates that the table was created with the option
WITH NO STRUCTURE UPDATE and it won't take part in the DB autoupdate. |
void |
removeColumn(Column<?> column)
Removes a column from the table.
|
void |
setAutoUpdate(boolean autoUpdate)
Sets or clears the option WITH NO STRUCTURE UPDATE.
|
void |
setPK(String... columnNames)
Sets primary key on the table in a form of array of columns.
|
void |
setPkConstraintName(String pkConstraintName)
Sets the name of constraint for the primary key.
|
String |
toString() |
delete
getGrain, getGrainPart
equals, getCelestaDoc, getName, getQuotedName, getQuotedNameIfNeeded, hashCode, limitName, limitName, setCelestaDoc
getGrain, getName, getQuotedName, getQuotedNameIfNeeded, hasPrimeKey
public Map<String,Column<?>> getColumns()
getColumns
in interface HasColumns
getColumns
in interface TableElement
public final Column<?> getColumn(String colName) throws ParseException
TableElement
getColumn
in interface TableElement
colName
- column nameParseException
- if a column with the specified name is not found in the tablepublic final Map<String,Column<?>> getPrimaryKey()
TableElement
getPrimaryKey
in interface TableElement
public void addColumn(Column<?> column) throws ParseException
addColumn
in interface TableElement
column
- new columnParseException
- if a column with the same name is already definedpublic void setPK(String... columnNames) throws ParseException
columnNames
- array of columnsParseException
- in case when an empty array is passed inpublic final void removeColumn(Column<?> column) throws ParseException
TableElement
removeColumn
in interface TableElement
column
- existing columnParseException
- if the column couldn't be removedpublic void finalizePK() throws ParseException
ParseException
- if the primary key is empty.public Set<ForeignKey> getForeignKeys()
public final String getPkConstraintName()
TableElement
getPkConstraintName
in interface TableElement
public void setPkConstraintName(String pkConstraintName) throws ParseException
pkConstraintName
- PK constraint nameParseException
- incorrect namepublic boolean isAutoUpdate()
false
value indicates that the table was created with the option
WITH NO STRUCTURE UPDATE and it won't take part in the DB autoupdate.
Default is true
.public void setAutoUpdate(boolean autoUpdate)
autoUpdate
- true
if the table is updated automatically,
false
- in the opposite case.public final int getColumnIndex(String name)
HasColumns
getColumnIndex
in interface HasColumns
name
- column name.Copyright © 2023 CURS. All rights reserved.