Class SqlScriptExecutor

java.lang.Object
net.sf.jailer.util.SqlScriptExecutor

public class SqlScriptExecutor extends Object
Reads in and executes SQL-scripts.
Author:
Ralf Wisser
  • Field Details

    • UNFINISHED_MULTILINE_COMMENT

      public static final String UNFINISHED_MULTILINE_COMMENT
      Comment prefix for multi-line comments.
      See Also:
    • FINISHED_MULTILINE_COMMENT

      public static final String FINISHED_MULTILINE_COMMENT
      Comment prefix for last line of a multi-line comment.
      See Also:
  • Constructor Details

    • SqlScriptExecutor

      public SqlScriptExecutor(Session session, int threads, boolean logStatements)
      Constructor.
      Parameters:
      session - for execution of statements
      threads - number of threads to use
      logStatements - log statements?
    • SqlScriptExecutor

      public SqlScriptExecutor(Session session, int threads)
      Constructor.
      Parameters:
      session - for execution of statements
      threads - number of threads to use
  • Method Details

    • executeScript

      public Pair<Integer,Long> executeScript(String scriptFileName, boolean transactional) throws IOException, SQLException
      Reads in and executes a SQL-script.
      Parameters:
      scriptFileName - the name of the script-file
      transactional - true to execute the script within a transaction
      Returns:
      Pair(statementCount, rowCount)
      Throws:
      IOException
      SQLException
    • executeScript

      public Pair<Integer,Long> executeScript(String scriptFileName) throws IOException, SQLException
      Reads in and executes a SQL-script.
      Parameters:
      scriptFileName - the name of the script-file
      Returns:
      Pair(statementCount, rowCount)
      Throws:
      IOException
      SQLException
    • getLastStatementCount

      public static Pair<Integer,Long> getLastStatementCount()
      Gets the statement and row count from the last script execution.
      Returns:
      Pair(statementCount, rowCount) from the last script execution, or (0, 0) if no script has been executed