Class ParsedSqlStatement

java.lang.Object
migratedb.v1.core.internal.sqlscript.ParsedSqlStatement
All Implemented Interfaces:
SqlStatement
Direct Known Subclasses:
PostgreSQLCopyParsedStatement

public class ParsedSqlStatement extends Object implements SqlStatement
A sql statement from a script that can be executed at once against a database.
  • Constructor Details

    • ParsedSqlStatement

      public ParsedSqlStatement(int pos, int line, int col, String sql, Delimiter delimiter, boolean canExecuteInTransaction)
  • Method Details

    • getPos

      public int getPos()
    • getLine

      public int getLine()
    • getCol

      public int getCol()
    • getLineNumber

      public final int getLineNumber()
      Specified by:
      getLineNumber in interface SqlStatement
      Returns:
      The original line number where the statement was located in the script it came from.
    • getSql

      public final String getSql()
      Specified by:
      getSql in interface SqlStatement
      Returns:
      The sql to send to the database.
    • getDelimiter

      public String getDelimiter()
      Specified by:
      getDelimiter in interface SqlStatement
      Returns:
      The delimiter for the statement.
    • canExecuteInTransaction

      public boolean canExecuteInTransaction()
      Description copied from interface: SqlStatement
      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.
      Specified by:
      canExecuteInTransaction in interface SqlStatement
      Returns:
      true if a transaction should be used (highly recommended), or false if not.
    • execute

      public Results execute(JdbcTemplate jdbcTemplate)
      Description copied from interface: SqlStatement
      Executes this statement against the database.
      Specified by:
      execute in interface SqlStatement
      Parameters:
      jdbcTemplate - The jdbcTemplate to use to execute this script.
      Returns:
      the result of the execution.