Package liquibase.sql

Examples of liquibase.sql.UnparsedSql


            + DataTypeFactory.getInstance().fromDescription(statement.getColumnDataType() + "{autoIncrement:true}", database).toDatabaseDataType(database)
            + " "
            + database.getAutoIncrementClause(statement.getStartWith(), statement.getIncrementBy());

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


        if( database instanceof MySQLDatabase && statement.getRemarks() != null ) {
            sql += " COMMENT '" + statement.getRemarks() +"' ";
        }

        return new Sql[] {
                new UnparsedSql(sql, getAffectedOldColumn(statement), getAffectedNewColumn(statement))
        };
    }
View Full Code Here

        } else {
            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))
        };
    }
View Full Code Here

        List<Sql> sql = new ArrayList<Sql>();

        String procedureText = statement.getProcedureText();

        if (statement.getReplaceIfExists() != null && statement.getReplaceIfExists()) {
            sql.add(new UnparsedSql("if object_id('dbo."+statement.getProcedureName()+"', 'p') is null exec ('create procedure "+database.escapeObjectName(statement.getProcedureName(), StoredProcedure.class)+" as select 1 a')"));

            procedureText = procedureText.replaceFirst("(?i)create\\s+procedure", "ALTER PROCEDURE");
        }

        sql.add(new UnparsedSql(procedureText, statement.getEndDelimiter()));
        return sql.toArray(new Sql[sql.size()]);
    }
View Full Code Here

        String sql = string.toString().replaceFirst(",$", "")+")";

        if (database instanceof OracleDatabase) {
            sql = sql.replaceFirst("exec ", "BEGIN ").replaceFirst("\\)$", "); END;");
        }
        return new Sql[] { new UnparsedSql(sql)};

    }
View Full Code Here

    @Override
    public Sql[] generateSql(GetViewDefinitionStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
        CatalogAndSchema schema = new CatalogAndSchema(statement.getCatalogName(), statement.getSchemaName()).customize(database);

        String sql = "exec sp_helptext '" + schema.getSchemaName() + "."+ statement.getViewName() + "'";
            return new Sql[]{new UnparsedSql(sql) };
    }}
View Full Code Here

        } else {
            sql = "ALTER SEQUENCE " + database.escapeSequenceName(statement.getCatalogName(), statement.getSchemaName(), statement.getOldSequenceName()) + " RENAME TO " + database.escapeObjectName(statement.getNewSequenceName(), Sequence.class);
        }

        return new Sql[]{
                new UnparsedSql(sql,
                        getAffectedOldSequence(statement),
                        getAffectedNewSequence(statement)
                )
        };
    }
View Full Code Here

            }
            sql.append(" ").append(fixedWhereClause);
        }

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

        } else {
            sql = "RENAME " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getOldTableName()) + " TO " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getNewTableName());
        }

        return new Sql[]{
                new UnparsedSql(sql,
                        getAffectedOldTable(statement),
                        getAffectedNewTable(statement)
                )
        };
    }
View Full Code Here

        if ( !insertOrUpdateStatement.getOnlyUpdate() ) {
          completeSql.append(getPostUpdateStatements(database));
        }

        return new Sql[]{
                new UnparsedSql(completeSql.toString(), "", getAffectedTable(insertOrUpdateStatement))
        };
    }
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.