liquibase.change.core
Class SQLFileChange

java.lang.Object
  extended by liquibase.change.AbstractChange
      extended by liquibase.change.AbstractSQLChange
          extended by liquibase.change.core.SQLFileChange
All Implemented Interfaces:
Change, DbmsTargetedChange, LiquibaseSerializable

public class SQLFileChange
extends AbstractSQLChange

Represents a Change for custom SQL stored in a File.

To create an instance call the constructor as normal and then call

Author:
Paul Keeble

Nested Class Summary
 
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
 
Constructor Summary
SQLFileChange()
           
 
Method Summary
 void finishInitialization()
          Default implementation is a no-op
 String getConfirmationMessage()
          Confirmation message to be displayed after the change is executed.
 String getEncoding()
          The encoding of the file containing SQL statements
 String getPath()
           
 Boolean isRelativeToChangelogFile()
           
 void setEncoding(String encoding)
           
 void setPath(String fileName)
          Sets the file name but setUp must be called for the change to have impact.
 void setRelativeToChangelogFile(Boolean relativeToChangelogFile)
           
 void setSql(String sql)
          Set the raw SQL managed by this Change.
 ValidationErrors validate(Database database)
          Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the SqlGenerator.validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
 Warnings warn(Database database)
          Implementation delegates logic to the SqlGenerator.warn(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
 
Methods inherited from class liquibase.change.AbstractSQLChange
generateCheckSum, generateStatements, getDbms, getEndDelimiter, getSql, isSplitStatements, isStripComments, normalizeLineEndings, prepareSqlForChecksum, setDbms, setEndDelimiter, setSplitStatements, setStripComments, supports
 
Methods inherited from class liquibase.change.AbstractChange
createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, generateRollbackStatements, generateRollbackStatementsVolatile, generateStatementsVolatile, getAffectedDatabaseObjects, getChangeSet, getResourceAccessor, getSerializableFields, getSerializableFieldType, getSerializableFieldValue, getSerializedObjectName, setChangeSet, setResourceAccessor, supportsRollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLFileChange

public SQLFileChange()
Method Detail

getPath

public String getPath()

setPath

public void setPath(String fileName)
Sets the file name but setUp must be called for the change to have impact.

Parameters:
fileName - The file to use

getEncoding

public String getEncoding()
The encoding of the file containing SQL statements

Returns:
the encoding

setEncoding

public void setEncoding(String encoding)
Parameters:
encoding - the encoding to set

isRelativeToChangelogFile

public Boolean isRelativeToChangelogFile()

setRelativeToChangelogFile

public void setRelativeToChangelogFile(Boolean relativeToChangelogFile)

finishInitialization

public void finishInitialization()
                          throws SetupException
Description copied from class: AbstractChange
Default implementation is a no-op

Specified by:
finishInitialization in interface Change
Overrides:
finishInitialization in class AbstractChange
Throws:
SetupException

validate

public ValidationErrors validate(Database database)
Description copied from class: AbstractChange
Implementation checks the ChangeParameterMetaData for declared required fields and also delegates logic to the SqlGenerator.validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). If no or null SqlStatements are returned by generateStatements then this method returns no errors. If there are no parameters than this method returns no errors

Specified by:
validate in interface Change
Overrides:
validate in class AbstractChange

warn

public Warnings warn(Database database)
Description copied from class: AbstractChange
Implementation delegates logic to the SqlGenerator.warn(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). If a generated statement is not supported for the given database, no warning will be added since that is a validation error. If no or null SqlStatements are returned by generateStatements then this method returns no warnings.

Specified by:
warn in interface Change
Overrides:
warn in class AbstractChange

getConfirmationMessage

public String getConfirmationMessage()
Description copied from interface: Change
Confirmation message to be displayed after the change is executed. Should include relevant configuration settings to make it as helpful as possible. This method may be called outside the changelog execution process, such as in documentation generation.


setSql

public void setSql(String sql)
Description copied from class: AbstractSQLChange
Set the raw SQL managed by this Change. The passed sql is trimmed and set to null if an empty string is passed.

Overrides:
setSql in class AbstractSQLChange


Copyright © 2013 Liquibase.org. All Rights Reserved.