Interface SqlStatement
-
- All Known Implementing Classes:
ParsedSqlStatement,PostgreSQLCopyParsedStatement
public interface SqlStatementA sql statement from a script that can be executed at once against a database.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanExecuteInTransaction()Whether the execution should take place inside a transaction.Resultsexecute(JdbcTemplate jdbcTemplate)Executes this statement against the database.StringgetDelimiter()intgetLineNumber()StringgetSql()
-
-
-
Method Detail
-
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
Results execute(JdbcTemplate jdbcTemplate)
Executes this statement against the database.- Parameters:
jdbcTemplate- The jdbcTemplate to use to execute this script.- Returns:
- the result of the execution.
-
-