SessionLocal

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 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
ValueLob addTemporaryLob(ValueLob v)
ValueLob addTemporaryLob(ValueLob v)
boolean areEqual(Value a, Value b)
Check if two values are equal with the current comparison mode.
boolean areEqual(Value a, Value b)
Check if two values are equal with the current comparison mode.
Parameters:
a - the first value
b - the second value
Returns:
true if both objects are equal
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 clearViewIndexCache()
Clear the view cache for this session.
void clearViewIndexCache()
Clear the view cache for this session.
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
int compare(Value a, Value b)
Compare two values with the current comparison mode.
int compare(Value a, Value b)
Compare two values with the current comparison mode. The values may have different data types including NULL.
Parameters:
a - the first value
b - the second value
Returns:
0 if both values are equal, -1 if the first value is smaller, and 1 otherwise
int compareTypeSafe(Value a, Value b)
Compare two values with the current comparison mode.
int compareTypeSafe(Value a, Value b)
Compare two values with the current comparison mode. The values must be of the same type.
Parameters:
a - the first value
b - the second value
Returns:
0 if both values are equal, -1 if the first value is smaller, and 1 otherwise
int compareWithNull(Value a, Value b, boolean forEquality)
Compare two values with the current comparison mode.
int compareWithNull(Value a, Value b, boolean forEquality)
Compare two values with the current comparison mode. The values may have different data types including NULL.
Parameters:
a - the first value
b - the second value
forEquality - perform only check for equality (= or <>)
Returns:
0 if both values are equal, -1 if the first value is smaller, 1 if the second value is larger, {@link Integer#MIN_VALUE} if order is not defined due to NULL comparison
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
TimeZoneProvider currentTimeZone()
TimeZoneProvider currentTimeZone()
ValueTimestampTimeZone currentTimestamp()
ValueTimestampTimeZone currentTimestamp()
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()
int getBlockingSessionId()
int getBlockingSessionId()
long getCancel()
Get the cancel time.
long getCancel()
Get the cancel time.
Returns:
the time or 0 if not set
ArrayList getClusterServers()
ArrayList getClusterServers()
ValueTimestampTimeZone getCommandStartOrEnd()
ValueTimestampTimeZone getCommandStartOrEnd()
Command getCurrentCommand()
Command getCurrentCommand()
String getCurrentSchemaName()
String getCurrentSchemaName()
Value getCurrentValueFor(Sequence sequence)
Returns the current value of the sequence in this session.
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
DataHandler getDataHandler()
DataHandler getDataHandler()
Database getDatabase()
Database getDatabase()
DatabaseMeta getDatabaseMeta()
DatabaseMeta getDatabaseMeta()
Session.DynamicSettings getDynamicSettings()
Session.DynamicSettings getDynamicSettings()
int getId()
int getId()
IsolationLevel getIsolationLevel()
IsolationLevel getIsolationLevel()
JavaObjectSerializer getJavaObjectSerializer()
JavaObjectSerializer getJavaObjectSerializer()
Value getLastIdentity()
Value getLastIdentity()
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()
List getLocalTempTables()
List getLocalTempTables()
int getLockTimeout()
int getLockTimeout()
Set getLocks()
Set getLocks()
Mode getMode()
Mode getMode()
int getModificationId()
int getModificationId()
NetworkConnectionInfo getNetworkConnectionInfo()
Returns the network connection information, or
NetworkConnectionInfo getNetworkConnectionInfo()
Returns the network connection information, or {@code null}.
Returns:
the network connection information, or {@code null}
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
Value getNextValueFor(Sequence sequence, Prepared prepared)
Returns the next value of the sequence in this session.
Value getNextValueFor(Sequence sequence, Prepared prepared)
Returns the next value of the sequence in this session.
Parameters:
sequence - the sequence
prepared - current prepared command, select, or {@code null}
Returns:
the next value of the sequence in this session
BitSet getNonKeywords()
Gets bit set of non-keywords.
BitSet getNonKeywords()
Gets bit set of non-keywords.
Returns:
set of non-keywords, or {@code null}
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()
ValueTimestampTimeZone getSessionStart()
ValueTimestampTimeZone getSessionStart()
long getSnapshotDataModificationId()
Returns the data modification id of transaction's snapshot, or 0 if isolation level doesn't use snapshots.
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
SessionLocal.State getState()
SessionLocal.State getState()
Session.StaticSettings getStaticSettings()
Session.StaticSettings getStaticSettings()
Trace getTrace()
Trace getTrace()
Transaction getTransaction()
Get the transaction to use for this session.
Transaction getTransaction()
Get the transaction to use for this session.
Returns:
the transaction
Value getTransactionId()
Value getTransactionId()
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
Map getViewIndexCache(boolean subQuery)
Get the view cache for this session.
Map 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
Table getWaitForLock()
Table getWaitForLock()
Thread getWaitForLockThread()
Thread getWaitForLockThread()
boolean hasPendingTransaction()
boolean hasPendingTransaction()
boolean hasPreparedTransaction()
Checks presence of prepared transaction in this session.
boolean hasPreparedTransaction()
Checks presence of prepared transaction in this session.
Returns:
{@code true} if there is a prepared transaction, {@code false} otherwise
int hashCode()
int hashCode()
boolean isClosed()
boolean isClosed()
boolean isForceJoinOrder()
boolean isForceJoinOrder()
boolean isLazyQueryExecution()
boolean isLazyQueryExecution()
boolean isOldInformationSchema()
boolean isOldInformationSchema()
boolean isOpen()
boolean isOpen()
boolean isParsingCreateView()
boolean isParsingCreateView()
boolean isQuirksMode()
Returns whether quirks mode is enabled explicitly or implicitly.
boolean isQuirksMode()
Returns whether quirks mode is enabled explicitly or implicitly.
Returns:
{@code true} if database is starting or quirks mode was enabled explicitly, {@code false} otherwise
boolean isRemote()
boolean isRemote()
boolean isTruncateLargeLength()
Returns parsing mode of data types with too large length.
boolean isTruncateLargeLength()
Returns parsing mode of data types with too large length.
Returns:
{@code true} if large length is truncated, {@code false} if an exception is thrown
boolean isVariableBinary()
Returns BINARY data type parsing mode.
boolean isVariableBinary()
Returns BINARY data type parsing mode.
Returns:
{@code true} if BINARY should be parsed as VARBINARY, {@code false} if it should be parsed as is
void markTableForAnalyze(Table table)
Mark that the given table needs to be analyzed on commit.
void markTableForAnalyze(Table table)
Mark that the given table needs to be analyzed on commit.
Parameters:
table - the table
int nextObjectId()
Get the next object id.
int nextObjectId()
Get the next object id.
Returns:
the next object id
void onRollback(MVMap map, Object key, VersionedValue existingValue, VersionedValue restoredValue)
void onRollback(MVMap map, Object key, VersionedValue existingValue, VersionedValue restoredValue)
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, boolean literalsChecked)
Parse and prepare the given SQL statement.
Prepared prepare(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
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
void registerTableAsLocked(Table table)
Register table as locked within current transaction.
void registerTableAsLocked(Table table)
Register table as locked 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
void registerTableAsUpdated(Table table)
Register table as updated within current transaction.
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
void removeAtCommit(ValueLob v)
Remember that the given LOB value must be removed at commit.
void removeAtCommit(ValueLob v)
Remember that the given LOB value must be removed at commit.
Parameters:
v - the value
void removeAtCommitStop(ValueLob v)
Do not remove this LOB value at commit any longer.
void removeAtCommitStop(ValueLob v)
Do not remove this LOB value at commit any longer.
Parameters:
v - the value
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 resetThreadLocalSession(Session oldSession)
void resetThreadLocalSession(Session oldSession)
void rollback()
Fully roll back the current transaction.
void rollback()
Fully roll back the current transaction.
void rollbackTo(SessionLocal.Savepoint savepoint)
Partially roll back the current transaction.
void rollbackTo(SessionLocal.Savepoint savepoint)
Partially roll back the current transaction.
Parameters:
savepoint - the savepoint to which should be rolled back
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 scheduleDatabaseObjectIdForRelease(int id)
Arranges for the specified database object id to be released at the end of the current transaction.
void scheduleDatabaseObjectIdForRelease(int id)
Arranges for the specified database object id to be released at the end of the current transaction.
Parameters:
id - to be scheduled
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 setCurrentSchema(Schema schema)
void setCurrentSchema(Schema schema)
void setCurrentSchemaName(String schemaName)
void setCurrentSchemaName(String schemaName)
void setForceJoinOrder(boolean forceJoinOrder)
void setForceJoinOrder(boolean forceJoinOrder)
void setIsolationLevel(IsolationLevel isolationLevel)
void setIsolationLevel(IsolationLevel isolationLevel)
void setLastIdentity(Value last)
void setLastIdentity(Value last)
void setLazyQueryExecution(boolean lazyQueryExecution)
void setLazyQueryExecution(boolean lazyQueryExecution)
void setLockTimeout(int lockTimeout)
void setLockTimeout(int lockTimeout)
void setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)
void setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)
void setNonKeywords(BitSet nonKeywords)
Sets bit set of non-keywords.
void setNonKeywords(BitSet nonKeywords)
Sets bit set of non-keywords.
Parameters:
nonKeywords - set of non-keywords, or {@code null}
void setOldInformationSchema(boolean oldInformationSchema)
Changes INFORMATION_SCHEMA content.
void setOldInformationSchema(boolean oldInformationSchema)
Changes INFORMATION_SCHEMA content.
Parameters:
oldInformationSchema - {@code true} to have old-style tables in INFORMATION_SCHEMA, {@code false} to have modern tables
void setParsingCreateView(boolean parsingView)
This method is called before and after parsing of view definition and may be called recursively.
void setParsingCreateView(boolean parsingView)
This method is called before and after parsing of view definition and may be called recursively.
Parameters:
parsingView - {@code true} if this method is called before parsing of view definition, {@code false} if it is called after it.
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 setQuirksMode(boolean quirksMode)
Enables or disables the quirks mode.
void setQuirksMode(boolean quirksMode)
Enables or disables the quirks mode.
Parameters:
quirksMode - whether quirks mode should be enabled
SessionLocal.Savepoint setSavepoint()
Create a savepoint to allow rolling back to this state.
SessionLocal.Savepoint setSavepoint()
Create a savepoint to allow rolling back to this state.
Returns:
the savepoint
void setSchemaSearchPath(String[] schemas)
void setSchemaSearchPath(String[] schemas)
Session setThreadLocalSession()
Session setThreadLocalSession()
void setThrottle(int throttle)
void setThrottle(int throttle)
void setTimeZone(TimeZoneProvider timeZone)
Sets current time zone.
void setTimeZone(TimeZoneProvider timeZone)
Sets current time zone.
Parameters:
timeZone - time zone
void setTruncateLargeLength(boolean truncateLargeLength)
Changes parsing mode of data types with too large length.
void setTruncateLargeLength(boolean truncateLargeLength)
Changes parsing mode of data types with too large length.
Parameters:
truncateLargeLength - {@code true} to truncate to valid bound, {@code false} to throw an exception
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 setVariableBinary(boolean variableBinary)
Changes parsing of a BINARY data type.
void setVariableBinary(boolean variableBinary)
Changes parsing of a BINARY data type.
Parameters:
variableBinary - {@code true} to parse BINARY as VARBINARY, {@code false} to parse it as is
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(Command command)
Start a new statement within a transaction.
void startStatementWithinTransaction(Command command)
Start a new statement within a transaction.
Parameters:
command - about to be started
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 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.
boolean zeroBasedEnums()
boolean zeroBasedEnums()