com.googlecode.flyway.core.dbsupport.mysql
Class MySQLSqlScript

java.lang.Object
  extended by com.googlecode.flyway.core.migration.sql.SqlScript
      extended by com.googlecode.flyway.core.dbsupport.mysql.MySQLSqlScript

public class MySQLSqlScript
extends SqlScript

SqlScript supporting MySQL-specific delimiter changes.


Field Summary
 
Fields inherited from class com.googlecode.flyway.core.migration.sql.SqlScript
DEFAULT_STATEMENT_DELIMITER
 
Constructor Summary
MySQLSqlScript(java.lang.String sqlScriptSource, PlaceholderReplacer placeholderReplacer)
          Creates a new sql script from this source with these placeholders to replace.
 
Method Summary
protected  java.lang.String changeDelimiterIfNecessary(java.lang.String statement, java.lang.String line, java.lang.String delimiter)
          Checks whether this line in the sql script indicates that the statement delimiter will be different from the current one.
protected  boolean isCommentDirective(java.lang.String line)
          Checks whether this line is in fact a directive disguised as a comment.
protected  boolean isDelimiterChangeExplicit()
           
 
Methods inherited from class com.googlecode.flyway.core.migration.sql.SqlScript
execute, getSqlStatements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQLSqlScript

public MySQLSqlScript(java.lang.String sqlScriptSource,
                      PlaceholderReplacer placeholderReplacer)
Creates a new sql script from this source with these placeholders to replace.

Parameters:
sqlScriptSource - The sql script as a text block with all placeholders still present.
placeholderReplacer - The placeholder replacer to apply to sql migration scripts.
Throws:
java.lang.IllegalStateException - Thrown when the script could not be read from this resource.
Method Detail

changeDelimiterIfNecessary

protected java.lang.String changeDelimiterIfNecessary(java.lang.String statement,
                                                      java.lang.String line,
                                                      java.lang.String delimiter)
Description copied from class: SqlScript
Checks whether this line in the sql script indicates that the statement delimiter will be different from the current one. Useful for database-specific stored procedures and block constructs.

Overrides:
changeDelimiterIfNecessary in class SqlScript
Parameters:
statement - The statement assembled so far, reduced to a single line with all linebreaks replaced by spaces.
line - The line to analyse.
delimiter - The current delimiter.
Returns:
The new delimiter to use (can be the same as the current one) or null for no delimiter.

isDelimiterChangeExplicit

protected boolean isDelimiterChangeExplicit()
Overrides:
isDelimiterChangeExplicit in class SqlScript
Returns:
true if this database uses an explicit delimiter change statement. false if a delimiter change is implied by certain statements.

isCommentDirective

protected boolean isCommentDirective(java.lang.String line)
Description copied from class: SqlScript
Checks whether this line is in fact a directive disguised as a comment.

Overrides:
isCommentDirective in class SqlScript
Parameters:
line - The line to analyse.
Returns:
true if it is a directive that should be processed by the database, false if not.


Copyright © 2011. All Rights Reserved.