Class ParserSqlScript
java.lang.Object
migratedb.v1.core.internal.sqlscript.ParserSqlScript
- All Implemented Interfaces:
Comparable<SqlScript>,SqlScript
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Parserprotected final ResourceThe resource containing the statements.protected final List<SqlStatement>The sql statements contained in this script. -
Constructor Summary
ConstructorsConstructorDescriptionParserSqlScript(Parser parser, Resource resource, Resource metadataResource, boolean mixed) Creates a new sql script from this source. -
Method Summary
-
Field Details
-
sqlStatements
The sql statements contained in this script. -
resource
The resource containing the statements. -
parser
-
-
Constructor Details
-
ParserSqlScript
Creates a new sql script from this source.- Parameters:
resource- The sql script resource.metadataResource- The sql script metadata resource.mixed- Whether to allow mixing transactional and non-transactional statements within the same migration.
-
-
Method Details
-
parse
protected void parse() -
validate
public void validate()Description copied from interface:SqlScriptValidates this SQL script. -
getSqlStatements
- Specified by:
getSqlStatementsin interfaceSqlScript- Returns:
- The sql statements contained in this script.
-
getSqlStatementCount
public int getSqlStatementCount()- Specified by:
getSqlStatementCountin interfaceSqlScript- Returns:
- The number of sql statements contained in this script.
-
getResource
- Specified by:
getResourcein interfaceSqlScript- Returns:
- The resource containing the statements.
-
executeInTransaction
public boolean executeInTransaction()Description copied from interface:SqlScriptWhether the execution should take place inside a transaction. This is useful for databases like PostgreSQL where certain statement can only execute outside a transaction.- Specified by:
executeInTransactionin interfaceSqlScript- Returns:
trueif a transaction should be used (highly recommended), orfalseif not.
-
shouldExecute
public boolean shouldExecute()Description copied from interface:SqlScriptWhether the script should execute or not.- Specified by:
shouldExecutein interfaceSqlScript- Returns:
trueif the script should execute, orfalseif not.
-
compareTo
- Specified by:
compareToin interfaceComparable<SqlScript>
-
toString
-