Package org.apache.derby.impl.sql.conn
Class SQLSessionContextImpl
- java.lang.Object
-
- org.apache.derby.impl.sql.conn.SQLSessionContextImpl
-
- All Implemented Interfaces:
SQLSessionContext
public class SQLSessionContextImpl extends java.lang.Object implements SQLSessionContext
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<UUID,java.lang.Boolean>
constraintModes
Maps a constraint id (key) into a Boolean for deferrable constraints.private SchemaDescriptor
currentDefaultSchema
private java.lang.String
currentRole
private java.lang.String
currentUser
private java.lang.Boolean
deferredAll
True if all deferrable constraints are deferred in this transaction.
-
Constructor Summary
Constructors Constructor Description SQLSessionContextImpl(SchemaDescriptor sd, java.lang.String currentUser)
-
Method Summary
All Methods Instance Methods Concrete 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.String
getCurrentUser()
Get the SQL current user of this SQL connection contextSchemaDescriptor
getDefaultSchema()
Get the schema of this SQL connection contextjava.lang.Boolean
getDeferredAll()
Get state of DEFERRED ALL setting.java.lang.String
getRole()
Get the SQL role of this SQL connection contextjava.lang.Boolean
isDeferred(UUID constraintId)
ReturnBoolean.TRUE
if the constraint mode for this constraint/index has been set to deferred,Boolean.FALSE
if it has been set to immediate.void
resetConstraintModes()
Clear deferred information for this transaction.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.void
setDefaultSchema(SchemaDescriptor sd)
Set the schema of this SQL connection contextvoid
setDeferred(UUID constraintId, boolean deferred)
Set the constraint mode for this constraint todeferred
.void
setDeferredAll(java.lang.Boolean deferred)
Set the constraint mode for all deferrable constraints todeferred
.void
setRole(java.lang.String role)
Set the SQL role of this SQL connection contextvoid
setUser(java.lang.String user)
Set the SQL current user of this SQL connection context
-
-
-
Field Detail
-
currentUser
private java.lang.String currentUser
-
currentRole
private java.lang.String currentRole
-
currentDefaultSchema
private SchemaDescriptor currentDefaultSchema
-
constraintModes
private java.util.HashMap<UUID,java.lang.Boolean> constraintModes
Maps a constraint id (key) into a Boolean for deferrable constraints. If the Boolean value isFALSE
, we have immediate checking, if it isTRUE
we have deferred checking. Cf. SQL SET CONSTRAINT.
-
deferredAll
private java.lang.Boolean deferredAll
True if all deferrable constraints are deferred in this transaction.
-
-
Constructor Detail
-
SQLSessionContextImpl
public SQLSessionContextImpl(SchemaDescriptor sd, java.lang.String currentUser)
-
-
Method Detail
-
setRole
public void setRole(java.lang.String role)
Description copied from interface:SQLSessionContext
Set the SQL role of this SQL connection context- Specified by:
setRole
in interfaceSQLSessionContext
-
getRole
public java.lang.String getRole()
Description copied from interface:SQLSessionContext
Get the SQL role of this SQL connection context- Specified by:
getRole
in interfaceSQLSessionContext
-
setUser
public void setUser(java.lang.String user)
Description copied from interface:SQLSessionContext
Set the SQL current user of this SQL connection context- Specified by:
setUser
in interfaceSQLSessionContext
-
getCurrentUser
public java.lang.String getCurrentUser()
Description copied from interface:SQLSessionContext
Get the SQL current user of this SQL connection context- Specified by:
getCurrentUser
in interfaceSQLSessionContext
-
setDefaultSchema
public void setDefaultSchema(SchemaDescriptor sd)
Description copied from interface:SQLSessionContext
Set the schema of this SQL connection context- Specified by:
setDefaultSchema
in interfaceSQLSessionContext
-
getDefaultSchema
public SchemaDescriptor getDefaultSchema()
Description copied from interface:SQLSessionContext
Get the schema of this SQL connection context- Specified by:
getDefaultSchema
in interfaceSQLSessionContext
-
getConstraintModes
public 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.- Specified by:
getConstraintModes
in interfaceSQLSessionContext
- Returns:
- constraint modes map
-
setConstraintModes
public 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.- Specified by:
setConstraintModes
in interfaceSQLSessionContext
- Parameters:
hm
- constraint mode map
-
setDeferred
public void setDeferred(UUID constraintId, boolean deferred)
Set the constraint mode for this constraint todeferred
. Ifdeferred
isfalse
, to immediate checking, iftrue
to deferred checking.- Specified by:
setDeferred
in interfaceSQLSessionContext
- Parameters:
constraintId
- The constraint iddeferred
- The new constraint mode
-
isDeferred
public java.lang.Boolean isDeferred(UUID constraintId)
ReturnBoolean.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, returnnull
. The constraint mode is the effectively the initial constraint mode in this case.- Specified by:
isDeferred
in interfaceSQLSessionContext
- 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 interfaceSQLSessionContext
-
setDeferredAll
public void setDeferredAll(java.lang.Boolean deferred)
Set the constraint mode for all deferrable constraints todeferred
. Ifdeferred
isfalse
, set to immediate checking, iftrue
to deferred checking.null
is allowed: it means no ALL setting exists.- Specified by:
setDeferredAll
in interfaceSQLSessionContext
- Parameters:
deferred
- the mode to set
-
getDeferredAll
public java.lang.Boolean getDeferredAll()
Get state of DEFERRED ALL setting.- Specified by:
getDeferredAll
in interfaceSQLSessionContext
- 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
-
-