Package liquibase.sql

Examples of liquibase.sql.UnparsedSql


        }
        if (database instanceof DerbyDatabase) {
            sql += " RESTRICT";
        }
        return new Sql[] {
                new UnparsedSql(sql, getAffectedSequence(statement))
        };
    }
View Full Code Here


    final String sqlTemplate = "ALTER TABLE %s ADD CONSTRAINT %s UNIQUE (%s)";
    final String sqlNoContraintNameTemplate = "ALTER TABLE %s ADD UNIQUE (%s)";
   
    if (statement.getConstraintName() == null) {
      return new Sql[] {
        new UnparsedSql(String.format(sqlNoContraintNameTemplate
            , database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName())
            , database.escapeColumnNameList(statement.getColumnNames())
        ), getAffectedUniqueConstraint(statement))
      };
    } else {
      return new Sql[] {
        new UnparsedSql(String.format(sqlTemplate
            , database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName())
            , database.escapeConstraintName(statement.getConstraintName())
            , database.escapeColumnNameList(statement.getColumnNames())
        ), getAffectedUniqueConstraint(statement))
      };
View Full Code Here

        sb.append("AND BASE.TABLE_NAME =  '").append(statement.getBaseTableName().toUpperCase()).append("' ");
        sb.append("AND BASE.CONSTRAINT_TYPE = 'R' ");
        sb.append("AND BASE.OWNER = '").append(baseTableSchema.getSchemaName()).append("'");

        return new Sql[]{
                new UnparsedSql(sb.toString())
        };
    }
View Full Code Here

            }
            sql.append(" FROM `").append(statement.getSourceTable()).append("`");
        }

        return new Sql[]{
                new UnparsedSql(sql.toString(), getAffectedTable(statement))
        };
    }
View Full Code Here

                fixedWhereClause = fixedWhereClause.replaceFirst("\\?|:value", DataTypeFactory.getInstance().fromObject(param, database).objectToSql(param, database).replaceAll("\\$", "\\$"));
            }
            sql.append(" ").append(fixedWhereClause);
        }

        return new Sql[]{new UnparsedSql(sql.toString(), getAffectedTable(statement))};
    }
View Full Code Here

        sb.append("INNER JOIN sys.foreign_key_columns AS fc ");
        sb.append("ON f.OBJECT_ID = fc.constraint_object_id ");
        sb.append("WHERE OBJECT_NAME(f.parent_object_id) = '").append(statement.getBaseTableName()).append("'");

        return new Sql[]{
                new UnparsedSql(sb.toString())
        };
    }
View Full Code Here

    public Sql[] generateSql(
        AddAutoIncrementStatement statement,
        Database database,
        SqlGeneratorChain sqlGeneratorChain) {
        return new Sql[]{
            new UnparsedSql(
              "ALTER TABLE "
                + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName())
                + " ALTER COLUMN "
                + database.escapeColumnName(
                        statement.getCatalogName(),
View Full Code Here

TOP

Related Classes of liquibase.sql.UnparsedSql

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.