Class TableImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.jdbc.db.TableImpl
-
- All Implemented Interfaces:
Serializable
,Table
public class TableImpl extends Object implements Table
The basic implementation of a SQL table.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.storage.sql.jdbc.db.Table
Table.IndexType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Column
addColumn(String name, ColumnType type, String key, Model model)
Adds aColumn
to the table.Column
addColumn(String name, Column column)
Adds a column without dialect physical name canonicalization (for directories).void
addIndex(String... columnNames)
Adds an index on one or several columns.void
addIndex(String indexName, Table.IndexType indexType, String... columnNames)
Adds an index of the given name and type on one or several columns.protected void
addOneColumn(StringBuilder sb, Column column)
Adds to buf the column name and its type and constraints for create / alter.String
getAddColumnSql(Column column)
Computes the SQL statement to alter a table and add a column to it.Column
getColumn(String name)
Collection<Column>
getColumns()
String
getCreateSql()
Computes the SQL statement to create the table.Dialect
getDialect()
String
getDropSql()
Computes the SQL statement to drop the table.String
getKey()
String
getPhysicalName()
List<String>
getPostAddSqls(Column column, Model model)
Computes the SQL statements to finish adding a column, usually some ALTER TABLE statements to add constraints or indexes.List<String>
getPostCreateSqls(Model model)
Computes the SQL statements to finish creating the table, usually some ALTER TABLE statements to add constraints or indexes.Column
getPrimaryColumn()
String
getQuotedName()
String
getQuotedSuffixedName(String suffix)
Table
getRealTable()
boolean
hasFulltextIndex()
Checks if the table has some fulltext indexes.boolean
isAlias()
protected void
postAddColumn(Column column, List<String> sqls, Model model)
String
toString()
-
-
-
Method Detail
-
getRealTable
public Table getRealTable()
- Specified by:
getRealTable
in interfaceTable
-
getDialect
public Dialect getDialect()
- Specified by:
getDialect
in interfaceTable
-
getPhysicalName
public String getPhysicalName()
- Specified by:
getPhysicalName
in interfaceTable
-
getQuotedName
public String getQuotedName()
- Specified by:
getQuotedName
in interfaceTable
-
getQuotedSuffixedName
public String getQuotedSuffixedName(String suffix)
- Specified by:
getQuotedSuffixedName
in interfaceTable
-
getPrimaryColumn
public Column getPrimaryColumn()
- Specified by:
getPrimaryColumn
in interfaceTable
-
getColumns
public Collection<Column> getColumns()
- Specified by:
getColumns
in interfaceTable
-
addColumn
public Column addColumn(String name, Column column)
Adds a column without dialect physical name canonicalization (for directories).
-
addColumn
public Column addColumn(String name, ColumnType type, String key, Model model)
Description copied from interface:Table
Adds aColumn
to the table.
-
addIndex
public void addIndex(String indexName, Table.IndexType indexType, String... columnNames)
Description copied from interface:Table
Adds an index of the given name and type on one or several columns.
-
hasFulltextIndex
public boolean hasFulltextIndex()
Description copied from interface:Table
Checks if the table has some fulltext indexes.- Specified by:
hasFulltextIndex
in interfaceTable
- Returns:
true
if the table has some fulltext indexes
-
getCreateSql
public String getCreateSql()
Computes the SQL statement to create the table.- Specified by:
getCreateSql
in interfaceTable
- Returns:
- the SQL create string.
-
getAddColumnSql
public String getAddColumnSql(Column column)
Computes the SQL statement to alter a table and add a column to it.- Specified by:
getAddColumnSql
in interfaceTable
- Parameters:
column
- the column to add- Returns:
- the SQL alter table string
-
addOneColumn
protected void addOneColumn(StringBuilder sb, Column column)
Adds to buf the column name and its type and constraints for create / alter.
-
getPostCreateSqls
public List<String> getPostCreateSqls(Model model)
Description copied from interface:Table
Computes the SQL statements to finish creating the table, usually some ALTER TABLE statements to add constraints or indexes.- Specified by:
getPostCreateSqls
in interfaceTable
- Returns:
- the SQL strings
-
getPostAddSqls
public List<String> getPostAddSqls(Column column, Model model)
Description copied from interface:Table
Computes the SQL statements to finish adding a column, usually some ALTER TABLE statements to add constraints or indexes.- Specified by:
getPostAddSqls
in interfaceTable
- Returns:
- the SQL strings
-
postAddColumn
protected void postAddColumn(Column column, List<String> sqls, Model model)
-
getDropSql
public String getDropSql()
Computes the SQL statement to drop the table.TODO drop constraints and indexes
- Specified by:
getDropSql
in interfaceTable
- Returns:
- the SQL drop string.
-
-