程序包 gu.sql2java

类 ScriptRunner

java.lang.Object
gu.sql2java.ScriptRunner

public class ScriptRunner extends Object
Tool to run database scripts.
  • 构造器详细资料

    • ScriptRunner

      public ScriptRunner(boolean autoCommit, boolean stopOnError)
      Default constructor.
      参数:
      autoCommit - the auto commit
      stopOnError - stop on error
  • 方法详细资料

    • setDelimiter

      public ScriptRunner setDelimiter(String delimiter, boolean fullLineDelimiter)
      Sets the delimiter.
      参数:
      delimiter - the delimiter
      fullLineDelimiter - the full line delimiter
      返回:
      this instance
    • setClearComment

      public ScriptRunner setClearComment(boolean clearComment)
      参数:
      clearComment - clear all COMMENT statement in SQL script if true
      返回:
      this instance
    • setAlias

      public ScriptRunner setAlias(String alias)
      set alias name for database connect project
      参数:
      alias -
      返回:
      this instance
    • addClearRegex

      public ScriptRunner addClearRegex(String regex)
    • addClearRegex

      public ScriptRunner addClearRegex(Pattern pattern)
    • addIgnoreRegex

      public ScriptRunner addIgnoreRegex(Pattern pattern)
    • addReplaceRegex

      public ScriptRunner addReplaceRegex(Pattern pattern, String replacement)
    • setLogWriter

      public ScriptRunner setLogWriter(PrintWriter logWriter)
      Setter for logWriter property.
      参数:
      logWriter - - the new value of the logWriter property
      返回:
      this instance
    • setErrorLogWriter

      public ScriptRunner setErrorLogWriter(PrintWriter errorLogWriter)
      Setter for errorLogWriter property.
      参数:
      errorLogWriter - - the new value of the errorLogWriter property
      返回:
      this instance
    • runScript

      public void runScript(Reader reader) throws IOException, gu.sql2java.exception.DaoException
      Runs an SQL script (read in using the Reader parameter).
      参数:
      reader - - the source of the script
      抛出:
      IOException - Signals that an I/O exception has occurred.
      gu.sql2java.exception.DaoException - the wrapped SQL exception
    • runScript

      public void runScript(String input) throws IOException, gu.sql2java.exception.DaoException
      Runs an SQL script (read in using the String parameter).
      参数:
      input - - the source of the script
      抛出:
      IOException
      gu.sql2java.exception.DaoException
    • runScript

      public void runScript(List<String> input) throws IOException, gu.sql2java.exception.DaoException
      Runs an SQL script (read in using the String parameter).
      参数:
      input - - the source of the script
      抛出:
      IOException
      gu.sql2java.exception.DaoException
    • runScript

      public void runScript(InputStream input) throws IOException, gu.sql2java.exception.DaoException
      Runs an SQL script (read in using the InputStream parameter).
      参数:
      input - - the source of the script
      抛出:
      IOException
      gu.sql2java.exception.DaoException
    • getExecutableSqls

      public List<String> getExecutableSqls()
      返回:
      all executable SQL statement of last call runScript