Class DdlAdaptor
- java.lang.Object
-
- ru.curs.celesta.dbutils.adaptors.ddl.DdlAdaptor
-
public final class DdlAdaptor extends Object
-
-
Constructor Summary
Constructors Constructor Description DdlAdaptor(DdlGenerator ddlGenerator, DdlConsumer ddlConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
alterSequence(Connection conn, SequenceElement s)
Alters sequence in the database.void
createColumn(Connection conn, Column<?> c)
Adds a new column to the table.void
createFk(Connection conn, ForeignKey fk)
Creates foreign key in the DB.void
createIndex(Connection conn, Index index)
Creates a table index in the grain.void
createParameterizedView(Connection conn, ParameterizedView pv)
void
createPk(Connection conn, TableElement t)
Creates primary key in the table according to meta description.void
createSchema(Connection conn, String name)
Creates DB schema.void
createSequence(Connection conn, SequenceElement s)
Creates a sequence in the database.void
createTable(Connection conn, TableElement te)
Creates a table "from scratch" in the database.void
createTableTriggersForMaterializedViews(Connection conn, BasicTable t)
void
createView(Connection conn, View v)
Creates a view in the database from metadata.void
dropFK(Connection conn, String schemaName, String tableName, String fkName)
Drops foreign key of table in a scheme.void
dropIndex(Connection conn, Grain g, DbIndexInfo dBIndexInfo)
Drops index of a grain.void
dropParameterizedView(Connection conn, String schemaName, String viewName)
void
dropPk(Connection conn, TableElement t, String pkName)
Drops primary key from the table by using known name of the primary key.void
dropTable(Connection conn, TableElement t)
Deletes table from RDBMS.void
dropTableTriggersForMaterializedViews(Connection conn, BasicTable t)
void
dropTrigger(Connection conn, TriggerQuery query)
Drops a trigger from DB.void
dropView(Connection conn, String schemaName, String viewName)
Drops view from a DB schema.void
executeNative(Connection conn, String sql)
Executes native SQL query.SQLGenerator
getViewSQLGenerator()
void
initDataForMaterializedView(Connection conn, MaterializedView mv)
void
updateColumn(Connection conn, Column<?> c, DbColumnInfo actual)
Updates a table column.void
updateVersioningTrigger(Connection conn, TableElement t)
-
-
-
Constructor Detail
-
DdlAdaptor
public DdlAdaptor(DdlGenerator ddlGenerator, DdlConsumer ddlConsumer)
-
-
Method Detail
-
createSchema
public void createSchema(Connection conn, String name)
Creates DB schema.- Parameters:
conn
- DB connectionname
- schema name
-
dropView
public void dropView(Connection conn, String schemaName, String viewName)
Drops view from a DB schema.- Parameters:
conn
- DB connectionschemaName
- schema nameviewName
- view name
-
dropParameterizedView
public void dropParameterizedView(Connection conn, String schemaName, String viewName)
-
dropIndex
public void dropIndex(Connection conn, Grain g, DbIndexInfo dBIndexInfo)
Drops index of a grain.- Parameters:
conn
- DB connectiong
- graindBIndexInfo
- index information
-
dropFK
public void dropFK(Connection conn, String schemaName, String tableName, String fkName)
Drops foreign key of table in a scheme.- Parameters:
conn
- DB connectionschemaName
- grain nametableName
- table name for column(s) of which FK is declaredfkName
- name of foreign key
-
dropTrigger
public void dropTrigger(Connection conn, TriggerQuery query)
Drops a trigger from DB.- Parameters:
conn
- Connectionquery
- Trigger query
-
createSequence
public void createSequence(Connection conn, SequenceElement s)
Creates a sequence in the database.- Parameters:
conn
- DB connections
- sequence element
-
alterSequence
public void alterSequence(Connection conn, SequenceElement s)
Alters sequence in the database.- Parameters:
conn
- DB connections
- sequence element
-
createTable
public void createTable(Connection conn, TableElement te)
Creates a table "from scratch" in the database.- Parameters:
conn
- Connectionte
- Table for creation (accepts also table in case if such table exists)
-
updateVersioningTrigger
public void updateVersioningTrigger(Connection conn, TableElement t)
-
dropPk
public void dropPk(Connection conn, TableElement t, String pkName)
Drops primary key from the table by using known name of the primary key.- Parameters:
conn
- DB connectiont
- tablepkName
- primary key name
-
updateColumn
public void updateColumn(Connection conn, Column<?> c, DbColumnInfo actual)
Updates a table column.- Parameters:
conn
- DB connectionc
- Column to updateactual
- Actual column info
-
createColumn
public void createColumn(Connection conn, Column<?> c)
Adds a new column to the table.- Parameters:
conn
- DB connectionc
- column
-
createPk
public void createPk(Connection conn, TableElement t)
Creates primary key in the table according to meta description.- Parameters:
conn
- database connectiont
- table
-
createIndex
public void createIndex(Connection conn, Index index)
Creates a table index in the grain.- Parameters:
conn
- DB connectionindex
- index description
-
createFk
public void createFk(Connection conn, ForeignKey fk)
Creates foreign key in the DB.- Parameters:
conn
- DB connectionfk
- foreign key from score
-
createView
public void createView(Connection conn, View v)
Creates a view in the database from metadata.- Parameters:
conn
- DB connectionv
- View from score
-
getViewSQLGenerator
public SQLGenerator getViewSQLGenerator()
-
createParameterizedView
public void createParameterizedView(Connection conn, ParameterizedView pv)
-
dropTable
public void dropTable(Connection conn, TableElement t)
Deletes table from RDBMS.- Parameters:
conn
- Connection to use.t
- TableElement metadata of deletable table provided by Celesta.
-
initDataForMaterializedView
public void initDataForMaterializedView(Connection conn, MaterializedView mv)
-
dropTableTriggersForMaterializedViews
public void dropTableTriggersForMaterializedViews(Connection conn, BasicTable t)
-
createTableTriggersForMaterializedViews
public void createTableTriggersForMaterializedViews(Connection conn, BasicTable t)
-
executeNative
public void executeNative(Connection conn, String sql)
Executes native SQL query.- Parameters:
conn
- DB connectionsql
- SQL to execute
-
-