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 voidalterSequence(Connection conn, SequenceElement s)Alters sequence in the database.voidcreateColumn(Connection conn, Column<?> c)Adds a new column to the table.voidcreateFk(Connection conn, ForeignKey fk)Creates foreign key in the DB.voidcreateIndex(Connection conn, Index index)Creates a table index in the grain.voidcreateParameterizedView(Connection conn, ParameterizedView pv)voidcreatePk(Connection conn, TableElement t)Creates primary key in the table according to meta description.voidcreateSchema(Connection conn, String name)Creates DB schema.voidcreateSequence(Connection conn, SequenceElement s)Creates a sequence in the database.voidcreateTable(Connection conn, TableElement te)Creates a table "from scratch" in the database.voidcreateTableTriggersForMaterializedViews(Connection conn, BasicTable t)voidcreateView(Connection conn, View v)Creates a view in the database from metadata.voiddropFK(Connection conn, String schemaName, String tableName, String fkName)Drops foreign key of table in a scheme.voiddropIndex(Connection conn, Grain g, DbIndexInfo dBIndexInfo)Drops index of a grain.voiddropParameterizedView(Connection conn, String schemaName, String viewName)voiddropPk(Connection conn, TableElement t, String pkName)Drops primary key from the table by using known name of the primary key.voiddropTable(Connection conn, TableElement t)Deletes table from RDBMS.voiddropTableTriggersForMaterializedViews(Connection conn, BasicTable t)voiddropTrigger(Connection conn, TriggerQuery query)Drops a trigger from DB.voiddropView(Connection conn, String schemaName, String viewName)Drops view from a DB schema.voidexecuteNative(Connection conn, String sql)Executes native SQL query.SQLGeneratorgetViewSQLGenerator()voidinitDataForMaterializedView(Connection conn, MaterializedView mv)voidupdateColumn(Connection conn, Column<?> c, DbColumnInfo actual)Updates a table column.voidupdateVersioningTrigger(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
-
-