liquibase.change
Class AbstractSQLChange
java.lang.Object
liquibase.change.AbstractChange
liquibase.change.AbstractSQLChange
- All Implemented Interfaces:
- Change
- Direct Known Subclasses:
- RawSQLChange, SQLFileChange
public abstract class AbstractSQLChange
- extends AbstractChange
A common parent for all SQL related changes regardless of where the sql was sourced from.
Implements the necessary logic to choose how it should be parsed to generate the statements.
- Author:
- Paul Keeble
|
Constructor Summary |
protected |
AbstractSQLChange(java.lang.String tagName,
java.lang.String changeName)
|
| Methods inherited from class liquibase.change.AbstractChange |
canRollBack, createInverses, executeRollbackStatements, executeStatements, generateRollbackStatements, getChangeName, getChangeSet, getFileOpener, getMD5Sum, getTagName, saveRollbackStatement, saveStatements, setChangeSet, setFileOpener, setUp |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractSQLChange
protected AbstractSQLChange(java.lang.String tagName,
java.lang.String changeName)
setStripComments
public void setStripComments(java.lang.Boolean stripComments)
- Parameters:
stripComments - true if comments should be stripped out, otherwise false
isStrippingComments
public boolean isStrippingComments()
- Returns:
- true if stripping comments, otherwise false
setSplitStatements
public void setSplitStatements(java.lang.Boolean splitStatements)
- If set to true then the sql will be split around any ; and \ngo\n entries in the sql and
each line provided as a separate statement.
- Parameters:
splitStatements - set true if the SQL should be split, otherwise false
isSplittingStatements
public boolean isSplittingStatements()
- Returns:
- true if a multi-line file will be split, otherwise false
getSql
public java.lang.String getSql()
setSql
public void setSql(java.lang.String sql)
- The raw SQL to use for this change.
getEndDelimiter
public java.lang.String getEndDelimiter()
setEndDelimiter
public void setEndDelimiter(java.lang.String endDelimiter)
validate
public void validate(Database database)
throws InvalidChangeDefinitionException
- Throws:
InvalidChangeDefinitionException
generateStatements
public SqlStatement[] generateStatements(Database database)
throws UnsupportedChangeException
- Generates one or more statements depending on how the SQL should be parsed.
If split statements is set to true then the SQL is split on the ; and go\n entries
found in the sql text and each is made a separate statement.
If stripping comments is true then any comments after -- on a line and any comments
between /* and \*\/ will be stripped before the splitting is executed.
The end result is one or more SQL statements split in the way the user requested
- Parameters:
database - databasethe target Database associated to this change's statements
- Returns:
- an array of
Strings with the statements
- Throws:
UnsupportedChangeException - if this change is not supported by the Database passed as argument