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() + ")");
String whereClause = database.escapeColumnName(liquibaseSchema,
database.getDatabaseChangeLogTableName(), "ID")
+ " = 1 AND ";
if (database instanceof CUBRIDDatabase) {
whereClause = whereClause
+ "( "
+ database.escapeColumnName(liquibaseSchema,
database.getDatabaseChangeLogTableName(),
"LOCKED")
+ " = "
+ TypeConverterFactory.getInstance().findTypeConverter(database).getBooleanType()
.getFalseBooleanValue()
+ " OR "
+ database.escapeColumnName(liquibaseSchema,
database.getDatabaseChangeLogTableName(),
"LOCKED") + " = '0')";
} else {
whereClause = whereClause
+ database.escapeColumnName(liquibaseSchema,
database.getDatabaseChangeLogTableName(),
"LOCKED")
+ " = "
+ TypeConverterFactory.getInstance().findTypeConverter(database).getBooleanType()
.getFalseBooleanValue();
}
updateStatement.setWhereClause(whereClause);
return SqlGeneratorFactory.getInstance().generateSql(updateStatement, database);
}