本文整理汇总了Java中liquibase.sqlgenerator.core.CreateViewGenerator类的典型用法代码示例。如果您正苦于以下问题:Java CreateViewGenerator类的具体用法?Java CreateViewGenerator怎么用?Java CreateViewGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateViewGenerator类属于liquibase.sqlgenerator.core包,在下文中一共展示了CreateViewGenerator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSql
import liquibase.sqlgenerator.core.CreateViewGenerator; //导入依赖的package包/类
/**
* 1. View creation to be set to run once only, no more runAlways="true".
* 2. If there is a materialized view with the same name as this view, we drop it.
* 3. We can then can create the standard view: 'create or replace force view as ... select 1 from dual'
* 4. If the environment is set for materialized views, convert all views to materialized views at the end using the v99.99.99 script.
*/
public Sql[] generateSql( CreateFlexibleViewStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain ) {
// check if the view already exists, then formulate a plan from there!
String viewName = statement.getViewName().toUpperCase();
List<Sql> sequel = new ArrayList<Sql>();
OracleMaterializedViewExistsPrecondition matViewExistsCondition = new OracleMaterializedViewExistsPrecondition();
matViewExistsCondition.setViewName( viewName );
if ( matViewExistsCondition.check( database ) ) {
DropMaterializedViewStatement dropMViewStmt = new DropMaterializedViewStatement( statement.getViewName() );
dropMViewStmt.setSchemaName( database.getLiquibaseSchemaName() );
DropMaterializedViewOracle dropMViewGen = new DropMaterializedViewOracle();
sequel.addAll( Arrays.asList( dropMViewGen.generateSql( dropMViewStmt, database, null ) ) );
}
// if the view exists as a regular view already, we don't actually care.
CreateViewStatement createViewStmt = new CreateViewStatement( database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName(), statement.getViewName(), statement.getSelectQuery(), true );
CreateViewGenerator createViewGen = new CreateViewGenerator();
sequel.addAll( Arrays.asList( createViewGen.generateSql( createViewStmt, database, null ) ) );
return sequel.toArray( new Sql[0] );
}