Session

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.

Methods
void addLocalTempTable(Table table)
Add a local temporary table to this session.
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
void addLocalTempTableConstraint(Constraint constraint)
Add a local temporary constraint to this session.
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
void addLocalTempTableIndex(Index index)
Add a local temporary index to this session.
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
void addLock(Table table)
Add a lock for the given table.
void addLock(Table table)
Add a lock for the given table. The object is unlocked on commit or rollback.
Parameters:
table - the table that is locked
void addLogPos(int logId, int pos)
Called when a log entry for this session is added.
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
void addProcedure(Procedure procedure)
Add a procedure to this session.
void addProcedure(Procedure procedure)
Add a procedure to this session.
Parameters:
procedure - the procedure to add
void addSavepoint(String name)
Create a savepoint that is linked to the current log position.
void addSavepoint(String name)
Create a savepoint that is linked to the current log position.
Parameters:
name - the savepoint name
void addTemporaryLob(Value v)
void addTemporaryLob(Value v)
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 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
void afterWriting()
void afterWriting()
void begin()
Begin a transaction.
void begin()
Begin a transaction.
void cancel()
void cancel()
void checkCanceled()
Check if the current transaction is canceled by calling Statement.cancel() or because a session timeout was set and expired.
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
void close()
void close()
void commit(boolean ddl)
Commit the current transaction.
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
boolean containsUncommitted()
Whether the session contains any uncommitted changes.
boolean containsUncommitted()
Whether the session contains any uncommitted changes.
Returns:
true if yes
JdbcConnection createConnection(boolean columnList)
Create an internal connection.
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
void endStatement()
Mark the statement as completed.
void endStatement()
Mark the statement as completed. This also close all temporary result set, and deletes all temporary files held by the result sets.
Table findLocalTempTable(String name)
Get the local temporary table if one exists with that name, or null if not.
Table findLocalTempTable(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
Constraint findLocalTempTableConstraint(String name)
Get the local temporary constraint if one exists with that name, or null if not.
Constraint findLocalTempTableConstraint(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
Index findLocalTempTableIndex(String name)
Get the local temporary index if one exists with that name, or null if not.
Index findLocalTempTableIndex(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
boolean getAllowLiterals()
boolean getAllowLiterals()
boolean getAutoCommit()
boolean getAutoCommit()
long getCancel()
Get the cancel time.
long getCancel()
Get the cancel time.
Returns:
the time or 0 if not set
Command getCurrentCommand()
Command getCurrentCommand()
long getCurrentCommandStart()
long getCurrentCommandStart()
String getCurrentSchemaName()
String getCurrentSchemaName()
DataHandler getDataHandler()
DataHandler getDataHandler()
Database getDatabase()
Database getDatabase()
int getFirstUncommittedLog()
int getFirstUncommittedLog()
int getId()
int getId()
Value getLastIdentity()
Value getLastIdentity()
Value getLastScopeIdentity()
Value getLastScopeIdentity()
HashMap getLocalTempTableConstraints()
Get the map of constraints for all constraints on local, temporary tables, if any.
HashMap 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
HashMap getLocalTempTableIndexes()
HashMap getLocalTempTableIndexes()
ArrayList getLocalTempTables()
ArrayList getLocalTempTables()
int getLockTimeout()
int getLockTimeout()
Table[] getLocks()
Table[] getLocks()
int getModificationId()
int getModificationId()
String getNextSystemIdentifier(String sql)
Get the next system generated identifiers.
String getNextSystemIdentifier(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
int getPowerOffCount()
int getPowerOffCount()
Procedure getProcedure(String name)
Get the procedure with the given name, or null if none exists.
Procedure getProcedure(String name)
Get the procedure with the given name, or null if none exists.
Parameters:
name - the procedure name
Returns:
the procedure or null
int getQueryTimeout()
int getQueryTimeout()
Random getRandom()
Random getRandom()
String[] getSchemaSearchPath()
String[] getSchemaSearchPath()
long getSessionStart()
long getSessionStart()
long getStatementSavepoint()
long getStatementSavepoint()
Trace getTrace()
Trace getTrace()
TransactionStore.Transaction getTransaction()
Get the transaction to use for this session.
TransactionStore.Transaction getTransaction()
Get the transaction to use for this session.
Returns:
the transaction
Value getTransactionId()
Value getTransactionId()
long getTransactionStart()
long getTransactionStart()
User getUser()
User getUser()
Value getVariable(String name)
Get the value of the specified user defined variable.
Value getVariable(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
String[] getVariableNames()
Get the list of variable names that are set for this session.
String[] getVariableNames()
Get the list of variable names that are set for this session.
Returns:
the list of names
Table getWaitForLock()
Table getWaitForLock()
Thread getWaitForLockThread()
Thread getWaitForLockThread()
boolean hasPendingTransaction()
boolean hasPendingTransaction()
int hashCode()
int hashCode()
boolean isClosed()
boolean isClosed()
boolean isReconnectNeeded(boolean write)
boolean isReconnectNeeded(boolean write)
boolean isRedoLogBinaryEnabled()
boolean isRedoLogBinaryEnabled()
boolean isUndoLogEnabled()
boolean isUndoLogEnabled()
void log(Table table, short operation, Row row)
Add an undo log entry to this session.
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 {@link UndoLogRecord})
row - the row
int nextObjectId()
Get the next object id.
int nextObjectId()
Get the next object id.
Returns:
the next object id
Prepared prepare(String sql)
Parse and prepare the given SQL statement.
Prepared prepare(String sql)
Parse and prepare the given SQL statement. This method also checks the rights.
Parameters:
sql - the SQL statement
Returns:
the prepared statement
Prepared prepare(String sql, boolean rightsChecked)
Parse and prepare the given SQL statement.
Prepared prepare(String sql, boolean rightsChecked)
Parse and prepare the given SQL statement.
Parameters:
sql - the SQL statement
rightsChecked - true if the rights have already been checked
Returns:
the prepared statement
CommandInterface prepareCommand(String sql, int fetchSize)
CommandInterface prepareCommand(String sql, int fetchSize)
void prepareCommit(String transactionName)
Prepare the given transaction.
void prepareCommit(String transactionName)
Prepare the given transaction.
Parameters:
transactionName - the name of the transaction
Command prepareLocal(String sql)
Parse and prepare the given SQL statement.
Command prepareLocal(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
SessionInterface reconnect(boolean write)
SessionInterface reconnect(boolean write)
void removeLocalTempTable(Table table)
Drop and remove the given local temporary table from this session.
void removeLocalTempTable(Table table)
Drop and remove the given local temporary table from this session.
Parameters:
table - the table
void removeLocalTempTableIndex(Index index)
Drop and remove the given local temporary index from this session.
void removeLocalTempTableIndex(Index index)
Drop and remove the given local temporary index from this session.
Parameters:
index - the index
void removeProcedure(String name)
Remove a procedure from this session.
void removeProcedure(String name)
Remove a procedure from this session.
Parameters:
name - the name of the procedure to remove
void rollback()
Fully roll back the current transaction.
void rollback()
Fully roll back the current transaction.
void rollbackTo(Session.Savepoint savepoint, boolean trimToSize)
Partially roll back the current transaction.
void rollbackTo(Session.Savepoint savepoint, boolean trimToSize)
Partially roll back the current transaction.
Parameters:
savepoint - the savepoint to which should be rolled back
trimToSize - if the list should be trimmed
void rollbackToSavepoint(String name)
Undo all operations back to the log position of the given savepoint.
void rollbackToSavepoint(String name)
Undo all operations back to the log position of the given savepoint.
Parameters:
name - the savepoint name
void setAllowLiterals(boolean b)
void setAllowLiterals(boolean b)
void setAutoCommit(boolean b)
void setAutoCommit(boolean b)
boolean setCommitOrRollbackDisabled(boolean x)
boolean setCommitOrRollbackDisabled(boolean x)
void setConnectionInfo(ConnectionInfo ci)
void setConnectionInfo(ConnectionInfo ci)
void setCurrentCommand(Command command)
Set the current command of this session.
void setCurrentCommand(Command command)
Set the current command of this session. This is done just before executing the statement.
Parameters:
command - the command
void setCurrentSchema(Schema schema)
void setCurrentSchema(Schema schema)
void setLastIdentity(Value last)
void setLastIdentity(Value last)
void setLastScopeIdentity(Value last)
void setLastScopeIdentity(Value last)
void setLockTimeout(int lockTimeout)
void setLockTimeout(int lockTimeout)
void setPowerOffCount(int count)
void setPowerOffCount(int count)
void setPreparedTransaction(String transactionName, boolean commit)
Commit or roll back the given transaction.
void setPreparedTransaction(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
void setQueryTimeout(int queryTimeout)
void setQueryTimeout(int queryTimeout)
void setRedoLogBinary(boolean b)
void setRedoLogBinary(boolean b)
Session.Savepoint setSavepoint()
Create a savepoint to allow rolling back to this state.
Session.Savepoint setSavepoint()
Create a savepoint to allow rolling back to this state.
Returns:
the savepoint
void setSchemaSearchPath(String[] schemas)
void setSchemaSearchPath(String[] schemas)
void setThrottle(int throttle)
void setThrottle(int throttle)
void setUndoLogEnabled(boolean b)
void setUndoLogEnabled(boolean b)
void setVariable(String name, Value value)
Set the value of the given variable for this session.
void setVariable(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)
void setWaitForLock(Table waitForLock, Thread waitForLockThread)
Set the table this session is waiting for, and the thread that is waiting.
void setWaitForLock(Table waitForLock, 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)
void startStatementWithinTransaction()
Start a new statement within a transaction.
void startStatementWithinTransaction()
Start a new statement within a transaction.
void throttle()
Wait for some time if this session is throttled (slowed down).
void throttle()
Wait for some time if this session is throttled (slowed down).
String toString()
String toString()
void unlinkAtCommit(Value v)
Remember that the given LOB value must be un-linked (disconnected from the table) at commit.
void unlinkAtCommit(Value v)
Remember that the given LOB value must be un-linked (disconnected from the table) at commit.
Parameters:
v - the value
void unlinkAtCommitStop(Value v)
Do not unlink this LOB value at commit any longer.
void unlinkAtCommitStop(Value v)
Do not unlink this LOB value at commit any longer.
Parameters:
v - the value
void unlockReadLocks()
Unlock all read locks.
void unlockReadLocks()
Unlock all read locks. This is done if the transaction isolation mode is READ_COMMITTED.
void waitIfExclusiveModeEnabled()
Wait if the exclusive mode has been enabled for another session.
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.

Fields
static int LOG_WRITTEN = -1

LOG_WRITTEN = -1

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