org.h2.engine

## Class Session

- java.lang.Object
- - org.h2.engine.Session

All Implemented Interfaces:
  java.io.Closeable, java.lang.AutoCloseable, CastDataProvider, SessionInterface, TransactionStore.RollbackListener

    public class Session
    extends java.lang.Object
    implements TransactionStore.RollbackListener, CastDataProvider

A session represents an embedded database connection. When using the server mode, this object resides on the server side and communicates with a SessionRemote object on the client side.

### Nested Class Summary

Nested Classes
`static class` `Session.Savepoint` Represents a savepoint (a position in a transaction to where one can roll back to).
`static class` `Session.State`
`static class` `Session.TimeoutValue` An object with a timeout.

### Field Summary

Fields
`static int` `LOG_WRITTEN` This special log position means that the log entry has been written.
`protected java.util.ArrayList<java.lang.String>` `sessionState`
`protected boolean` `sessionStateChanged`

### Constructor Summary

Constructors
Constructor and Description
`Session(Database database, User user, int id)`

### Method Summary

Methods
`void` `addLocalTempTable(Table table)` Add a local temporary table to this session.
`void` `addLocalTempTableConstraint(Constraint constraint)` Add a local temporary constraint to this session.
`void` `addLocalTempTableIndex(Index index)` Add a local temporary index to this session.
`void` `addLogPos(int logId, int pos)` Called when a log entry for this session is added.
`void` `addProcedure(Procedure procedure)` Add a procedure to this session.
`void` `addSavepoint(java.lang.String name)` Create a savepoint that is linked to the current log position.
`void` `addTemporaryLob(Value v)` Add a temporary LOB, which is closed when the session commits.
`void` `addTemporaryResult(ResultInterface result)` Remember the result set and close it as soon as the transaction is committed (if it needs to be closed).
`void` `begin()` Begin a transaction.
`void` `cancel()` Cancel the current or next command (called when closing a connection).
`void` `checkCanceled()` Check if the current transaction is canceled by calling Statement.cancel() or because a session timeout was set and expired.
`void` `clearViewIndexCache()` Clear the view cache for this session.
`void` `close()` Roll back pending transactions and close the session.
`void` `commit(boolean ddl)` Commit the current transaction.
`boolean` `containsUncommitted()` Whether the session contains any uncommitted changes.
`JdbcConnection` `createConnection(boolean columnList)` Create an internal connection.
`Row` `createRow(Value[] data, int memory)` Create a new row for a table.
`ValueTimestampTimeZone` `currentTimestamp()` Returns the current timestamp with maximum resolution.
`void` `endStatement()` Mark the statement as completed.
`Table` `findLocalTempTable(java.lang.String name)` Get the local temporary table if one exists with that name, or null if not.
`Constraint` `findLocalTempTableConstraint(java.lang.String name)` Get the local temporary constraint if one exists with that name, or null if not.
`Index` `findLocalTempTableIndex(java.lang.String name)` Get the local temporary index if one exists with that name, or null if not.
`boolean` `getAllowLiterals()`
`boolean` `getAutoCommit()` Check if this session is in auto-commit mode.
`int` `getBlockingSessionId()`
`long` `getCancel()` Get the cancel time.
`java.util.ArrayList<java.lang.String>` `getClusterServers()` Get the list of the cluster servers for this session.
`ColumnNamerConfiguration` `getColumnNamerConfiguration()`
`Command` `getCurrentCommand()`
`ValueTimestampTimeZone` `getCurrentCommandStart()`
`java.lang.String` `getCurrentSchemaName()` Get current schema.
`Value` `getCurrentValueFor(Sequence sequence)` Returns the current value of the sequence in this session.
`Database` `getDatabase()`
`DataHandler` `getDataHandler()` Get the data handler object.
`int` `getFirstUncommittedLog()`
`int` `getId()`
`IsolationLevel` `getIsolationLevel()` Returns the isolation level.
`Value` `getLastIdentity()`
`Value` `getLastScopeIdentity()`
`Value` `getLastTriggerIdentity()`
`java.util.HashMap<java.lang.String,Constraint>` `getLocalTempTableConstraints()` Get the map of constraints for all constraints on local, temporary tables, if any.
`java.util.HashMap<java.lang.String,Index>` `getLocalTempTableIndexes()`
`java.util.ArrayList<Table>` `getLocalTempTables()`
`java.util.Set<Table>` `getLocks()`
`int` `getLockTimeout()`
`Mode` `getMode()` Returns the database mode.
`int` `getModificationId()`
`NetworkConnectionInfo` `getNetworkConnectionInfo()` Returns the network connection information, or `null`.
`java.lang.String` `getNextSystemIdentifier(java.lang.String sql)` Get the next system generated identifiers.
`java.lang.String` `getParsingCreateViewName()`
`int` `getPowerOffCount()` Get the number of disk operations before power failure is simulated.
`Procedure` `getProcedure(java.lang.String name)` Get the procedure with the given name, or null if none exists.
`int` `getQueryTimeout()`
`java.util.Random` `getRandom()`
`java.lang.String[]` `getSchemaSearchPath()`
`long` `getSessionStart()`
`long` `getSnapshotDataModificationId()` Returns the data modification id of transaction's snapshot, or 0 if isolation level doesn't use snapshots.
`Session.State` `getState()`
`SubQueryInfo` `getSubQueryInfo()`
`Trace` `getTrace()` Get the trace object
`Transaction` `getTransaction()` Get the transaction to use for this session.
`Value` `getTransactionId()`
`ValueTimestampTimeZone` `getTransactionStart()`
`User` `getUser()`
`Value` `getVariable(java.lang.String name)` Get the value of the specified user defined variable.
`java.lang.String[]` `getVariableNames()` Get the list of variable names that are set for this session.
`java.util.Map<java.lang.Object,ViewIndex>` `getViewIndexCache(boolean subQuery)` Get the view cache for this session.
`Table` `getWaitForLock()`
`java.lang.Thread` `getWaitForLockThread()`
`int` `hashCode()`
`boolean` `hasPendingTransaction()` Check whether this session has a pending transaction.
`boolean` `isClosed()` Check if close was called.
`boolean` `isForceJoinOrder()`
`boolean` `isJoinBatchEnabled()`
`boolean` `isLazyQueryExecution()`
`boolean` `isOpen()`
`boolean` `isParsingCreateView()`
`boolean` `isPreparingQueryExpression()`
`boolean` `isRedoLogBinaryEnabled()`
`boolean` `isRemote()` Check if this session is remote or embedded.
`boolean` `isSupportsGeneratedKeys()` Returns is this session supports generated keys.
`boolean` `isUndoLogEnabled()`
`void` `log(Table table, short operation, Row row)` Add an undo log entry to this session.
`void` `markTableForAnalyze(Table table)` Mark that the given table needs to be analyzed on commit.
`int` `nextObjectId()` Get the next object id.
`void` `onRollback(MVMap<java.lang.Object,VersionedValue> map, java.lang.Object key, VersionedValue existingValue, VersionedValue restoredValue)` Notified of a single map change (add/update/remove)
`void` `optimizeQueryExpression(Query query)` Optimize a query.
`void` `popSubQueryInfo()` Remove the current subquery info from the stack.
`Prepared` `prepare(java.lang.String sql)` Parse and prepare the given SQL statement.
`Prepared` `prepare(java.lang.String sql, boolean rightsChecked, boolean literalsChecked)` Parse and prepare the given SQL statement.
`CommandInterface` `prepareCommand(java.lang.String sql, int fetchSize)` Parse a command and prepare it for execution.
`void` `prepareCommit(java.lang.String transactionName)` Prepare the given transaction.
`Command` `prepareLocal(java.lang.String sql)` Parse and prepare the given SQL statement.
`void` `pushSubQueryInfo(int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder)` Add a subquery info on top of the subquery info stack.
`void` `readSessionState()` Read the session state if necessary.
`protected void` `recreateSessionState()` Re-create the session state using the stored sessionState list.
`void` `registerTableAsLocked(Table table)` Register table as updated within current transaction.
`void` `registerTableAsUpdated(Table table)` Register table as updated within current transaction.
`void` `removeAtCommit(Value v)` Remember that the given LOB value must be removed at commit.
`void` `removeAtCommitStop(Value v)` Do not remove this LOB value at commit any longer.
`void` `removeLocalTempTable(Table table)` Drop and remove the given local temporary table from this session.
`void` `removeLocalTempTableIndex(Index index)` Drop and remove the given local temporary index from this session.
`void` `removeProcedure(java.lang.String name)` Remove a procedure from this session.
`void` `rollback()` Fully roll back the current transaction.
`void` `rollbackTo(Session.Savepoint savepoint)` Partially roll back the current transaction.
`void` `rollbackToSavepoint(java.lang.String name)` Undo all operations back to the log position of the given savepoint.
`void` `setAllowLiterals(boolean b)`
`void` `setAutoCommit(boolean b)` Set the auto-commit mode.
`void` `setColumnNamerConfiguration(ColumnNamerConfiguration columnNamerConfiguration)`
`boolean` `setCommitOrRollbackDisabled(boolean x)`
`void` `setCurrentSchema(Schema schema)`
`void` `setCurrentSchemaName(java.lang.String schemaName)` Set current schema.
`void` `setCurrentValueFor(Sequence sequence, Value value)` Sets the current value of the sequence and last identity value for this session.
`void` `setForceJoinOrder(boolean forceJoinOrder)`
`void` `setIsolationLevel(IsolationLevel isolationLevel)` Sets the isolation level.
`void` `setJoinBatchEnabled(boolean joinBatchEnabled)`
`void` `setLastIdentity(Value last)`
`void` `setLastScopeIdentity(Value last)`
`void` `setLastTriggerIdentity(Value last)`
`void` `setLazyQueryExecution(boolean lazyQueryExecution)`
`void` `setLockTimeout(int lockTimeout)`
`void` `setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)` Sets the network connection information if possible.
`void` `setParsingCreateView(boolean parsingView, java.lang.String viewName)` Stores name of currently parsed view in a stack so it can be determined during `prepare()`.
`void` `setPowerOffCount(int count)` Set the number of disk operations before power failure is simulated.
`void` `setPreparedTransaction(java.lang.String transactionName, boolean commit)` Commit or roll back the given transaction.
`void` `setQueryTimeout(int queryTimeout)`
`void` `setRedoLogBinary(boolean b)`
`Session.Savepoint` `setSavepoint()` Create a savepoint to allow rolling back to this state.
`void` `setSchemaSearchPath(java.lang.String[] schemas)`
`void` `setThrottle(int throttle)`
`void` `setUndoLogEnabled(boolean b)`
`void` `setVariable(java.lang.String name, Value value)` Set the value of the given variable for this session.
`void` `setWaitForLock(Table waitForLock, java.lang.Thread waitForLockThread)` Set the table this session is waiting for, and the thread that is waiting.
`void` `startStatementWithinTransaction(Command command)` Start a new statement within a transaction.
`void` `throttle()` Wait for some time if this session is throttled (slowed down).
`java.lang.String` `toString()`
`void` `waitIfExclusiveModeEnabled()` Wait if the exclusive mode has been enabled for another session.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### LOG_WRITTEN

    public static final int LOG_WRITTEN

This special log position means that the log entry has been written.

See Also:
  Constant Field Values

#### sessionState

    protected java.util.ArrayList<java.lang.String> sessionState

#### sessionStateChanged

    protected boolean sessionStateChanged

### Constructor Detail

#### Session

    public Session(Database database,
           User user,
           int id)

### Method Detail

#### setLazyQueryExecution

    public void setLazyQueryExecution(boolean lazyQueryExecution)

#### isLazyQueryExecution

    public boolean isLazyQueryExecution()

#### setForceJoinOrder

    public void setForceJoinOrder(boolean forceJoinOrder)

#### isForceJoinOrder

    public boolean isForceJoinOrder()

#### setJoinBatchEnabled

    public void setJoinBatchEnabled(boolean joinBatchEnabled)

#### isJoinBatchEnabled

    public boolean isJoinBatchEnabled()

#### createRow

    public Row createRow(Value[] data,
                int memory)

Create a new row for a table.

Parameters:
  `data` - the values
  `memory` - whether the row is in memory
Returns:
  the created row

#### pushSubQueryInfo

    public void pushSubQueryInfo(int[] masks,
                        TableFilter[] filters,
                        int filter,
                        SortOrder sortOrder)

Add a subquery info on top of the subquery info stack.

Parameters:
  `masks` - the mask
  `filters` - the filters
  `filter` - the filter index
  `sortOrder` - the sort order

#### popSubQueryInfo

    public void popSubQueryInfo()

Remove the current subquery info from the stack.

#### getSubQueryInfo

    public SubQueryInfo getSubQueryInfo()

#### setParsingCreateView

    public void setParsingCreateView(boolean parsingView,
                            java.lang.String viewName)

Stores name of currently parsed view in a stack so it can be determined during `prepare()`.

Parameters:
  `parsingView` - `true` to store one more name, `false` to remove it from stack
  `viewName` - name of the view

#### getParsingCreateViewName

    public java.lang.String getParsingCreateViewName()

#### isParsingCreateView

    public boolean isParsingCreateView()

#### optimizeQueryExpression

    public void optimizeQueryExpression(Query query)

Optimize a query. This will remember the subquery info, clear it, prepare the query, and reset the subquery info.

Parameters:
  `query` - the query to prepare

#### isPreparingQueryExpression

    public boolean isPreparingQueryExpression()

#### getClusterServers

    public java.util.ArrayList<java.lang.String> getClusterServers()

Description copied from interface: `SessionInterface`
Get the list of the cluster servers for this session.

Specified by:
  `getClusterServers` in interface `SessionInterface`
Returns:
  A list of "ip:port" strings for the cluster servers in this session.

#### setCommitOrRollbackDisabled

    public boolean setCommitOrRollbackDisabled(boolean x)

#### setVariable

    public void setVariable(java.lang.String name,
                   Value value)

Set the value of the given variable for this session.

Parameters:
  `name` - the name of the variable (may not be null)
  `value` - the new value (may not be null)

#### getVariable

    public Value getVariable(java.lang.String name)

Get the value of the specified user defined variable. This method always returns a value; it returns ValueNull.INSTANCE if the variable doesn't exist.

Parameters:
  `name` - the variable name
Returns:
  the value, or NULL

#### getVariableNames

    public java.lang.String[] getVariableNames()

Get the list of variable names that are set for this session.

Returns:
  the list of names

#### findLocalTempTable

    public Table findLocalTempTable(java.lang.String name)

Get the local temporary table if one exists with that name, or null if not.

Parameters:
  `name` - the table name
Returns:
  the table, or null

#### getLocalTempTables

    public java.util.ArrayList<Table> getLocalTempTables()

#### addLocalTempTable

    public void addLocalTempTable(Table table)

Add a local temporary table to this session.

Parameters:
  `table` - the table to add
Throws:
  `DbException` - if a table with this name already exists

#### removeLocalTempTable

    public void removeLocalTempTable(Table table)

Drop and remove the given local temporary table from this session.

Parameters:
  `table` - the table

#### findLocalTempTableIndex

    public Index findLocalTempTableIndex(java.lang.String name)

Get the local temporary index if one exists with that name, or null if not.

Parameters:
  `name` - the table name
Returns:
  the table, or null

#### getLocalTempTableIndexes

    public java.util.HashMap<java.lang.String,Index> getLocalTempTableIndexes()

#### addLocalTempTableIndex

    public void addLocalTempTableIndex(Index index)

Add a local temporary index to this session.

Parameters:
  `index` - the index to add
Throws:
  `DbException` - if a index with this name already exists

#### removeLocalTempTableIndex

    public void removeLocalTempTableIndex(Index index)

Drop and remove the given local temporary index from this session.

Parameters:
  `index` - the index

#### findLocalTempTableConstraint

    public Constraint findLocalTempTableConstraint(java.lang.String name)

Get the local temporary constraint if one exists with that name, or null if not.

Parameters:
  `name` - the constraint name
Returns:
  the constraint, or null

#### getLocalTempTableConstraints

    public java.util.HashMap<java.lang.String,Constraint> getLocalTempTableConstraints()

Get the map of constraints for all constraints on local, temporary tables, if any. The map's keys are the constraints' names.

Returns:
  the map of constraints, or null

#### addLocalTempTableConstraint

    public void addLocalTempTableConstraint(Constraint constraint)

Add a local temporary constraint to this session.

Parameters:
  `constraint` - the constraint to add
Throws:
  `DbException` - if a constraint with the same name already exists

#### getAutoCommit

    public boolean getAutoCommit()

Description copied from interface: `SessionInterface`
Check if this session is in auto-commit mode.

Specified by:
  `getAutoCommit` in interface `SessionInterface`
Returns:
  true if the session is in auto-commit mode

#### getUser

    public User getUser()

#### setAutoCommit

    public void setAutoCommit(boolean b)

Description copied from interface: `SessionInterface`
Set the auto-commit mode. This call doesn't commit the current transaction.

Specified by:
  `setAutoCommit` in interface `SessionInterface`
Parameters:
  `b` - the new value

#### getLockTimeout

    public int getLockTimeout()

#### setLockTimeout

    public void setLockTimeout(int lockTimeout)

#### prepareCommand

    public CommandInterface prepareCommand(java.lang.String sql,
                                  int fetchSize)

Description copied from interface: `SessionInterface`
Parse a command and prepare it for execution.

Specified by:
  `prepareCommand` in interface `SessionInterface`
Parameters:
  `sql` - the SQL statement
  `fetchSize` - the number of rows to fetch in one step
Returns:
  the prepared command

#### prepare

    public Prepared prepare(java.lang.String sql)

Parse and prepare the given SQL statement. This method also checks the rights.

Parameters:
  `sql` - the SQL statement
Returns:
  the prepared statement

#### prepare

    public Prepared prepare(java.lang.String sql,
                   boolean rightsChecked,
                   boolean literalsChecked)

Parse and prepare the given SQL statement.

Parameters:
  `sql` - the SQL statement
  `rightsChecked` - true if the rights have already been checked
  `literalsChecked` - true if the sql string has already been checked for literals (only used if ALLOW_LITERALS NONE is set).
Returns:
  the prepared statement

#### prepareLocal

    public Command prepareLocal(java.lang.String sql)

Parse and prepare the given SQL statement. This method also checks if the connection has been closed.

Parameters:
  `sql` - the SQL statement
Returns:
  the prepared statement

#### getDatabase

    public Database getDatabase()

#### getPowerOffCount

    public int getPowerOffCount()

Description copied from interface: `SessionInterface`
Get the number of disk operations before power failure is simulated. This is used for testing. If not set, 0 is returned

Specified by:
  `getPowerOffCount` in interface `SessionInterface`
Returns:
  the number of operations, or 0

#### setPowerOffCount

    public void setPowerOffCount(int count)

Description copied from interface: `SessionInterface`
Set the number of disk operations before power failure is simulated. To disable the countdown, use 0.

Specified by:
  `setPowerOffCount` in interface `SessionInterface`
Parameters:
  `count` - the number of operations

#### commit

    public void commit(boolean ddl)

Commit the current transaction. If the statement was not a data definition statement, and if there are temporary tables that should be dropped or truncated at commit, this is done as well.

Parameters:
  `ddl` - if the statement was a data definition statement

#### getSnapshotDataModificationId

    public long getSnapshotDataModificationId()

Returns the data modification id of transaction's snapshot, or 0 if isolation level doesn't use snapshots.

Returns:
  the data modification id of transaction's snapshot, or 0

#### rollback

    public void rollback()

Fully roll back the current transaction.

#### rollbackTo

    public void rollbackTo(Session.Savepoint savepoint)

Partially roll back the current transaction.

Parameters:
  `savepoint` - the savepoint to which should be rolled back

#### hasPendingTransaction

    public boolean hasPendingTransaction()

Description copied from interface: `SessionInterface`
Check whether this session has a pending transaction.

Specified by:
  `hasPendingTransaction` in interface `SessionInterface`
Returns:
  true if it has

#### setSavepoint

    public Session.Savepoint setSavepoint()

Create a savepoint to allow rolling back to this state.

Returns:
  the savepoint

#### getId

    public int getId()

#### cancel

    public void cancel()

Description copied from interface: `SessionInterface`
Cancel the current or next command (called when closing a connection).

Specified by:
  `cancel` in interface `SessionInterface`

#### close

    public void close()

Description copied from interface: `SessionInterface`
Roll back pending transactions and close the session.

Specified by:
  `close` in interface `java.io.Closeable`
Specified by:
  `close` in interface `java.lang.AutoCloseable`
Specified by:
  `close` in interface `SessionInterface`

#### registerTableAsLocked

    public void registerTableAsLocked(Table table)

Register table as updated within current transaction. Table is unlocked on commit or rollback. It also assumes that table will be modified by transaction.

Parameters:
  `table` - the table that is locked

#### registerTableAsUpdated

    public void registerTableAsUpdated(Table table)

Register table as updated within current transaction. This is used instead of table locking when lock mode is LOCK_MODE_OFF.

Parameters:
  `table` - to register

#### log

    public void log(Table table,
           short operation,
           Row row)

Add an undo log entry to this session.

Parameters:
  `table` - the table
  `operation` - the operation type (see `UndoLogRecord`)
  `row` - the row

#### getRandom

    public java.util.Random getRandom()

#### getTrace

    public Trace getTrace()

Description copied from interface: `SessionInterface`
Get the trace object

Specified by:
  `getTrace` in interface `SessionInterface`
Returns:
  the trace object

#### setCurrentValueFor

    public void setCurrentValueFor(Sequence sequence,
                          Value value)

Sets the current value of the sequence and last identity value for this session.

Parameters:
  `sequence` - the sequence
  `value` - the current value of the sequence

#### getCurrentValueFor

    public Value getCurrentValueFor(Sequence sequence)

Returns the current value of the sequence in this session.

Parameters:
  `sequence` - the sequence
Returns:
  the current value of the sequence in this session
Throws:
  `DbException` - if current value is not defined

#### setLastIdentity

    public void setLastIdentity(Value last)

#### getLastIdentity

    public Value getLastIdentity()

#### setLastScopeIdentity

    public void setLastScopeIdentity(Value last)

#### getLastScopeIdentity

    public Value getLastScopeIdentity()

#### setLastTriggerIdentity

    public void setLastTriggerIdentity(Value last)

#### getLastTriggerIdentity

    public Value getLastTriggerIdentity()

#### addLogPos

    public void addLogPos(int logId,
                 int pos)

Called when a log entry for this session is added. The session keeps track of the first entry in the transaction log that is not yet committed.

Parameters:
  `logId` - the transaction log id
  `pos` - the position of the log entry in the transaction log

#### getFirstUncommittedLog

    public int getFirstUncommittedLog()

#### containsUncommitted

    public boolean containsUncommitted()

Whether the session contains any uncommitted changes.

Returns:
  true if yes

#### addSavepoint

    public void addSavepoint(java.lang.String name)

Create a savepoint that is linked to the current log position.

Parameters:
  `name` - the savepoint name

#### rollbackToSavepoint

    public void rollbackToSavepoint(java.lang.String name)

Undo all operations back to the log position of the given savepoint.

Parameters:
  `name` - the savepoint name

#### prepareCommit

    public void prepareCommit(java.lang.String transactionName)

Prepare the given transaction.

Parameters:
  `transactionName` - the name of the transaction

#### setPreparedTransaction

    public void setPreparedTransaction(java.lang.String transactionName,
                              boolean commit)

Commit or roll back the given transaction.

Parameters:
  `transactionName` - the name of the transaction
  `commit` - true for commit, false for rollback

#### isClosed

    public boolean isClosed()

Description copied from interface: `SessionInterface`
Check if close was called.

Specified by:
  `isClosed` in interface `SessionInterface`
Returns:
  if the session has been closed

#### isOpen

    public boolean isOpen()

#### setThrottle

    public void setThrottle(int throttle)

#### throttle

    public void throttle()

Wait for some time if this session is throttled (slowed down).

#### checkCanceled

    public void checkCanceled()

Check if the current transaction is canceled by calling Statement.cancel() or because a session timeout was set and expired.

Throws:
  `DbException` - if the transaction is canceled

#### getCancel

    public long getCancel()

Get the cancel time.

Returns:
  the time or 0 if not set

#### getCurrentCommand

    public Command getCurrentCommand()

#### getCurrentCommandStart

    public ValueTimestampTimeZone getCurrentCommandStart()

#### getAllowLiterals

    public boolean getAllowLiterals()

#### setAllowLiterals

    public void setAllowLiterals(boolean b)

#### setCurrentSchema

    public void setCurrentSchema(Schema schema)

#### getCurrentSchemaName

    public java.lang.String getCurrentSchemaName()

Description copied from interface: `SessionInterface`
Get current schema.

Specified by:
  `getCurrentSchemaName` in interface `SessionInterface`
Returns:
  the current schema name

#### setCurrentSchemaName

    public void setCurrentSchemaName(java.lang.String schemaName)

Description copied from interface: `SessionInterface`
Set current schema.

Specified by:
  `setCurrentSchemaName` in interface `SessionInterface`
Parameters:
  `schemaName` - the schema name

#### createConnection

    public JdbcConnection createConnection(boolean columnList)

Create an internal connection. This connection is used when initializing triggers, and when calling user defined functions.

Parameters:
  `columnList` - if the url should be 'jdbc:columnlist:connection'
Returns:
  the internal connection

#### getDataHandler

    public DataHandler getDataHandler()

Description copied from interface: `SessionInterface`
Get the data handler object.

Specified by:
  `getDataHandler` in interface `SessionInterface`
Returns:
  the data handler

#### removeAtCommit

    public void removeAtCommit(Value v)

Remember that the given LOB value must be removed at commit.

Parameters:
  `v` - the value

#### removeAtCommitStop

    public void removeAtCommitStop(Value v)

Do not remove this LOB value at commit any longer.

Parameters:
  `v` - the value

#### getNextSystemIdentifier

    public java.lang.String getNextSystemIdentifier(java.lang.String sql)

Get the next system generated identifiers. The identifier returned does not occur within the given SQL statement.

Parameters:
  `sql` - the SQL statement
Returns:
  the new identifier

#### addProcedure

    public void addProcedure(Procedure procedure)

Add a procedure to this session.

Parameters:
  `procedure` - the procedure to add

#### removeProcedure

    public void removeProcedure(java.lang.String name)

Remove a procedure from this session.

Parameters:
  `name` - the name of the procedure to remove

#### getProcedure

    public Procedure getProcedure(java.lang.String name)

Get the procedure with the given name, or null if none exists.

Parameters:
  `name` - the procedure name
Returns:
  the procedure or null

#### setSchemaSearchPath

    public void setSchemaSearchPath(java.lang.String[] schemas)

#### getSchemaSearchPath

    public java.lang.String[] getSchemaSearchPath()

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### setUndoLogEnabled

    public void setUndoLogEnabled(boolean b)

#### setRedoLogBinary

    public void setRedoLogBinary(boolean b)

#### isUndoLogEnabled

    public boolean isUndoLogEnabled()

#### begin

    public void begin()

Begin a transaction.

#### getSessionStart

    public long getSessionStart()

#### getTransactionStart

    public ValueTimestampTimeZone getTransactionStart()

#### getLocks

    public java.util.Set<Table> getLocks()

#### waitIfExclusiveModeEnabled

    public void waitIfExclusiveModeEnabled()

Wait if the exclusive mode has been enabled for another session. This method returns as soon as the exclusive mode has been disabled.

#### getViewIndexCache

    public java.util.Map<java.lang.Object,ViewIndex> getViewIndexCache(boolean subQuery)

Get the view cache for this session. There are two caches: the subquery cache (which is only use for a single query, has no bounds, and is cleared after use), and the cache for regular views.

Parameters:
  `subQuery` - true to get the subquery cache
Returns:
  the view cache

#### addTemporaryResult

    public void addTemporaryResult(ResultInterface result)

Remember the result set and close it as soon as the transaction is committed (if it needs to be closed). This is done to delete temporary files as soon as possible, and free object ids of temporary tables.

Parameters:
  `result` - the temporary result set

#### setQueryTimeout

    public void setQueryTimeout(int queryTimeout)

#### getQueryTimeout

    public int getQueryTimeout()

#### setWaitForLock

    public void setWaitForLock(Table waitForLock,
                      java.lang.Thread waitForLockThread)

Set the table this session is waiting for, and the thread that is waiting.

Parameters:
  `waitForLock` - the table
  `waitForLockThread` - the current thread (the one that is waiting)

#### getWaitForLock

    public Table getWaitForLock()

#### getWaitForLockThread

    public java.lang.Thread getWaitForLockThread()

#### getModificationId

    public int getModificationId()

#### getTransactionId

    public Value getTransactionId()

#### nextObjectId

    public int nextObjectId()

Get the next object id.

Returns:
  the next object id

#### isRedoLogBinaryEnabled

    public boolean isRedoLogBinaryEnabled()

#### getTransaction

    public Transaction getTransaction()

Get the transaction to use for this session.

Returns:
  the transaction

#### startStatementWithinTransaction

    public void startStatementWithinTransaction(Command command)

Start a new statement within a transaction.

Parameters:
  `command` - about to be started

#### endStatement

    public void endStatement()

Mark the statement as completed. This also close all temporary result set, and deletes all temporary files held by the result sets.

#### clearViewIndexCache

    public void clearViewIndexCache()

Clear the view cache for this session.

#### addTemporaryLob

    public void addTemporaryLob(Value v)

Description copied from interface: `SessionInterface`
Add a temporary LOB, which is closed when the session commits.

Specified by:
  `addTemporaryLob` in interface `SessionInterface`
Parameters:
  `v` - the value

#### isRemote

    public boolean isRemote()

Description copied from interface: `SessionInterface`
Check if this session is remote or embedded.

Specified by:
  `isRemote` in interface `SessionInterface`
Returns:
  true if this session is remote

#### markTableForAnalyze

    public void markTableForAnalyze(Table table)

Mark that the given table needs to be analyzed on commit.

Parameters:
  `table` - the table

#### getState

    public Session.State getState()

#### getBlockingSessionId

    public int getBlockingSessionId()

#### onRollback

    public void onRollback(MVMap<java.lang.Object,VersionedValue> map,
                  java.lang.Object key,
                  VersionedValue existingValue,
                  VersionedValue restoredValue)

Description copied from interface: `TransactionStore.RollbackListener`
Notified of a single map change (add/update/remove)

Specified by:
  `onRollback` in interface `TransactionStore.RollbackListener`
Parameters:
  `map` - modified
  `key` - of the modified entry
  `existingValue` - value in the map (null if delete is rolled back)
  `restoredValue` - value to be restored (null if add is rolled back)

#### getColumnNamerConfiguration

    public ColumnNamerConfiguration getColumnNamerConfiguration()

#### setColumnNamerConfiguration

    public void setColumnNamerConfiguration(ColumnNamerConfiguration columnNamerConfiguration)

#### isSupportsGeneratedKeys

    public boolean isSupportsGeneratedKeys()

Description copied from interface: `SessionInterface`
Returns is this session supports generated keys.

Specified by:
  `isSupportsGeneratedKeys` in interface `SessionInterface`
Returns:
  `true` if generated keys are supported, `false` if only `SCOPE_IDENTITY()` is supported

#### getNetworkConnectionInfo

    public NetworkConnectionInfo getNetworkConnectionInfo()

Returns the network connection information, or `null`.

Returns:
  the network connection information, or `null`

#### setNetworkConnectionInfo

    public void setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)

Description copied from interface: `SessionInterface`
Sets the network connection information if possible.

Specified by:
  `setNetworkConnectionInfo` in interface `SessionInterface`
Parameters:
  `networkConnectionInfo` - the network connection information

#### currentTimestamp

    public ValueTimestampTimeZone currentTimestamp()

Description copied from interface: `CastDataProvider`
Returns the current timestamp with maximum resolution. The value must be the same within a transaction or within execution of a command.

Specified by:
  `currentTimestamp` in interface `CastDataProvider`
Returns:
  the current timestamp for CURRENT_TIMESTAMP(9)

#### getMode

    public Mode getMode()

Description copied from interface: `CastDataProvider`
Returns the database mode.

Specified by:
  `getMode` in interface `CastDataProvider`
Returns:
  the database mode

#### getIsolationLevel

    public IsolationLevel getIsolationLevel()

Description copied from interface: `SessionInterface`
Returns the isolation level.

Specified by:
  `getIsolationLevel` in interface `SessionInterface`
Returns:
  the isolation level

#### setIsolationLevel

    public void setIsolationLevel(IsolationLevel isolationLevel)

Description copied from interface: `SessionInterface`
Sets the isolation level.

Specified by:
  `setIsolationLevel` in interface `SessionInterface`
Parameters:
  `isolationLevel` - the isolation level to set

#### recreateSessionState

    protected void recreateSessionState()

Re-create the session state using the stored sessionState list.

#### readSessionState

    public void readSessionState()

Read the session state if necessary.