Interface SQLSessionContext
-
- All Known Implementing Classes:
SQLSessionContextImpl
public interface SQLSessionContextAn implementation of this interface encapsulates some of the SQL session context's state variables, cf. SQL 2003, section 4.37.3, notably those which we need to save and restore when entering a stored procedure or function (which can contain SQL and thus a nested connection), cf. 4.37.3, 4.27.3 and 4.34.1.1.Presently this set contains the following properties:
- current role
- current schema
SQL session context is implemented as follows: Statements at root connection level use the instance held by the the lcc, nested connections maintain instances of SQLSessionContext, held by the activation of the calling statement. This forms a logical stack as required by the standard. The statement context also holds a reference to the current SQLSessionContext.
When a dynamic result set references e.g. current role, the value retrieved will always be that of the current role when the statement is logically executed (inside procedure/function), not the current value when the result set is accessed outside the stored procedure/function. This works since the nested SQL session context is kept by the caller activation, so even though the statement context of the call has been popped, we can get at the final state of the nested SQL session context since the caller's activation is alive as long as dynamic result sets need it).
If more than one nested connection is used inside a shared procedure, they will share the same nested SQL session context. Since the same dynamic call context is involved, this seems correct.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.HashMap<UUID,java.lang.Boolean>getConstraintModes()Get a handle to the session's constraint modes.java.lang.StringgetCurrentUser()Get the SQL current user of this SQL connection contextSchemaDescriptorgetDefaultSchema()Get the schema of this SQL connection contextjava.lang.BooleangetDeferredAll()Get state of DEFERRED ALL setting.java.lang.StringgetRole()Get the SQL role of this SQL connection contextjava.lang.BooleanisDeferred(UUID constraintId)ReturnBoolean.TRUEif the constraint mode for this constraint/index has been set to deferred,Boolean.FALSEif it has been set to immediate.voidresetConstraintModes()Clear deferred information for this transaction.voidsetConstraintModes(java.util.HashMap<UUID,java.lang.Boolean> hm)Initialize a inferior session context with the constraint mode map of the parent session context.voidsetDefaultSchema(SchemaDescriptor sd)Set the schema of this SQL connection contextvoidsetDeferred(UUID constraintId, boolean deferred)Set the constraint mode for this constraint todeferred.voidsetDeferredAll(java.lang.Boolean deferred)Set the constraint mode for all deferrable constraints todeferred.voidsetRole(java.lang.String role)Set the SQL role of this SQL connection contextvoidsetUser(java.lang.String user)Set the SQL current user of this SQL connection context
-
-
-
Method Detail
-
setRole
void setRole(java.lang.String role)
Set the SQL role of this SQL connection context
-
getRole
java.lang.String getRole()
Get the SQL role of this SQL connection context
-
setUser
void setUser(java.lang.String user)
Set the SQL current user of this SQL connection context
-
getCurrentUser
java.lang.String getCurrentUser()
Get the SQL current user of this SQL connection context
-
setDefaultSchema
void setDefaultSchema(SchemaDescriptor sd)
Set the schema of this SQL connection context
-
getDefaultSchema
SchemaDescriptor getDefaultSchema()
Get the schema of this SQL connection context
-
getConstraintModes
java.util.HashMap<UUID,java.lang.Boolean> getConstraintModes()
Get a handle to the session's constraint modes. The caller is responsible for any cloning needed.- Returns:
- constraint modes map
-
setConstraintModes
void setConstraintModes(java.util.HashMap<UUID,java.lang.Boolean> hm)
Initialize a inferior session context with the constraint mode map of the parent session context.- Parameters:
hm- constraint mode map
-
setDeferred
void setDeferred(UUID constraintId, boolean deferred)
Set the constraint mode for this constraint todeferred. Ifdeferredisfalse, to immediate checking, iftrueto deferred checking.- Parameters:
constraintId- The constraint iddeferred- The new constraint mode
-
isDeferred
java.lang.Boolean isDeferred(UUID constraintId)
ReturnBoolean.TRUEif the constraint mode for this constraint/index has been set to deferred,Boolean.FALSEif it has been set to immediate. Any ALL setting is considered also. If the constraint mode hasn't been set for this constraint, returnnull. The constraint mode is the effectively the initial constraint mode in this case.- Parameters:
constraintId- the constraint id- Returns:
Boolean.TRUEif the constraint mode for this constraint/index has been set to deferred,Boolean.FALSEif it has been set to immediate.
-
resetConstraintModes
void resetConstraintModes()
Clear deferred information for this transaction.
-
setDeferredAll
void setDeferredAll(java.lang.Boolean deferred)
Set the constraint mode for all deferrable constraints todeferred. Ifdeferredisfalse, set to immediate checking, iftrueto deferred checking.nullis allowed: it means no ALL setting exists.- Parameters:
deferred- the mode to set
-
getDeferredAll
java.lang.Boolean getDeferredAll()
Get state of DEFERRED ALL setting.- Returns:
Trueis deferred all constraint mode has been set for this session context.Falseis deferred immediate has been set for this session context.nullmeans no ALL setting has been made for this context
-
-