Interface SqlStatement
- All Known Implementing Classes:
ParsedSqlStatement,PostgreSQLCopyParsedStatement
public interface SqlStatement
A sql statement from a script that can be executed at once against a database.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the execution should take place inside a transaction.execute(JdbcTemplate jdbcTemplate) Executes this statement against the database.intgetSql()
-
Method Details
-
getLineNumber
int getLineNumber()- Returns:
- The original line number where the statement was located in the script it came from.
-
getSql
String getSql()- Returns:
- The sql to send to the database.
-
getDelimiter
String getDelimiter()- Returns:
- The delimiter for the statement.
-
canExecuteInTransaction
boolean canExecuteInTransaction()Whether the execution should take place inside a transaction. Almost all implementation should returntrue. This however makes it possible to execute certain migrations outside a transaction. This is useful for databases like PostgreSQL and SQL Server where certain statement can only execute outside a transaction.- Returns:
trueif a transaction should be used (highly recommended), orfalseif not.
-
execute
Executes this statement against the database.- Parameters:
jdbcTemplate- The jdbcTemplate to use to execute this script.- Returns:
- the result of the execution.
-