当前位置: 首页>>代码示例>>Java>>正文


Java DropUniqueConstraintStatement类代码示例

本文整理汇总了Java中liquibase.statement.core.DropUniqueConstraintStatement的典型用法代码示例。如果您正苦于以下问题:Java DropUniqueConstraintStatement类的具体用法?Java DropUniqueConstraintStatement怎么用?Java DropUniqueConstraintStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DropUniqueConstraintStatement类属于liquibase.statement.core包,在下文中一共展示了DropUniqueConstraintStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateSql

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
public Sql[] generateSql(DropUniqueConstraintStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    String sql;
    if (database instanceof MySQLDatabase) {
        sql = "ALTER TABLE " + database.escapeTableName(statement.getSchemaName(), statement.getTableName()) + " DROP KEY " + database.escapeConstraintName(statement.getConstraintName());
    } else if (database instanceof MaxDBDatabase) {
        sql = "DROP INDEX " + database.escapeConstraintName(statement.getConstraintName()) + " ON " + database.escapeTableName(statement.getSchemaName(), statement.getTableName());
    } else if (database instanceof OracleDatabase) {
        sql = "ALTER TABLE " + database.escapeTableName(statement.getSchemaName(), statement.getTableName()) + " DROP CONSTRAINT " + database.escapeConstraintName(statement.getConstraintName()) + " DROP INDEX";
    } else if (database instanceof SybaseASADatabase) {
        sql = "ALTER TABLE " + database.escapeTableName(statement.getSchemaName(), statement.getTableName()) + " DROP UNIQUE (" + statement.getUniqueColumns() + ")";
    } else {
        sql = "ALTER TABLE " + database.escapeTableName(statement.getSchemaName(), statement.getTableName()) + " DROP CONSTRAINT " + database.escapeConstraintName(statement.getConstraintName());
    }

    return new Sql[] {
            new UnparsedSql(sql)
    };
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:DropUniqueConstraintGenerator.java

示例2: testWithoutPerconaRollback

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testWithoutPerconaRollback() throws RollbackImpossibleException {
    PTOnlineSchemaChangeStatement.available = false;
    SqlStatement[] statements = generateRollbackStatements();
    Assert.assertEquals(1, statements.length);
    Assert.assertEquals(DropUniqueConstraintStatement.class, statements[0].getClass());
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:8,代码来源:PerconaAddUniqueConstraintChangeTest.java

示例3: testRollbackSQL

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testRollbackSQL() throws RollbackImpossibleException {
    enableLogging();

    SqlStatement[] statements = generateRollbackStatements();
    Assert.assertEquals(3, statements.length);
    Assert.assertEquals(CommentStatement.class, statements[0].getClass());
    Assert.assertEquals("pt-online-schema-change --alter=\"" + alterRollbackText + "\" "
            + "--alter-foreign-keys-method=auto "
            + "--host=localhost --port=3306 --user=user --password=*** --execute D=testdb,t=person",
            ((CommentStatement)statements[0]).getText());
    Assert.assertEquals(CommentStatement.class, statements[1].getClass());
    Assert.assertEquals(DropUniqueConstraintStatement.class, statements[2].getClass());
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:15,代码来源:PerconaAddUniqueConstraintChangeTest.java

示例4: testWithoutPercona

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testWithoutPercona() {
    PTOnlineSchemaChangeStatement.available = false;
    SqlStatement[] statements = generateStatements();
    Assert.assertEquals(1, statements.length);
    Assert.assertEquals(DropUniqueConstraintStatement.class, statements[0].getClass());
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:8,代码来源:PerconaDropUniqueConstraintChangeTest.java

示例5: testUpdateSQL

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testUpdateSQL() {
    enableLogging();

    SqlStatement[] statements = generateStatements();
    Assert.assertEquals(3, statements.length);
    Assert.assertEquals(CommentStatement.class, statements[0].getClass());
    Assert.assertEquals("pt-online-schema-change --alter=\"" + alterText + "\" "
            + "--alter-foreign-keys-method=auto "
            + "--host=localhost --port=3306 --user=user --password=*** --execute D=testdb,t=person",
            ((CommentStatement)statements[0]).getText());
    Assert.assertEquals(CommentStatement.class, statements[1].getClass());
    Assert.assertEquals(DropUniqueConstraintStatement.class, statements[2].getClass());
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:15,代码来源:PerconaDropUniqueConstraintChangeTest.java

示例6: testSkipDropUniqueConstraintChange

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testSkipDropUniqueConstraintChange() {
    System.setProperty(Configuration.SKIP_CHANGES, "dropUniqueConstraint");
    SqlStatement[] statements = generateStatements();
    Assert.assertEquals(1, statements.length);
    Assert.assertEquals(DropUniqueConstraintStatement.class, statements[0].getClass());
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:8,代码来源:PerconaDropUniqueConstraintChangeTest.java

示例7: generateStatements

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
public SqlStatement[] generateStatements(Database database) {
        
//todo    	if (database instanceof SQLiteDatabase) {
//    		// return special statements for SQLite databases
//    		return generateStatementsForSQLiteDatabase(database);
//        }
    	DropUniqueConstraintStatement statement = new DropUniqueConstraintStatement(getSchemaName() == null?database.getDefaultSchemaName():getSchemaName(), getTableName(), getConstraintName());
    	if (database instanceof SybaseASADatabase) {
    		statement.setUniqueColumns(uniqueColumns);
    	}
    	return new SqlStatement[]{
			statement
        };
    }
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:15,代码来源:DropUniqueConstraintChange.java

示例8: generateSql

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Override
public Sql[] generateSql(DropUniqueConstraintStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    if (!supports(statement, database)) {
        return sqlGeneratorChain.generateSql(statement, database);
    }

    String sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) +
            " DROP CONSTRAINT " + database.escapeConstraintName(statement.getConstraintName());

    return new Sql[] {
            new UnparsedSql(sql, getAffectedUniqueConstraint(statement))
    };
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:14,代码来源:DropUniqueConstraintGeneratorHanaDB.java

示例9: testDropUniqueConstraintNoSchema

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testDropUniqueConstraintNoSchema() {
    Database database = new HanaDBDatabase();
    DropUniqueConstraintStatement statement =
            new DropUniqueConstraintStatement(null, null, "table_name", "constraint_name");

    assertEquals("ALTER TABLE \"table_name\" DROP CONSTRAINT \"constraint_name\"",
            this.generatorUnderTest.generateSql(statement, database, null)[0].toSql());
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:10,代码来源:DropUniqueConstraintGeneratorHanaDBTest.java

示例10: testDropUniqueConstraintWithSchema

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Test
public void testDropUniqueConstraintWithSchema() {
    Database database = new HanaDBDatabase();
    DropUniqueConstraintStatement statement =
            new DropUniqueConstraintStatement(null, "schema_name", "table_name", "constraint_name");

    assertEquals("ALTER TABLE \"schema_name\".\"table_name\" DROP CONSTRAINT \"constraint_name\"",
            this.generatorUnderTest.generateSql(statement, database, null)[0].toSql());
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:10,代码来源:DropUniqueConstraintGeneratorHanaDBTest.java

示例11: supports

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Override
public boolean supports(DropUniqueConstraintStatement statement, Database database) {
    return !(database instanceof SQLiteDatabase);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:5,代码来源:DropUniqueConstraintGenerator.java

示例12: validate

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
public ValidationErrors validate(DropUniqueConstraintStatement dropUniqueConstraintStatement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    ValidationErrors validationErrors = new ValidationErrors();
    validationErrors.checkRequiredField("tableName", dropUniqueConstraintStatement.getTableName());
    return validationErrors;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:6,代码来源:DropUniqueConstraintGenerator.java

示例13: supports

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Override
public boolean supports(DropUniqueConstraintStatement statement, Database database) {
    return database instanceof HanaDBDatabase;
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:5,代码来源:DropUniqueConstraintGeneratorHanaDB.java

示例14: DropUniqueConstraintGeneratorHanaDBTest

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
protected DropUniqueConstraintGeneratorHanaDBTest(SqlGenerator<DropUniqueConstraintStatement> generatorUnderTest) throws Exception {
    super(generatorUnderTest);
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:4,代码来源:DropUniqueConstraintGeneratorHanaDBTest.java

示例15: createSampleSqlStatement

import liquibase.statement.core.DropUniqueConstraintStatement; //导入依赖的package包/类
@Override
protected DropUniqueConstraintStatement createSampleSqlStatement() {
       Database database = new HanaDBDatabase();
       DropUniqueConstraintStatement dropUniqueConstraintStatement = new DropUniqueConstraintStatement(null, null, "table_name", "constraint_name");
       return dropUniqueConstraintStatement;
   }
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:7,代码来源:DropUniqueConstraintGeneratorHanaDBTest.java


注:本文中的liquibase.statement.core.DropUniqueConstraintStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。