Class DefaultScriptRunner

java.lang.Object
org.tentackle.sql.DefaultScriptRunner
All Implemented Interfaces:
ScriptRunner
Direct Known Subclasses:
PostgresScriptRunner

public class DefaultScriptRunner extends Object implements ScriptRunner
Default implementation of a script runner.
  • Constructor Details

  • Method Details

    • getBackend

      public Backend getBackend()
      Description copied from interface: ScriptRunner
      Gets the backend for this script runner.
      Specified by:
      getBackend in interface ScriptRunner
      Returns:
      the backend
    • getConnection

      public Connection getConnection()
      Description copied from interface: ScriptRunner
      Gets the connection for this script runner.
      Specified by:
      getConnection in interface ScriptRunner
      Returns:
      the connection
    • setEscapeProcessingEnabled

      public void setEscapeProcessingEnabled(boolean enabled)
      Description copied from interface: ScriptRunner
      Enables or disables JDBC escape processing.
      Specified by:
      setEscapeProcessingEnabled in interface ScriptRunner
      Parameters:
      enabled - true if escape processing is enabled
      See Also:
    • isEscapeProcessingEnabled

      public boolean isEscapeProcessingEnabled()
      Description copied from interface: ScriptRunner
      Returns whether JDBC escape processing is enabled.
      Specified by:
      isEscapeProcessingEnabled in interface ScriptRunner
      Returns:
      true if enabled (default)
    • run

      public List<ScriptRunnerResult> run(String script)
      Description copied from interface: ScriptRunner
      Runs the SQL script.

      Throws BackendException if script execution failed.

      Specified by:
      run in interface ScriptRunner
      Parameters:
      script - the SQL script
      Returns:
      the results, never null
    • determineNextSqlCode

      public DefaultScriptRunner.SQLCode determineNextSqlCode(String script, int offset)
      Determines the next SQL code to execute.
      Parameters:
      script - the SQL script
      offset - the offset where to start in the script to find the next statement
      Returns:
      the next SQL code to send to the database, null if end of script found
    • determinePosixEscapeSyntaxSupported

      protected boolean determinePosixEscapeSyntaxSupported()
      Determines whether Posix escape syntax is supported by the backend and/or connection.
      Returns:
      true if supported