Class SQLSessionContextImpl

java.lang.Object
org.apache.derby.impl.sql.conn.SQLSessionContextImpl
All Implemented Interfaces:
SQLSessionContext

public class SQLSessionContextImpl extends Object implements SQLSessionContext
  • Field Details

    • currentUser

      private String currentUser
    • currentRole

      private String currentRole
    • currentDefaultSchema

      private SchemaDescriptor currentDefaultSchema
    • constraintModes

      private HashMap<UUID,Boolean> constraintModes
      Maps a constraint id (key) into a Boolean for deferrable constraints. If the Boolean value is FALSE, we have immediate checking, if it is TRUE we have deferred checking. Cf. SQL SET CONSTRAINT.
    • deferredAll

      private Boolean deferredAll
      True if all deferrable constraints are deferred in this transaction.
  • Constructor Details

  • Method Details

    • setRole

      public void setRole(String role)
      Description copied from interface: SQLSessionContext
      Set the SQL role of this SQL connection context
      Specified by:
      setRole in interface SQLSessionContext
    • getRole

      public String getRole()
      Description copied from interface: SQLSessionContext
      Get the SQL role of this SQL connection context
      Specified by:
      getRole in interface SQLSessionContext
    • setUser

      public void setUser(String user)
      Description copied from interface: SQLSessionContext
      Set the SQL current user of this SQL connection context
      Specified by:
      setUser in interface SQLSessionContext
    • getCurrentUser

      public String getCurrentUser()
      Description copied from interface: SQLSessionContext
      Get the SQL current user of this SQL connection context
      Specified by:
      getCurrentUser in interface SQLSessionContext
    • setDefaultSchema

      public void setDefaultSchema(SchemaDescriptor sd)
      Description copied from interface: SQLSessionContext
      Set the schema of this SQL connection context
      Specified by:
      setDefaultSchema in interface SQLSessionContext
    • getDefaultSchema

      public SchemaDescriptor getDefaultSchema()
      Description copied from interface: SQLSessionContext
      Get the schema of this SQL connection context
      Specified by:
      getDefaultSchema in interface SQLSessionContext
    • getConstraintModes

      public HashMap<UUID,Boolean> getConstraintModes()
      Get a handle to the session's constraint modes. The caller is responsible for any cloning needed.
      Specified by:
      getConstraintModes in interface SQLSessionContext
      Returns:
      constraint modes map
    • setConstraintModes

      public void setConstraintModes(HashMap<UUID,Boolean> hm)
      Initialize a inferior session context with the constraint mode map of the parent session context.
      Specified by:
      setConstraintModes in interface SQLSessionContext
      Parameters:
      hm - constraint mode map
    • setDeferred

      public void setDeferred(UUID constraintId, boolean deferred)
      Set the constraint mode for this constraint to deferred. If deferred is false, to immediate checking, if true to deferred checking.
      Specified by:
      setDeferred in interface SQLSessionContext
      Parameters:
      constraintId - The constraint id
      deferred - The new constraint mode
    • isDeferred

      public Boolean isDeferred(UUID constraintId)
      Return Boolean.TRUE if the constraint mode for this constraint/index has been set to deferred, Boolean.FALSE if it has been set to immediate. Any ALL setting is considered also. If the constraint mode hasn't been set for this constraint, return null. The constraint mode is the effectively the initial constraint mode in this case.
      Specified by:
      isDeferred in interface SQLSessionContext
      Parameters:
      constraintId - the constraint id
      Returns:
      Boolean.TRUE if the constraint mode for this constraint/index has been set to deferred, Boolean.FALSE if it has been set to immediate.
    • resetConstraintModes

      public void resetConstraintModes()
      Clear deferred information for this transaction.
      Specified by:
      resetConstraintModes in interface SQLSessionContext
    • setDeferredAll

      public void setDeferredAll(Boolean deferred)
      Set the constraint mode for all deferrable constraints to deferred. If deferred is false, set to immediate checking, if true to deferred checking. null is allowed: it means no ALL setting exists.
      Specified by:
      setDeferredAll in interface SQLSessionContext
      Parameters:
      deferred - the mode to set
    • getDeferredAll

      public Boolean getDeferredAll()
      Get state of DEFERRED ALL setting.
      Specified by:
      getDeferredAll in interface SQLSessionContext
      Returns:
      True is deferred all constraint mode has been set for this session context. False is deferred immediate has been set for this session context. null means no ALL setting has been made for this context