Package liquibase.command.core
Class ExecuteSqlCommandStep
- java.lang.Object
-
- liquibase.command.AbstractCommandStep
-
- liquibase.command.core.ExecuteSqlCommandStep
-
- All Implemented Interfaces:
CommandStep
public class ExecuteSqlCommandStep extends AbstractCommandStep
-
-
Field Summary
Fields Modifier and Type Field Description static String[]
COMMAND_NAME
static CommandArgumentDefinition<String>
DELIMITER_ARG
static CommandArgumentDefinition<String>
SQL_ARG
static CommandArgumentDefinition<String>
SQLFILE_ARG
-
Fields inherited from class liquibase.command.AbstractCommandStep
coreBundle
-
Fields inherited from interface liquibase.command.CommandStep
ORDER_DEFAULT, ORDER_NOT_APPLICABLE
-
-
Constructor Summary
Constructors Constructor Description ExecuteSqlCommandStep()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adjustCommandDefinition(CommandDefinition commandDefinition)
Default implementation makes no changesString[][]
defineCommandNames()
Defines new command names For example, if it is part of `liquibase update`, this should return new String[][]{ new String[] {"update"}}.protected static String
determineEndDelimiter(CommandScope commandScope)
protected String
getSqlScript(String sql, String sqlFile)
protected void
handleOutput(CommandResultsBuilder resultsBuilder, String output)
List<Class<?>>
requiredDependencies()
Return a list of configured Classes that this command requires to be passed as a dependency.void
run(CommandResultsBuilder resultsBuilder)
Performs the business logic.-
Methods inherited from class liquibase.command.AbstractCommandStep
getOrder, providedDependencies, validate
-
-
-
-
Field Detail
-
COMMAND_NAME
public static final String[] COMMAND_NAME
-
SQL_ARG
public static final CommandArgumentDefinition<String> SQL_ARG
-
SQLFILE_ARG
public static final CommandArgumentDefinition<String> SQLFILE_ARG
-
DELIMITER_ARG
public static final CommandArgumentDefinition<String> DELIMITER_ARG
-
-
Method Detail
-
defineCommandNames
public String[][] defineCommandNames()
Description copied from interface:CommandStep
Defines new command names For example, if it is part of `liquibase update`, this should return new String[][]{ new String[] {"update"}}. If it is a part of `liquibase example init`, this should return {"example", "init"}.This is used to determine the available command names.
This can return null if this step is not defining a new command but "cross-cutting" existing commands
-
adjustCommandDefinition
public void adjustCommandDefinition(CommandDefinition commandDefinition)
Description copied from class:AbstractCommandStep
Default implementation makes no changes- Specified by:
adjustCommandDefinition
in interfaceCommandStep
- Overrides:
adjustCommandDefinition
in classAbstractCommandStep
-
requiredDependencies
public List<Class<?>> requiredDependencies()
Description copied from interface:CommandStep
Return a list of configured Classes that this command requires to be passed as a dependency.- Specified by:
requiredDependencies
in interfaceCommandStep
- Overrides:
requiredDependencies
in classAbstractCommandStep
- Returns:
- list with the required classes types
-
run
public void run(CommandResultsBuilder resultsBuilder) throws Exception
Description copied from interface:CommandStep
Performs the business logic. This method should not be called directly. It is called by the overall pipeline logic in theCommandScope.execute()
order.- Throws:
Exception
-
determineEndDelimiter
protected static String determineEndDelimiter(CommandScope commandScope)
-
handleOutput
protected void handleOutput(CommandResultsBuilder resultsBuilder, String output) throws IOException
- Throws:
IOException
-
getSqlScript
protected String getSqlScript(String sql, String sqlFile) throws IOException, LiquibaseException
- Throws:
IOException
LiquibaseException
-
-