本文整理汇总了Java中liquibase.sqlgenerator.SqlGeneratorFactory类的典型用法代码示例。如果您正苦于以下问题:Java SqlGeneratorFactory类的具体用法?Java SqlGeneratorFactory怎么用?Java SqlGeneratorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlGeneratorFactory类属于liquibase.sqlgenerator包,在下文中一共展示了SqlGeneratorFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(CreateDatabaseChangeLogTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
TypeConverter typeConverter = TypeConverterFactory.getInstance().findTypeConverter(database);
CreateTableStatement createTableStatement = new CreateTableStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())
.addPrimaryKeyColumn("ID", typeConverter.getDataType("VARCHAR("+getIdColumnSize()+")", false), null, null, null,new NotNullConstraint())
.addPrimaryKeyColumn("AUTHOR", typeConverter.getDataType("VARCHAR("+getAuthorColumnSize()+")", false), null, null, null,new NotNullConstraint())
.addPrimaryKeyColumn("FILENAME", typeConverter.getDataType("VARCHAR("+getFilenameColumnSize()+")", false), null, null, null,new NotNullConstraint())
.addColumn("DATEEXECUTED", typeConverter.getDateTimeType(), null, new NotNullConstraint())
.addColumn("ORDEREXECUTED", typeConverter.getDataType("INT", false), new NotNullConstraint())
.addColumn("EXECTYPE", typeConverter.getDataType("VARCHAR(10)", false), new NotNullConstraint())
.addColumn("MD5SUM", typeConverter.getDataType("VARCHAR(35)", false))
.addColumn("DESCRIPTION", typeConverter.getDataType("VARCHAR(255)", false))
.addColumn("COMMENTS", typeConverter.getDataType("VARCHAR(255)", false))
.addColumn("TAG", typeConverter.getDataType("VARCHAR(255)", false))
.addColumn("LIQUIBASE", typeConverter.getDataType("VARCHAR(20)", false));
return SqlGeneratorFactory.getInstance().generateSql(createTableStatement, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:CreateDatabaseChangeLogTableGenerator.java
示例2: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(CreateDatabaseChangeLogLockTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
CreateTableStatement createTableStatement = new CreateTableStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogLockTableName())
.addPrimaryKeyColumn("ID", TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("INT", false), null, null, null, new NotNullConstraint())
.addColumn("LOCKED", TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("BOOLEAN", false), null, new NotNullConstraint())
.addColumn("LOCKGRANTED", TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("DATETIME", false))
.addColumn("LOCKEDBY", TypeConverterFactory.getInstance().findTypeConverter(database).getDataType("VARCHAR(255)", false));
InsertStatement insertStatement = new InsertStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogLockTableName())
.addColumnValue("ID", 1)
.addColumnValue("LOCKED", Boolean.FALSE);
List<Sql> sql = new ArrayList<Sql>();
sql.addAll(Arrays.asList(SqlGeneratorFactory.getInstance().generateSql(createTableStatement, database)));
sql.addAll(Arrays.asList(SqlGeneratorFactory.getInstance().generateSql(insertStatement, database)));
return sql.toArray(new Sql[sql.size()]);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:CreateDatabaseChangeLogLockTableGenerator.java
示例3: addForeignKeyStatements
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
protected void addForeignKeyStatements(AddColumnStatement statement, Database database, List<Sql> returnSql) {
for (ColumnConstraint constraint : statement.getConstraints()) {
if (constraint instanceof ForeignKeyConstraint) {
ForeignKeyConstraint fkConstraint = (ForeignKeyConstraint) constraint;
Matcher referencesMatcher = Pattern.compile("([\\w\\._]+)\\(([\\w_]+)\\)").matcher(fkConstraint.getReferences());
if (!referencesMatcher.matches()) {
throw new UnexpectedLiquibaseException("Don't know how to find table and column names from " + fkConstraint.getReferences());
}
String refSchemaName = null;
String refTableName = referencesMatcher.group(1);
if (refTableName.indexOf(".") > 0) {
refSchemaName = refTableName.split("\\.")[0];
refTableName = refTableName.split("\\.")[1];
}
String refColName = referencesMatcher.group(2);
AddForeignKeyConstraintStatement addForeignKeyConstraintStatement = new AddForeignKeyConstraintStatement(fkConstraint.getForeignKeyName(), statement.getSchemaName(), statement.getTableName(), statement.getColumnName(), refSchemaName, refTableName, refColName);
returnSql.addAll(Arrays.asList(SqlGeneratorFactory.getInstance().generateSql(addForeignKeyConstraintStatement, database)));
}
}
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:22,代码来源:AddColumnGenerator.java
示例4: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseSchema = null;
liquibaseSchema = database.getLiquibaseSchemaName();
InetAddress localHost;
try {
localHost = NetUtil.getLocalHost();
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
UpdateStatement updateStatement = new UpdateStatement(liquibaseSchema, database.getDatabaseChangeLogLockTableName());
updateStatement.addNewColumnValue("LOCKED", true);
updateStatement.addNewColumnValue("LOCKGRANTED", new Timestamp(new java.util.Date().getTime()));
updateStatement.addNewColumnValue("LOCKEDBY", localHost.getHostName() + " (" + localHost.getHostAddress() + ")");
updateStatement.setWhereClause(database.escapeColumnName(liquibaseSchema, database.getDatabaseChangeLogTableName(), "ID") + " = 1 AND " + database.escapeColumnName(liquibaseSchema, database.getDatabaseChangeLogTableName(), "LOCKED") + " = "+ TypeConverterFactory.getInstance().findTypeConverter(database).getBooleanType().getFalseBooleanValue());
return SqlGeneratorFactory.getInstance().generateSql(updateStatement, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:21,代码来源:LockDatabaseChangeLogGenerator.java
示例5: validate
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public ValidationErrors validate(Database database) {
ValidationErrors changeValidationErrors = new ValidationErrors();
for (SqlStatement statement : generateStatements(database)) {
boolean supported = SqlGeneratorFactory.getInstance().supports(statement, database);
if (!supported) {
if (statement.skipOnUnsupported()) {
LogFactory.getLogger().info(getChangeMetaData().getName()+" is not supported on "+database.getTypeName()+" but will continue");
} else {
changeValidationErrors.addError(getChangeMetaData().getName()+" is not supported on "+database.getTypeName());
}
} else {
changeValidationErrors.addAll(SqlGeneratorFactory.getInstance().validate(statement, database));
}
}
return changeValidationErrors;
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:AbstractChange.java
示例6: applyVisitors
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
protected String[] applyVisitors(SqlStatement statement, List<SqlVisitor> sqlVisitors) throws DatabaseException {
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, database);
if (sql == null) {
return new String[0];
}
String[] returnSql = new String[sql.length];
for (int i=0; i<sql.length; i++) {
if (sql[i] == null) {
continue;
}
returnSql[i] = sql[i].toSql();
for (SqlVisitor visitor : sqlVisitors) {
returnSql[i] = visitor.modifySql(returnSql[i], database);
}
}
return returnSql;
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:20,代码来源:AbstractExecutor.java
示例7: integrates
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Test
public void integrates() {
final AddColumnConfig firstColumnConfig = new AddColumnConfig();
firstColumnConfig.setName("id");
final AddColumnConfig secondColumnConfig = new AddColumnConfig();
secondColumnConfig.setName("name");
CreateIndexStatement statement = new CreateIndexStatement(null, null, null, "TABLE_NAME", true, null, firstColumnConfig, secondColumnConfig);
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("CREATE UNIQUE INDEX ON [TABLE_NAME]([id], [name])", sql[0].toSql());
statement = new CreateIndexStatementMSSQL(statement, "included, includedtoo", null);
sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("CREATE UNIQUE INDEX ON [TABLE_NAME]([id], [name]) INCLUDE ([included], [includedtoo])", sql[0].toSql());
statement = new CreateIndexStatementMSSQL(statement, null, 50);
sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("CREATE UNIQUE INDEX ON [TABLE_NAME]([id], [name]) WITH (FILLFACTOR = 50)", sql[0].toSql());
statement = new CreateIndexStatementMSSQL(statement, "included, includedtoo", 50);
sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("CREATE UNIQUE INDEX ON [TABLE_NAME]([id], [name]) INCLUDE ([included], [includedtoo]) WITH (FILLFACTOR = 50)", sql[0].toSql());
}
开发者ID:sabomichal,项目名称:liquibase-mssql,代码行数:24,代码来源:IndexGeneratorTest.java
示例8: integrates
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Test
public void integrates() {
AddPrimaryKeyStatement statement = new AddPrimaryKeyStatement("myCat", "mySchema", "myTable", "myCol", "myConstraint");
statement.setClustered(true);
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("ALTER TABLE [mySchema].[myTable] ADD CONSTRAINT [myConstraint] PRIMARY KEY ([myCol])", sql[0].toSql());
statement = new AddPrimaryKeyStatementMSSQL(statement, null);
sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("ALTER TABLE [mySchema].[myTable] ADD CONSTRAINT [myConstraint] PRIMARY KEY ([myCol])", sql[0].toSql());
statement = new AddPrimaryKeyStatementMSSQL(statement, 50);
sql = SqlGeneratorFactory.getInstance().generateSql(statement, new MSSQLDatabase());
assertEquals("ALTER TABLE [mySchema].[myTable] ADD CONSTRAINT [myConstraint] PRIMARY KEY ([myCol]) WITH (FILLFACTOR = 50)", sql[0].toSql());
}
开发者ID:sabomichal,项目名称:liquibase-mssql,代码行数:17,代码来源:PrimaryKeyGeneratorTest.java
示例9: parseAndGenerate
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
if (connection == null) {
return;
}
Database database = liquiBase.getDatabase();
ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();
ChangeLogParameters changeLogParameters = new ChangeLogParameters();
DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
changeLogParameters, resourceAccessor);
liquiBase.checkLiquibaseTables(false, changeLog, new Contexts(), new LabelExpression());
changeLog.validate(database);
List<ChangeSet> changeSets = changeLog.getChangeSets();
Change change = changeSets.get(0).getChanges().get(0);
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
String expected = "DROP SYNONYM new_synonym";
assertEquals(expected, sql[0].toSql());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:25,代码来源:DropSynonymTest.java
示例10: parseAndGenerate
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
if (connection == null) {
return;
}
Database database = liquiBase.getDatabase();
ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();
ChangeLogParameters changeLogParameters = new ChangeLogParameters();
DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile,
changeLogParameters, resourceAccessor);
liquiBase.checkLiquibaseTables(false, changeLog, new Contexts(), new LabelExpression());
changeLog.validate(database);
List<ChangeSet> changeSets = changeLog.getChangeSets();
Change change = changeSets.get(0).getChanges().get(0);
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql(change.generateStatements(database)[0], database);
String expected = "CREATE SYNONYM new_synonym FOR object";
assertEquals(expected, sql[0].toSql());
}
开发者ID:liquibase,项目名称:liquibase-oracle,代码行数:25,代码来源:CreateSynonymTest.java
示例11: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Override
public Sql[] generateSql(MarkChangeSetRanStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ChangeSet changeSet = statement.getChangeSet();
SqlStatement runStatement;
try {
if (statement.getExecType().equals(ChangeSet.ExecType.FAILED) || statement.getExecType().equals(ChangeSet.ExecType.SKIPPED)) {
return new Sql[0]; //don't mark
}
String tag = null;
for (Change change : changeSet.getChanges()) {
if (change instanceof TagDatabaseChange) {
TagDatabaseChange tagChange = (TagDatabaseChange) change;
tag = tagChange.getTag();
}
}
runStatement = new HiveInsertStatement(database.getLiquibaseCatalogName(), database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())
.addColumnValue(changeSet.getId())
.addColumnValue(changeSet.getAuthor())
.addColumnValue(changeSet.getFilePath())
.addColumnValue(DateTimeUtils.getCurrentTS("yyyy-MM-dd HH:mm:ss"))
.addColumnValue(ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).getNextSequenceValue())
.addColumnValue(statement.getExecType().value)
.addColumnValue(changeSet.generateCheckSum().toString())
.addColumnValue(changeSet.getDescription())
.addColumnValue(StringUtils.trimToEmpty(changeSet.getComments()))
.addColumnValue(tag == null ? "NULL" : tag)
.addColumnValue(ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).getDeploymentId())
.addColumnValue(changeSet.getContexts() == null || changeSet.getContexts().isEmpty() ? null : changeSet.getContexts().toString())
.addColumnValue(changeSet.getLabels() == null || changeSet.getLabels().isEmpty() ? null : changeSet.getLabels().toString())
.addColumnValue(LiquibaseUtil.getBuildVersion());
} catch (LiquibaseException e) {
throw new UnexpectedLiquibaseException(e);
}
return SqlGeneratorFactory.getInstance().generateSql(runStatement, database);
}
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:40,代码来源:HiveMarkChangeSetRanGenerator.java
示例12: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public static Sql[] generateSql(Database database, List<SqlStatement> statements) {
List<Sql> sqls = new ArrayList<Sql>();
SqlGeneratorFactory generatorFactory = SqlGeneratorFactory.getInstance();
for (SqlStatement statement : statements) {
sqls.addAll(Arrays.asList(generatorFactory.generateSql(statement, database)));
}
return sqls.toArray(new Sql[sqls.size()]);
}
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:9,代码来源:CustomSqlGenerator.java
示例13: suppressSqlStatement
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
private void suppressSqlStatement(final SqlStatement sql, final List<SqlVisitor> sqlVisitors) throws DatabaseException
{
if (SqlGeneratorFactory.getInstance().generateStatementsVolatile(sql, database))
{
throw new DatabaseException(sql.getClass().getSimpleName() + " requires access to up to date database metadata which is not available when you suppress SQL execution");
}
for (String statement : applyVisitors(sql, sqlVisitors))
{
if (statement == null)
{
continue;
}
if (database instanceof MSSQLDatabase || database instanceof SybaseDatabase || database instanceof SybaseASADatabase)
{
comment("Suppressed: " + statement);
comment("Suppressed: GO");
}
else
{
final String endDelimiter = sql instanceof RawSqlStatement ? ((RawSqlStatement) sql).getEndDelimiter() : ";";
if (!statement.endsWith(endDelimiter))
{
statement += endDelimiter;
}
comment("Suppressed: " + statement);
}
}
}
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:32,代码来源:SuppressOutputExecutor.java
示例14: init
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Override
public void init() {
if(configuration.getBoolean(DatabaseModule.LIQUIBASE_ENABLED, true)) {
logger.debug("Registering Google Cloud SQL");
DatabaseFactory.getInstance().register(new GoogleCloudSQLDatabase());
logger.debug("Registering GoogleCloudSQLLockDatabaseChangeLogGenerator");
SqlGeneratorFactory.getInstance().register(
new GoogleCloudSQLLockDatabaseChangeLogGenerator());
}
databasePlatformsRegistry.addDatabasePlatform(new GoogleCloudSQLDatabasePlatform());
status = ModuleStatus.ACTIVE;
}
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:13,代码来源:GooglecloudsqlModule.java
示例15: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(LockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseCatalog = database.getLiquibaseCatalogName();
String liquibaseSchema = database.getLiquibaseSchemaName();
UpdateStatement updateStatement = new UpdateStatement(liquibaseCatalog, liquibaseSchema, database.getDatabaseChangeLogLockTableName());
updateStatement.addNewColumnValue("locked", true);
updateStatement.addNewColumnValue("lockgranted", new Timestamp(new java.util.Date().getTime()));
updateStatement.addNewColumnValue("lockedby", "Google Cloud SQL");
updateStatement.setWhereClause(database.escapeColumnName(liquibaseCatalog, liquibaseSchema, database.getDatabaseChangeLogTableName(), "ID") + " = 1 AND " + database.escapeColumnName(liquibaseCatalog, liquibaseSchema, database.getDatabaseChangeLogTableName(), "LOCKED") + " = "+ DataTypeFactory.getInstance().fromDescription("boolean", database).objectToSql(false, database));
return SqlGeneratorFactory.getInstance().generateSql(updateStatement, database);
}
开发者ID:ManyDesigns,项目名称:Portofino,代码行数:14,代码来源:GoogleCloudSQLLockDatabaseChangeLogGenerator.java
示例16: parseAndGenerate
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
@Test
public void parseAndGenerate() throws Exception {
Database database = liquiBase.getDatabase();
ResourceAccessor resourceAccessor = new ClassLoaderResourceAccessor();
ChangeLogParameters changeLogParameters = new ChangeLogParameters();
DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser( changeLogFile, resourceAccessor ).parse( changeLogFile, changeLogParameters, resourceAccessor );
liquiBase.checkLiquibaseTables( true, changeLog, new Contexts() );
changeLog.validate( database );
List<ChangeSet> changeSets = changeLog.getChangeSets();
List<String> expectedQuery = new ArrayList<String>();
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview1 AS select 1 as One from dual", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview2 AS select * from mytable", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview2 AS select * from mytable where rownum = 1", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview4 AS select 1 as One from dual", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview3 AS select * from mytable", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "CREATE OR REPLACE VIEW %s.myview3 AS select * from mytable where one like '%%'", database.getLiquibaseSchemaName() ) );
expectedQuery.add( String.format( "Drop materialized view myview2" ) );
int i = 0;
for ( ChangeSet changeSet : changeSets ) {
for ( Change change : changeSet.getChanges() ) {
Sql[] sql = SqlGeneratorFactory.getInstance().generateSql( change.generateStatements( database )[0], database );
if ( change instanceof CreateFlexibleViewChange ) {
for ( Sql s : sql ) {
System.out.println( "--------------------------------------------------------------------------------------------------------" );
System.out.println( "ACTUAL: " + s.toSql() );
System.out.println( "EXPECT: " + expectedQuery.get( i ) );
assertEquals( expectedQuery.get( i ), s.toSql() );
i++;
}
}
}
}
}
开发者ID:mrswadge,项目名称:liquibase-flexibleview,代码行数:41,代码来源:CreateFlexibleViewTest.java
示例17: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(TagDatabaseStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseSchema = null;
liquibaseSchema = database.getLiquibaseSchemaName();
UpdateStatement updateStatement = new UpdateStatement(liquibaseSchema, database.getDatabaseChangeLogTableName());
updateStatement.addNewColumnValue("TAG", statement.getTag());
if (database instanceof MySQLDatabase) {
try {
long version = Long.parseLong(database.getDatabaseProductVersion().substring(0, 1));
if (version < 5) {
return new Sql[]{
new UnparsedSql("UPDATE "+database.escapeTableName(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())+" C LEFT JOIN (SELECT MAX(DATEEXECUTED) as MAXDATE FROM (SELECT DATEEXECUTED FROM `DATABASECHANGELOG`) AS X) D ON C.DATEEXECUTED = D.MAXDATE SET C.TAG = '" + statement.getTag() + "' WHERE D.MAXDATE IS NOT NULL")
};
}
} catch (Throwable e) {
; //assume it is version 5
}
updateStatement.setWhereClause("DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM (SELECT DATEEXECUTED FROM " + database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogTableName()) + ") AS X)");
} else if (database instanceof InformixDatabase) {
return new Sql[]{
new UnparsedSql("SELECT MAX(dateexecuted) max_date FROM " + database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogTableName()) + " INTO TEMP max_date_temp WITH NO LOG"),
new UnparsedSql("UPDATE "+database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogTableName())+" SET TAG = '"+statement.getTag()+"' WHERE DATEEXECUTED = (SELECT max_date FROM max_date_temp);"),
new UnparsedSql("DROP TABLE max_date_temp;")
};
} else {
updateStatement.setWhereClause("DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM " + database.escapeTableName(liquibaseSchema, database.getDatabaseChangeLogTableName()) + ")");
}
return SqlGeneratorFactory.getInstance().generateSql(updateStatement, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:33,代码来源:TagDatabaseGenerator.java
示例18: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(UnlockDatabaseChangeLogStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String liquibaseSchema = database.getLiquibaseSchemaName();
UpdateStatement releaseStatement = new UpdateStatement(liquibaseSchema, database.getDatabaseChangeLogLockTableName());
releaseStatement.addNewColumnValue("LOCKED", false);
releaseStatement.addNewColumnValue("LOCKGRANTED", null);
releaseStatement.addNewColumnValue("LOCKEDBY", null);
releaseStatement.setWhereClause(database.escapeColumnName(liquibaseSchema, database.getDatabaseChangeLogTableName(), "ID")+" = 1");
return SqlGeneratorFactory.getInstance().generateSql(releaseStatement, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:12,代码来源:UnlockDatabaseChangeLogGenerator.java
示例19: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(UpdateChangeSetChecksumStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ChangeSet changeSet = statement.getChangeSet();
SqlStatement runStatement = null;
runStatement = new UpdateStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())
.addNewColumnValue("MD5SUM", changeSet.generateCheckSum().toString())
.setWhereClause("ID=? AND AUTHOR=? AND FILENAME=?")
.addWhereParameters(changeSet.getId(), changeSet.getAuthor(), changeSet.getFilePath());
return SqlGeneratorFactory.getInstance().generateSql(runStatement, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:12,代码来源:UpdateChangeSetChecksumGenerator.java
示例20: generateSql
import liquibase.sqlgenerator.SqlGeneratorFactory; //导入依赖的package包/类
public Sql[] generateSql(RemoveChangeSetRanStatusStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
ChangeSet changeSet = statement.getChangeSet();
return SqlGeneratorFactory.getInstance().generateSql(new DeleteStatement(database.getLiquibaseSchemaName(), database.getDatabaseChangeLogTableName())
.setWhereClause("ID=? AND AUTHOR=? AND FILENAME=?")
.addWhereParameters(changeSet.getId(), changeSet.getAuthor(), changeSet.getFilePath())
, database);
}
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:9,代码来源:RemoveChangeSetRanStatusGenerator.java
注:本文中的liquibase.sqlgenerator.SqlGeneratorFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论