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 Summary
Constructors Constructor Description ParsedSqlStatement(int pos, int line, int col, String sql, Delimiter delimiter, boolean canExecuteInTransaction)
-
Method Summary
All Methods Instance Methods Concrete 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.intgetCol()StringgetDelimiter()intgetLine()intgetLineNumber()intgetPos()StringgetSql()
-
-
-
Method Detail
-
getPos
public int getPos()
-
getLine
public int getLine()
-
getCol
public int getCol()
-
getLineNumber
public final int getLineNumber()
- Specified by:
getLineNumberin interfaceSqlStatement- Returns:
- The original line number where the statement was located in the script it came from.
-
getSql
public final String getSql()
- Specified by:
getSqlin interfaceSqlStatement- Returns:
- The sql to send to the database.
-
getDelimiter
public String getDelimiter()
- Specified by:
getDelimiterin interfaceSqlStatement- Returns:
- The delimiter for the statement.
-
canExecuteInTransaction
public boolean canExecuteInTransaction()
Description copied from interface:SqlStatementWhether 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.- Specified by:
canExecuteInTransactionin interfaceSqlStatement- Returns:
trueif a transaction should be used (highly recommended), orfalseif not.
-
execute
public Results execute(JdbcTemplate jdbcTemplate)
Description copied from interface:SqlStatementExecutes this statement against the database.- Specified by:
executein interfaceSqlStatement- Parameters:
jdbcTemplate- The jdbcTemplate to use to execute this script.- Returns:
- the result of the execution.
-
-