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,
int priority)
|
Methods inherited from class liquibase.change.AbstractChange |
createInverses, generateCheckSum, generateRollbackStatements, getAffectedDatabaseObjects, getChangeMetaData, getChangeSet, getResourceAccessor, init, requiresUpdatedDatabaseMetadata, setChangeSet, setPriority, setResourceAccessor, supportsRollback, validate, warn |
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,
int priority)
supports
public boolean supports(Database database)
- Specified by:
supports
in interface Change
- Overrides:
supports
in class AbstractChange
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)
generateStatements
public SqlStatement[] generateStatements(Database database)
- 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
String
s with the statements
Copyright © 2010 Liquibase.org. All Rights Reserved.