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>constraintModesMaps a constraint id (key) into a Boolean for deferrable constraints.private SchemaDescriptorcurrentDefaultSchemaprivate java.lang.StringcurrentRoleprivate java.lang.StringcurrentUserprivate java.lang.BooleandeferredAllTrue 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.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
-
-
-
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 isTRUEwe 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:SQLSessionContextSet the SQL role of this SQL connection context- Specified by:
setRolein interfaceSQLSessionContext
-
getRole
public java.lang.String getRole()
Description copied from interface:SQLSessionContextGet the SQL role of this SQL connection context- Specified by:
getRolein interfaceSQLSessionContext
-
setUser
public void setUser(java.lang.String user)
Description copied from interface:SQLSessionContextSet the SQL current user of this SQL connection context- Specified by:
setUserin interfaceSQLSessionContext
-
getCurrentUser
public java.lang.String getCurrentUser()
Description copied from interface:SQLSessionContextGet the SQL current user of this SQL connection context- Specified by:
getCurrentUserin interfaceSQLSessionContext
-
setDefaultSchema
public void setDefaultSchema(SchemaDescriptor sd)
Description copied from interface:SQLSessionContextSet the schema of this SQL connection context- Specified by:
setDefaultSchemain interfaceSQLSessionContext
-
getDefaultSchema
public SchemaDescriptor getDefaultSchema()
Description copied from interface:SQLSessionContextGet the schema of this SQL connection context- Specified by:
getDefaultSchemain 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:
getConstraintModesin 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:
setConstraintModesin interfaceSQLSessionContext- Parameters:
hm- constraint mode map
-
setDeferred
public void setDeferred(UUID constraintId, boolean deferred)
Set the constraint mode for this constraint todeferred. Ifdeferredisfalse, to immediate checking, iftrueto deferred checking.- Specified by:
setDeferredin interfaceSQLSessionContext- Parameters:
constraintId- The constraint iddeferred- The new constraint mode
-
isDeferred
public 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.- Specified by:
isDeferredin interfaceSQLSessionContext- 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
public void resetConstraintModes()
Clear deferred information for this transaction.- Specified by:
resetConstraintModesin interfaceSQLSessionContext
-
setDeferredAll
public 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.- Specified by:
setDeferredAllin interfaceSQLSessionContext- Parameters:
deferred- the mode to set
-
getDeferredAll
public java.lang.Boolean getDeferredAll()
Get state of DEFERRED ALL setting.- Specified by:
getDeferredAllin interfaceSQLSessionContext- 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
-
-