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 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 return true. 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:
      true if a transaction should be used (highly recommended), or false if 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.