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


Java CreateIndexStatement.isUnique方法代码示例

本文整理汇总了Java中liquibase.statement.core.CreateIndexStatement.isUnique方法的典型用法代码示例。如果您正苦于以下问题:Java CreateIndexStatement.isUnique方法的具体用法?Java CreateIndexStatement.isUnique怎么用?Java CreateIndexStatement.isUnique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在liquibase.statement.core.CreateIndexStatement的用法示例。


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

示例1: CreateIndexStatementMSSQL

import liquibase.statement.core.CreateIndexStatement; //导入方法依赖的package包/类
public CreateIndexStatementMSSQL(CreateIndexStatement createIndexStatement, String includedColumns, Integer fillFactor) {
  super(createIndexStatement.getIndexName(), createIndexStatement.getTableCatalogName(),
      createIndexStatement.getTableSchemaName(), createIndexStatement.getTableName(),
      createIndexStatement.isUnique(), createIndexStatement.getAssociatedWith(),
      createIndexStatement.getColumns());
  
  if (createIndexStatement.isClustered() != null) {
  	setClustered(createIndexStatement.isClustered());
  }

  this.includedColumns = includedColumns;
  this.fillFactor = fillFactor;
}
 
开发者ID:sabomichal,项目名称:liquibase-mssql,代码行数:14,代码来源:CreateIndexStatementMSSQL.java

示例2: generateSql

import liquibase.statement.core.CreateIndexStatement; //导入方法依赖的package包/类
/**
 * @see liquibase.sqlgenerator.core.CreateIndexGenerator#generateSql(liquibase.statement.core.CreateIndexStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain)
 */
@Override
public Sql[] generateSql(CreateIndexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
	StringBuffer buffer = new StringBuffer();

	buffer.append("CREATE ");
	if (statement.isUnique() != null && statement.isUnique().booleanValue()) {
		buffer.append("UNIQUE ");
	}
	buffer.append("INDEX ");

	if (statement.getIndexName() != null) {
		//String indexSchema = statement.getTableSchemaName();
		buffer.append(database.escapeObjectName(statement.getIndexName(), Index.class)).append(" ");
	}

	buffer.append("(");
	Iterator<AddColumnConfig> iterator = Arrays.asList(statement.getColumns()).iterator();
	while (iterator.hasNext()) {
		AddColumnConfig column = iterator.next();
		buffer.append(database.escapeColumnName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName(), column.getName()));
		if (iterator.hasNext()) {
			buffer.append(", ");
		}
	}
	buffer.append(")");

	buffer.append("ON ");
	buffer.append(database.escapeTableName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName()));

	return new Sql[]{new UnparsedSql(buffer.toString())};
}
 
开发者ID:liquibase,项目名称:liquibase-teradata,代码行数:35,代码来源:CreateIndexGeneratorTeradata.java

示例3: generateSql

import liquibase.statement.core.CreateIndexStatement; //导入方法依赖的package包/类
public Sql[] generateSql(CreateIndexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {

        // Default filter of index creation:
        // creation of all indexes with associations are switched off.
        List<String> associatedWith = StringUtils.splitAndTrim(statement.getAssociatedWith(), ",");
        if (associatedWith != null && (associatedWith.contains(Index.MARK_PRIMARY_KEY) ||
            associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT) ||
            associatedWith.contains(Index.MARK_FOREIGN_KEY))) {
            return new Sql[0];
        }

	    StringBuilder buffer = new StringBuilder();

	    buffer.append("CREATE ");
	    if (statement.isUnique() != null && statement.isUnique()) {
		    buffer.append("UNIQUE ");
	    }
	    buffer.append("INDEX ");

	    if (statement.getIndexName() != null) {
            String indexSchema = statement.getTableSchemaName();
            buffer.append(database.escapeIndexName(null, statement.getIndexName())).append(" ");
	    }
	    buffer.append("ON ");
	    buffer.append(database.escapeTableName(statement.getTableSchemaName(), statement.getTableName())).append("(");
	    Iterator<String> iterator = Arrays.asList(statement.getColumns()).iterator();
	    while (iterator.hasNext()) {
		    String column = iterator.next();
		    buffer.append(database.escapeColumnName(statement.getTableSchemaName(), statement.getTableName(), column));
		    if (iterator.hasNext()) {
			    buffer.append(", ");
		    }
	    }
	    buffer.append(")");

	    if (StringUtils.trimToNull(statement.getTablespace()) != null && database.supportsTablespaces()) {
		    if (database instanceof MSSQLDatabase || database instanceof SybaseASADatabase) {
			    buffer.append(" ON ").append(statement.getTablespace());
		    } else if (database instanceof DB2Database || database instanceof InformixDatabase) {
			    buffer.append(" IN ").append(statement.getTablespace());
		    } else {
			    buffer.append(" TABLESPACE ").append(statement.getTablespace());
		    }
	    }

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

示例4: CreateIndexWithWhereStatement

import liquibase.statement.core.CreateIndexStatement; //导入方法依赖的package包/类
public CreateIndexWithWhereStatement(final CreateIndexStatement statement, final String where) {
	this(statement.getIndexName(), statement.getTableSchemaName(), statement.getTableName(), statement.isUnique(), statement.getAssociatedWith(), statement.getColumns());
	m_where = where;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:5,代码来源:CreateIndexWithWhereStatement.java

示例5: generateSql

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

        // Default filter of index creation:
        // creation of all indexes with associations are switched off.
        List<String> associatedWith = StringUtils.splitAndTrim(statement.getAssociatedWith(), ",");
        if (associatedWith != null && (associatedWith.contains(Index.MARK_PRIMARY_KEY) ||
            associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT) ||
            associatedWith.contains(Index.MARK_FOREIGN_KEY))) {
            return new Sql[0];
        }

	    StringBuilder buffer = new StringBuilder();

	    buffer.append("CREATE ");
	    if (statement.isUnique() != null && statement.isUnique()) {
		    buffer.append("UNIQUE ");
	    }
	    buffer.append("INDEX ");

	    if (statement.getIndexName() != null) {
            String indexSchema = statement.getTableSchemaName();
//            buffer.append(database.escapeIndexName(null, statement.getIndexName())).append(" ");
            buffer.append(database.escapeIndexName(statement.getTableCatalogName(), indexSchema, statement.getIndexName())).append(" ");
	    }
	    buffer.append("ON ");
	    buffer.append(database.escapeTableName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName())).append(" (");
	    Iterator<AddColumnConfig> iterator = Arrays.asList(statement.getColumns()).iterator();
	    while (iterator.hasNext()) {
		    AddColumnConfig column = iterator.next();
		    buffer.append(database.escapeColumnName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName(), column.getName()));
		    if (iterator.hasNext()) {
			    buffer.append(", ");
		    }
	    }
	    buffer.append(")");

//	    return new Sql[]{new UnparsedSql(buffer.toString())};
        return new Sql[]{new UnparsedSql(buffer.toString(), getAffectedIndex(statement))};
    }
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:44,代码来源:CreateIndexGeneratorHanaDB.java


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