本文整理汇总了Java中liquibase.database.core.OracleDatabase类的典型用法代码示例。如果您正苦于以下问题:Java OracleDatabase类的具体用法?Java OracleDatabase怎么用?Java OracleDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OracleDatabase类属于liquibase.database.core包,在下文中一共展示了OracleDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateSql
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
public Sql[] generateSql(SelectFromDatabaseChangeLogLockStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseSchema;
liquibaseSchema = database.getLiquibaseSchemaName();
String[] columns = statement.getColumnsToSelect();
int numberOfColumns = columns.length;
String[] escapedColumns = new String[numberOfColumns];
for (int i=0; i<numberOfColumns; i++) {
escapedColumns[i] = database.escapeColumnName(liquibaseSchema, database.getDatabaseChangeLogLockTableName(), columns[i]);
}
String sql = "SELECT " + StringUtils.join(escapedColumns, ",") + " FROM " +
database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogLockTableName()) +
" WHERE " + database.escapeColumnName(liquibaseSchema, database.getDatabaseChangeLogLockTableName(), "ID") + "=1";
if (database instanceof OracleDatabase) {
sql += " FOR UPDATE";
}
return new Sql[] {
new UnparsedSql(sql)
};
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:23,代码来源:SelectFromDatabaseChangeLogLockGenerator.java
示例2: generateSql
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
public Sql[] generateSql(SelectFromDatabaseChangeLogLockStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseSchema;
liquibaseSchema = database.getLiquibaseSchemaName();
String[] columns = statement.getColumnsToSelect();
String sql = "SELECT " + StringUtils.join(columns, ",") + " FROM " +
database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogLockTableName()) +
" WHERE ID = 1";
if (database instanceof OracleDatabase) {
sql += " FOR UPDATE";
}
return new Sql[] {
new UnparsedSql(sql)
};
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:PortofinoSelectFromDatabaseChangeLogLockGenerator.java
示例3: testGenerateSql
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
/**
* Tests
* {@link DropSpatialTableGeneratorOracle#generateSql(DropTableStatement, Database, SqlGeneratorChain)}
*/
@Test
public void testGenerateSql() {
final DropSpatialTableGeneratorOracle generator = new DropSpatialTableGeneratorOracle();
final Database database = new OracleDatabase();
final SqlGeneratorChain sqlGeneratorChain = mock(SqlGeneratorChain.class);
final DropTableStatement statement = new DropTableStatement("catalog_name", "schema_name",
"table_name", true);
final Sql comment = new SingleLineComment("No-op", "--");
when(sqlGeneratorChain.generateSql(statement, database)).thenReturn(new Sql[] { comment });
final Sql[] result = generator.generateSql(statement, database, sqlGeneratorChain);
assertNotNull(result);
assertEquals(result.length, 2);
assertEquals(result[1], comment);
// Verify the DELETE statement.
final String deleteSql = result[0].toSql();
String deletePattern = "(?i)DELETE FROM user_sdo_geom_metadata ";
deletePattern += "WHERE table_name = '" + statement.getTableName().toUpperCase();
deletePattern += "'";
assertTrue(deleteSql.matches(deletePattern), "'" + deleteSql
+ "' does not match the pattern '" + deletePattern + "'");
assertNotNull(result[0].getAffectedDatabaseObjects());
assertTrue(result[0].getAffectedDatabaseObjects().size() >= 1, result[0]
.getAffectedDatabaseObjects().toString());
}
开发者ID:lonnyj,项目名称:liquibase-spatial,代码行数:30,代码来源:DropSpatialTableGeneratorOracleTest.java
示例4: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DisableTriggerChange change = new DisableTriggerChange();
change.setSchemaName("SCHEMA_NAME");
change.setTriggerName("TRIGGER_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof DisableTriggerStatement);
assertEquals("SCHEMA_NAME", ((DisableTriggerStatement) sqlStatements[0]).getSchemaName());
assertEquals("TRIGGER_NAME", ((DisableTriggerStatement) sqlStatements[0]).getTriggerName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:18,代码来源:DisableTriggerTest.java
示例5: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
EncapsulateTableWithViewChange change = new EncapsulateTableWithViewChange();
change.setSchemaName("SCHEMA_NAME");
change.setTableName("TABLE_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(2, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof RenameTableStatement);
assertTrue(sqlStatements[1] instanceof CreateViewStatement);
assertEquals("SCHEMA_NAME", ((RenameTableStatement) sqlStatements[0]).getSchemaName());
assertEquals("TABLE_NAME", ((RenameTableStatement) sqlStatements[0]).getOldTableName());
assertEquals("TTABLE_NAME", ((RenameTableStatement) sqlStatements[0]).getNewTableName());
assertEquals("SCHEMA_NAME", ((CreateViewStatement) sqlStatements[1]).getSchemaName());
assertEquals("TABLE_NAME", ((CreateViewStatement) sqlStatements[1]).getViewName());
assertEquals("SELECT * FROM TTABLE_NAME", ((CreateViewStatement) sqlStatements[1]).getSelectQuery());
assertTrue(((CreateViewStatement) sqlStatements[1]).isReplaceIfExists());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:23,代码来源:EncapsulateTableWithViewTest.java
示例6: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
RenameTriggerChange change = new RenameTriggerChange();
change.setSchemaName("SCHEMA_NAME");
change.setTriggerName("TRIGGER_NAME");
change.setNewName("NEW_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof RenameTriggerStatement);
assertEquals("SCHEMA_NAME", ((RenameTriggerStatement) sqlStatements[0]).getSchemaName());
assertEquals("TRIGGER_NAME", ((RenameTriggerStatement) sqlStatements[0]).getTriggerName());
assertEquals("NEW_NAME", ((RenameTriggerStatement) sqlStatements[0]).getNewName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:20,代码来源:RenameTriggerTest.java
示例7: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DisableConstraintChange change = new DisableConstraintChange();
change.setSchemaName("SCHEMA_NAME");
change.setTableName("TABLE_NAME");
change.setConstraintName("CONSTRAINT");
SqlStatement[] statements = change.generateStatements(new OracleDatabase());
assertEquals(1, statements.length);
DisableConstraintStatement statement = (DisableConstraintStatement) statements[0];
assertEquals("SCHEMA_NAME", statement.getSchemaName());
assertEquals("TABLE_NAME", statement.getTableName());
assertEquals("CONSTRAINT", statement.getConstraintName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:19,代码来源:DisableConstraintChangeTest.java
示例8: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
SplitTableChange change = new SplitTableChange();
change.setSplitTableSchemaName("SPLIT_TABLE_SCHEMA_NAME");
change.setSplitTableName("SPLIT_TABLE_NAME");
change.setNewTableSchemaName("NEW_TABLE_SCHEMA_NAME");
change.setNewTableName("NEW_TABLE_NAME");
change.setColumnNameList("FIRST,SECOND");
change.setPrimaryKeyColumnName("FIRST");
SqlStatement[] statements = change.generateStatements(new OracleDatabase());
assertEquals(1, statements.length);
SplitTableStatement statement = (SplitTableStatement) statements[0];
assertEquals("SPLIT_TABLE_SCHEMA_NAME", statement.getSplitTableSchemaName());
assertEquals("SPLIT_TABLE_NAME", statement.getSplitTableName());
assertEquals("NEW_TABLE_SCHEMA_NAME", statement.getNewTableSchemaName());
assertEquals("NEW_TABLE_NAME", statement.getNewTableName());
assertEquals("FIRST,SECOND", statement.getColumnNameList());
assertEquals("FIRST", statement.getPrimaryKeyColumnName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:27,代码来源:SplitTableChangeTest.java
示例9: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() throws Exception {
AddDeferredPrimaryKeyChange change = new AddDeferredPrimaryKeyChange();
change.setSchemaName("SCHEMA_NAME");
change.setTableName("TABLE_NAME");
change.setColumnNames("COL_HERE");
change.setConstraintName("PK_NAME");
change.setDeferrable(true);
change.setInitiallyDeferred(true);
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof AddDeferredPrimaryKeyStatement);
assertEquals("SCHEMA_NAME", ((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getSchemaName());
assertEquals("TABLE_NAME", ((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getTableName());
assertEquals("COL_HERE", ((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getColumnNames());
assertEquals("PK_NAME", ((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getConstraintName());
assertTrue(((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getDeferrable());
assertTrue(((AddDeferredPrimaryKeyStatement) sqlStatements[0]).getInitiallyDeferred());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:27,代码来源:AddDeferredPrimaryKeyChangeTest.java
示例10: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DropSynonymChange change = new DropSynonymChange();
change.setPublic(true);
change.setSynonymSchemaName(SYNONYM_SCHEMA);
change.setSynonymName(SYNONYM_NAME);
change.setForce(true);
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof DropSynonymStatement);
DropSynonymStatement statement = (DropSynonymStatement) sqlStatements[0];
assertTrue(statement.isForce());
assertTrue(statement.isPublic());
assertEquals(SYNONYM_NAME, statement.getSynonymName());
assertEquals(SYNONYM_SCHEMA, statement.getSynonymSchemaName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:23,代码来源:DropSynonymTest.java
示例11: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DropTriggerChange change = new DropTriggerChange();
change.setSchemaName("SCHEMA_NAME");
change.setTriggerName("TRIGGER_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof DropTriggerStatement);
assertEquals("SCHEMA_NAME", ((DropTriggerStatement) sqlStatements[0]).getSchemaName());
assertEquals("TRIGGER_NAME", ((DropTriggerStatement) sqlStatements[0]).getTriggerName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:18,代码来源:DropTriggerTest.java
示例12: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
LongUpdateChange change = new LongUpdateChange();
change.setCommitInterval(2);
change.setSleepSeconds(2);
change.setUpdateSql("UPDATE_SQL");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof LongUpdateStatement);
assertEquals(Integer.valueOf(2), ((LongUpdateStatement) sqlStatements[0]).getCommitInterval());
assertEquals(Integer.valueOf(2), ((LongUpdateStatement) sqlStatements[0]).getSleepSeconds());
assertEquals("UPDATE_SQL", ((LongUpdateStatement) sqlStatements[0]).getUpdateSql());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:20,代码来源:LongUpdateTest.java
示例13: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DropMaterializedViewChange change = new DropMaterializedViewChange();
change.setSchemaName("SCHEMA_NAME");
change.setViewName("VIEW_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof DropMaterializedViewStatement);
assertEquals("SCHEMA_NAME", ((DropMaterializedViewStatement) sqlStatements[0]).getSchemaName());
assertEquals("VIEW_NAME", ((DropMaterializedViewStatement) sqlStatements[0]).getViewName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:17,代码来源:DropMaterializedViewTest.java
示例14: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
EnableTriggerChange change = new EnableTriggerChange();
change.setSchemaName("SCHEMA_NAME");
change.setTriggerName("TRIGGER_NAME");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof EnableTriggerStatement);
assertEquals("SCHEMA_NAME", ((EnableTriggerStatement) sqlStatements[0]).getSchemaName());
assertEquals("TRIGGER_NAME", ((EnableTriggerStatement) sqlStatements[0]).getTriggerName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:18,代码来源:EnableTriggerTest.java
示例15: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
SetTransactionChange change = new SetTransactionChange();
change.setTransactionName("TRANSACTION_NAME");
change.setIsolationLevel("ISOLATION_LEVEL");
change.setRollbackSegment("ROLLBACK_SEGMENT");
change.setReadOnlyWrite("READONLYWRITE");
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof SetTransactionStatement);
assertEquals("TRANSACTION_NAME", ((SetTransactionStatement) sqlStatements[0]).getTransactionName());
assertEquals("ISOLATION_LEVEL", ((SetTransactionStatement) sqlStatements[0]).getIsolationLevel());
assertEquals("ROLLBACK_SEGMENT", ((SetTransactionStatement) sqlStatements[0]).getRollbackSegment());
assertEquals("READONLYWRITE", ((SetTransactionStatement) sqlStatements[0]).getReadOnlyWrite());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:22,代码来源:SetTransactionTest.java
示例16: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
TruncateChange change = new TruncateChange();
change.setSchemaName("SCHEMA_NAME");
change.setTableName("TABLE_NAME");
change.setClusterName("CLUSTER_NAME");
change.setPurgeMaterializedViewLog(true);
change.setReuseStorage(true);
Database database = new OracleDatabase();
SqlStatement[] sqlStatements = change.generateStatements(database);
assertEquals(1, sqlStatements.length);
assertTrue(sqlStatements[0] instanceof TruncateStatement);
assertEquals("SCHEMA_NAME", ((TruncateStatement) sqlStatements[0]).getSchemaName());
assertEquals("TABLE_NAME", ((TruncateStatement) sqlStatements[0]).getTableName());
assertEquals("CLUSTER_NAME", ((TruncateStatement) sqlStatements[0]).getClusterName());
assertTrue(((TruncateStatement) sqlStatements[0]).purgeMaterializedViewLog());
assertTrue(((TruncateStatement) sqlStatements[0]).reuseStorage());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:24,代码来源:TruncateChangeTest.java
示例17: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
RefreshMaterializedViewChange change = new RefreshMaterializedViewChange();
change.setSchemaName("SCHEMA_NAME");
change.setViewName("VIEW_NAME");
change.setAtomicRefresh(Boolean.TRUE);
change.setRefreshType("fast");
SqlStatement[] sqlStatements = change.generateStatements(new OracleDatabase());
assertEquals("Wrong number of statements returned", 1, sqlStatements.length);
assertEquals("Statement of wrong type", RefreshMaterializedViewStatement.class, sqlStatements[0].getClass() );
assertEquals("schema name not copied", "SCHEMA_NAME", ((RefreshMaterializedViewStatement) sqlStatements[0]).getSchemaName());
assertEquals("view name not copied", "VIEW_NAME", ((RefreshMaterializedViewStatement) sqlStatements[0]).getViewName());
assertEquals("atomic refresh not copied", Boolean.TRUE, ((RefreshMaterializedViewStatement) sqlStatements[0]).getAtomicRefresh());
assertEquals("refresh type not copied", "fast", ((RefreshMaterializedViewStatement) sqlStatements[0]).getRefreshType());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:19,代码来源:RefreshMaterializedViewTest.java
示例18: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
DropCheckChange change = new DropCheckChange();
change.setSchemaName("SCHEMA_NAME");
change.setTableName("TABLE_NAME");
change.setConstraintName("CONSTRAINT");
SqlStatement[] statements = change.generateStatements(new OracleDatabase());
assertEquals(1, statements.length);
DropCheckStatement statement = (DropCheckStatement) statements[0];
assertEquals("SCHEMA_NAME", statement.getSchemaName());
assertEquals("TABLE_NAME", statement.getTableName());
assertEquals("CONSTRAINT", statement.getConstraintName());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:19,代码来源:DropCheckChangeTest.java
示例19: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
GrantObjectPermissionChange change = new GrantObjectPermissionChange();
change.setSchemaName("SCHEMA_NAME");
change.setObjectName("TABLE_NAME");
change.setRecipientList("RECIPIENT_USER");
change.setSelect(true);
change.setUpdate(true);
change.setInsert(true);
change.setDelete(true);
change.setExecute(true);
SqlStatement[] statements = change.generateStatements(new OracleDatabase());
assertEquals(1, statements.length);
GrantObjectPermissionStatement statement = (GrantObjectPermissionStatement) statements[0];
assertEquals("SCHEMA_NAME", statement.getSchemaName());
assertEquals("TABLE_NAME", statement.getObjectName());
assertEquals("RECIPIENT_USER", statement.getRecipientList());
assertEquals(true, statement.getSelect());
assertEquals(true, statement.getUpdate());
assertEquals(true, statement.getInsert());
assertEquals(true, statement.getDelete());
assertEquals(true, statement.getExecute());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:27,代码来源:GrantObjectPermissionChangeTest.java
示例20: generateStatement
import liquibase.database.core.OracleDatabase; //导入依赖的package包/类
@Test
public void generateStatement() {
RevokeObjectPermissionChange change = new RevokeObjectPermissionChange();
change.setSchemaName("SCHEMA_NAME");
change.setObjectName("TABLE_NAME");
change.setRecipientList("RECIPIENT_USER");
change.setSelect(true);
change.setUpdate(true);
change.setInsert(true);
change.setDelete(true);
change.setExecute(true);
SqlStatement[] statements = change.generateStatements(new OracleDatabase());
assertEquals(1, statements.length);
RevokeObjectPermissionStatement statement = (RevokeObjectPermissionStatement) statements[0];
assertEquals("SCHEMA_NAME", statement.getSchemaName());
assertEquals("TABLE_NAME", statement.getObjectName());
assertEquals("RECIPIENT_USER", statement.getRecipientList());
assertEquals(true, statement.getSelect());
assertEquals(true, statement.getUpdate());
assertEquals(true, statement.getInsert());
assertEquals(true, statement.getDelete());
assertEquals(true, statement.getExecute());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:27,代码来源:RevokeObjectPermissionChangeTest.java
注:本文中的liquibase.database.core.OracleDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论