Class ScriptRunner

java.lang.Object
org.apache.ibatis.jdbc.ScriptRunner

public class ScriptRunner extends Object
This is an internal testing utility.
You are welcome to use this class for your own purposes,
but if there is some feature/enhancement you need for your own usage,
please make and modify your own copy instead of sending us an enhancement request.
  • Field Details

    • LINE_SEPARATOR

      private static final String LINE_SEPARATOR
    • DEFAULT_DELIMITER

      private static final String DEFAULT_DELIMITER
      See Also:
    • DELIMITER_PATTERN

      private static final Pattern DELIMITER_PATTERN
    • connection

      private final Connection connection
    • stopOnError

      private boolean stopOnError
    • throwWarning

      private boolean throwWarning
    • autoCommit

      private boolean autoCommit
    • sendFullScript

      private boolean sendFullScript
    • removeCRs

      private boolean removeCRs
    • escapeProcessing

      private boolean escapeProcessing
    • logWriter

      private PrintWriter logWriter
    • errorLogWriter

      private PrintWriter errorLogWriter
    • delimiter

      private String delimiter
    • fullLineDelimiter

      private boolean fullLineDelimiter
  • Constructor Details

    • ScriptRunner

      public ScriptRunner(Connection connection)
  • Method Details

    • setStopOnError

      public void setStopOnError(boolean stopOnError)
    • setThrowWarning

      public void setThrowWarning(boolean throwWarning)
    • setAutoCommit

      public void setAutoCommit(boolean autoCommit)
    • setSendFullScript

      public void setSendFullScript(boolean sendFullScript)
    • setRemoveCRs

      public void setRemoveCRs(boolean removeCRs)
    • setEscapeProcessing

      public void setEscapeProcessing(boolean escapeProcessing)
      Sets the escape processing.
      Parameters:
      escapeProcessing - the new escape processing
      Since:
      3.1.1
    • setLogWriter

      public void setLogWriter(PrintWriter logWriter)
    • setErrorLogWriter

      public void setErrorLogWriter(PrintWriter errorLogWriter)
    • setDelimiter

      public void setDelimiter(String delimiter)
    • setFullLineDelimiter

      public void setFullLineDelimiter(boolean fullLineDelimiter)
    • runScript

      public void runScript(Reader reader)
    • executeFullScript

      private void executeFullScript(Reader reader)
    • executeLineByLine

      private void executeLineByLine(Reader reader)
    • closeConnection

      @Deprecated public void closeConnection()
      Deprecated.
      Since 3.5.4, this method is deprecated. Please close the Connection outside of this class.
    • setAutoCommit

      private void setAutoCommit()
    • commitConnection

      private void commitConnection()
    • rollbackConnection

      private void rollbackConnection()
    • checkForMissingLineTerminator

      private void checkForMissingLineTerminator(StringBuilder command)
    • handleLine

      private void handleLine(StringBuilder command, String line) throws SQLException
      Throws:
      SQLException
    • lineIsComment

      private boolean lineIsComment(String trimmedLine)
    • commandReadyToExecute

      private boolean commandReadyToExecute(String trimmedLine)
    • executeStatement

      private void executeStatement(String command) throws SQLException
      Throws:
      SQLException
    • checkWarnings

      private void checkWarnings(Statement statement) throws SQLException
      Throws:
      SQLException
    • printResults

      private void printResults(Statement statement, boolean hasResults)
    • print

      private void print(Object o)
    • println

      private void println(Object o)
    • printlnError

      private void printlnError(Object o)