|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISchemaEngine
Method Summary | |
---|---|
TableInfo |
addColumn(TableInfo ti,
ColumnInfo columnInfo)
Add a column to an existing table. |
TableInfo |
addForeignKey(TableInfo ti,
ForeignKeyInfo fkInfo)
Add a foreign key to an existing table. |
TableInfo |
addIndex(TableInfo tableinfo,
IndexInfo indexInfo)
Add an index to an existing table. |
TableInfo |
changeColumn(TableInfo ti,
String oldColumnName,
ColumnInfo columnInfo)
Rename an existing column of an existing table and possibly change it's type. |
void |
commit()
Perform all pending schema modifications and discard the rollback history. |
void |
createForeignKeys(TableInfo ti)
Create foreign keys of an existing table in the database. |
PreparedStatement |
createInsertStatement(TableInfo ti,
boolean setAutoValues)
Create an insert statement for all column in the given table. |
void |
createTable(TableInfo ti,
boolean addForeignKeys)
Create a table in the database, including primary key and indices (which must have been added already). |
TableInfo |
dropColumn(TableInfo ti,
String columnName,
boolean force)
Drop an existing column of an existing table. |
TableInfo |
dropForeignKey(TableInfo ti,
String fkName)
Drop an existing foreign key of an existing table. |
TableInfo |
dropForeignKeys(TableInfo ti)
Drop all existing foreign keys of an existing table. |
TableInfo |
dropIndex(TableInfo tableInfo,
String indexName)
Drop an index from an existing table. |
void |
dropStaleBackupTables()
Some operations like drop table or drop column create backup tables for performing rollback operations. |
void |
dropTable(TableInfo ti,
boolean force)
Drop an existing table. |
void |
dropTables(List<TableInfo> tables,
boolean force)
Drop a list of existing table. |
TableInfo |
fetchTableInfo(String tableName,
IndexFilter filter)
Retrieve the current layout of the given table in the database. |
List<TableInfo> |
fetchTableInfos(TableFilter filter)
Return the layout of multiple table in the database. |
Connection |
getConnection()
|
Dialect |
getDialect()
|
int |
getMaxTableNameLength()
|
String |
getSchema()
|
List<String> |
getTempTableNames()
|
TimeZone |
getTimeZone()
|
TableInfo |
modifyColumn(TableInfo ti,
ColumnInfo columnInfo)
Change an existing column of an existing table. |
TableInfo |
renameTable(TableInfo ti,
String newTableName)
Rename an existing table. |
void |
rollback()
Roll back all schema operations undertaken since the last call to commit() or rollback() . |
void |
setConnection(Connection connection)
This method initializes the database dialect too, if the the dialect has not been set through setDialect(Dialect)
before. |
void |
setDialect(Dialect dialect)
Normally you need not call this method, because the dialect is usually initialized by setConnection(Connection) . |
void |
setSchema(String schema)
|
void |
setTimeZone(TimeZone timeZone)
|
Method Detail |
---|
Connection getConnection()
void setConnection(Connection connection) throws SQLException
setDialect(Dialect)
before.
The dialect is retrieved through a call to
IDialectFactory.newDialect(java.sql.DatabaseMetaData)
on
the instance returned by DialectFactory.newInstance()
.
connection
- The database connection to set.
SQLException
- If the metadata retrieval on the database failed during
the dialect initialization.TimeZone getTimeZone()
void setTimeZone(TimeZone timeZone)
timeZone
- The time zone to set.Dialect getDialect()
void setDialect(Dialect dialect)
setConnection(Connection)
.
dialect
- The database dialect to setString getSchema()
DatabaseMetaData.getTables(String, String, String, String[])
,
DatabaseMetaData.getColumns(String, String, String, String)
,
DatabaseMetaData.getImportedKeys(String, String, String)
,
DatabaseMetaData.getExportedKeys(String, String, String)
,
DatabaseMetaData.getPrimaryKeys(String, String, String)
void setSchema(String schema)
schema
- The schema to setTableInfo fetchTableInfo(String tableName, IndexFilter filter) throws SQLException
tableName
- The name of the table to search.filter
- The filter retrieval configuration. If a null value is passed,
a default filter will be used, which skips internal indices.
SQLException
- Upon database errors.IndexFilter.isKeepInternalIndices()
List<TableInfo> fetchTableInfos(TableFilter filter) throws SQLException
filter
- If null, return all tables of the configured schema. Otherwise
return only those tables, for which TableFilter.processTable(String)
returns true. Additionally, a null value incurs default table filtering,
which means to fetch all table infos.
SQLException
- Upon database errors.PreparedStatement createInsertStatement(TableInfo ti, boolean setAutoValues) throws SQLException
ti
- The table metadata.setAutoValues
- If true
, columns that use auto increment will be set by this statement too. If false
database should set those values.
SQLException
- Upon database errors.void createTable(TableInfo ti, boolean addForeignKeys) throws SQLException
ti
- The table metadata.addForeignKeys
- If this parameter is true, all foreign keys are generated
together with the table structure. If set to false, you may
create the foreign keys later on using createForeignKeys(TableInfo)
.
SQLException
- upon database errors.TableInfo renameTable(TableInfo ti, String newTableName) throws SQLException
ti
- TableInfo
describing the table to be renamed.newTableName
- The new name of the table.
SQLException
- Upon database errors.void createForeignKeys(TableInfo ti) throws SQLException
ti
- The table metadata.
SQLException
- Upon database errors.TableInfo dropForeignKeys(TableInfo ti) throws SQLException
ti
- TableInfo
describing the table containing the foreign keys to drop.
TableInfo
without foreign keys.
SQLException
- Upon database errors.void dropTable(TableInfo ti, boolean force) throws SQLException
ti
- TableInfo
describing the table to be dropped.force
- If set to true, the data is not backed up before dropping the
table. Consequently, rollback is not supported, if
force
is set to true.
SQLException
- Upon database errors.void dropTables(List<TableInfo> tables, boolean force) throws SQLException
tables
- A list of TableInfo
objects describing
the tables to be dropped.force
- If set to true, the data is not backed up before dropping the
table. Consequently, rollback is not supported, if
force
is set to true.
SQLException
- Upon database errors.TableInfo addColumn(TableInfo ti, ColumnInfo columnInfo) throws SQLException
ti
- TableInfo
describing the table to add column to.columnInfo
- ColumnInfo
holding data for the column to be added.
TableInfo
.
SQLException
- Upon database errors.TableInfo modifyColumn(TableInfo ti, ColumnInfo columnInfo) throws SQLException
ti
- TableInfo
describing the table containing the column to change.columnInfo
- ColumnInfo
holding new definition data for the column.
TableInfo
.
SQLException
- Upon database errors.TableInfo changeColumn(TableInfo ti, String oldColumnName, ColumnInfo columnInfo) throws SQLException
ti
- TableInfo
describing the table containing the column to change.oldColumnName
- The original name of the column.columnInfo
- ColumnInfo
holding the new name and the
new definition data for the column.
TableInfo
.
SQLException
- Upon database errors.TableInfo dropColumn(TableInfo ti, String columnName, boolean force) throws SQLException
ti
- TableInfo
describing the table containing the column to drop.columnName
- Name of the column to drop.force
- If set to true, the data is not backed up before dropping the
column. Consequently, rollback is not supported, if
force
is set to true.
TableInfo
.
SQLException
- Upon database errors.TableInfo addForeignKey(TableInfo ti, ForeignKeyInfo fkInfo) throws SQLException
ti
- TableInfo
describing the table to add the foreign key to.fkInfo
- The ForeignKeyInfo
to add.
TableInfo
.
SQLException
- Upon database errors.TableInfo dropForeignKey(TableInfo ti, String fkName) throws SQLException
ti
- TableInfo
describing the table to drop the foreign key from.fkName
- The ForeignKeyInfo
to drop.
TableInfo
.
SQLException
- Upon database errors.TableInfo addIndex(TableInfo tableinfo, IndexInfo indexInfo) throws SQLException
tableinfo
- TableInfo
describing the table to add the index.indexInfo
- The IndexInfo
to add.
TableInfo
.
SQLException
- Upon database errors.TableInfo dropIndex(TableInfo tableInfo, String indexName) throws SQLException
tableInfo
- TableInfo
describing the table to drop the index from.indexName
- The name of the IndexInfo
to drop.
TableInfo
.
SQLException
- Upon database errors.void dropStaleBackupTables() throws SQLException
commit()
after such operations, these backup tables
remain in the target database.
This call searches these tables, which are named like JDBC2XML__*
and drops them, if necessary.
SQLException
void commit() throws SQLException
SQLException
- Upon database errors.void rollback() throws SQLException
commit()
or rollback()
.
SQLException
- Upon database errors or when a rollback
of a schema operation is not supported.List<String> getTempTableNames()
int getMaxTableNameLength()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |