Class DBContextStatic

java.lang.Object
org.apache.empire.db.context.DBContextBase
org.apache.empire.db.context.DBContextStatic
All Implemented Interfaces:
DBContext

public class DBContextStatic extends DBContextBase
  • Constructor Details

    • DBContextStatic

      public DBContextStatic(DBMSHandler dbmsHandler, Connection conn)
      Creates a static DBContext with default options
      Parameters:
      dbmsHandler - the database handler
      conn - a database connection
    • DBContextStatic

      public DBContextStatic(DBMSHandler dbmsHandler, Connection conn, boolean closeOnDiscard)
      Creates a static DBContext with custom options
      Parameters:
      dbmsHandler - the database handler
      conn - a database connection
      closeOnDiscard - flag whether to close the connection when calling discard()
  • Method Details

    • getDbms

      public DBMSHandler getDbms()
    • isPreparedStatementsEnabled

      public boolean isPreparedStatementsEnabled()
      Description copied from class: DBContextBase
      returns whether DBCommmand should automatically create a prepared statement with command params (?) Event if this is false, is still possible to manually add command params using cmd.addCmdParam();
      Specified by:
      isPreparedStatementsEnabled in class DBContextBase
      Returns:
      true if automatic prepared Statements are enabled or false if not
    • setPreparedStatementsEnabled

      public DBContextStatic setPreparedStatementsEnabled(boolean enabled)
      Enables or disables the use of prepared statements for update and insert commands as well as for read operations on a DBRecord. Note: For custom SQL commands parameters must be explicitly declared using cmd.addCmdParam();
      Parameters:
      enabled - flag whether to enable prepared statements
      Returns:
      the context (this)
    • isRollbackHandlingEnabled

      public boolean isRollbackHandlingEnabled()
    • setRollbackHandlingEnabled

      public DBContextStatic setRollbackHandlingEnabled(boolean enabled)
      Enables or disables rollback handling
      Parameters:
      enabled - flag whether to enable rollback handling
      Returns:
      the context (this)
    • discard

      public void discard()
      Description copied from class: DBContextBase
      Discard connection releated ressources WARING: No gurarantee it will be called
      Specified by:
      discard in interface DBContext
      Overrides:
      discard in class DBContextBase
    • getConnection

      protected Connection getConnection(boolean create)
      Specified by:
      getConnection in class DBContextBase
    • getRollbackManager

      protected DBRollbackManager getRollbackManager(boolean create)
      Specified by:
      getRollbackManager in class DBContextBase