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 |
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 |
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
|
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
|
Row |
createRow(Value[] data, int memory)
Create a new row for a table.
|
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
|
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()
|
ColumnNamerConfiguration |
getColumnNamerConfiguration()
|
ColumnNamerConfiguration |
getColumnNamerConfiguration()
|
Command |
getCurrentCommand()
|
Command |
getCurrentCommand()
|
ValueTimestampTimeZone |
getCurrentCommandStart()
|
ValueTimestampTimeZone |
getCurrentCommandStart()
|
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()
|
int |
getFirstUncommittedLog()
|
int |
getFirstUncommittedLog()
|
int |
getId()
|
int |
getId()
|
IsolationLevel |
getIsolationLevel()
|
IsolationLevel |
getIsolationLevel()
|
Value |
getLastIdentity()
|
Value |
getLastIdentity()
|
Value |
getLastScopeIdentity()
|
Value |
getLastScopeIdentity()
|
Value |
getLastTriggerIdentity()
|
Value |
getLastTriggerIdentity()
|
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()
|
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
|
String |
getParsingCreateViewName()
|
String |
getParsingCreateViewName()
|
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 |
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
|
Session.State |
getState()
|
Session.State |
getState()
|
SubQueryInfo |
getSubQueryInfo()
|
SubQueryInfo |
getSubQueryInfo()
|
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()
|
ValueTimestampTimeZone |
getTransactionStart()
|
ValueTimestampTimeZone |
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
|
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()
|
int |
hashCode()
|
int |
hashCode()
|
boolean |
isClosed()
|
boolean |
isClosed()
|
boolean |
isForceJoinOrder()
|
boolean |
isForceJoinOrder()
|
boolean |
isJoinBatchEnabled()
|
boolean |
isJoinBatchEnabled()
|
boolean |
isLazyQueryExecution()
|
boolean |
isLazyQueryExecution()
|
boolean |
isOpen()
|
boolean |
isOpen()
|
boolean |
isParsingCreateView()
|
boolean |
isParsingCreateView()
|
boolean |
isPreparingQueryExpression()
|
boolean |
isPreparingQueryExpression()
|
boolean |
isRedoLogBinaryEnabled()
|
boolean |
isRedoLogBinaryEnabled()
|
boolean |
isRemote()
|
boolean |
isRemote()
|
boolean |
isSupportsGeneratedKeys()
|
boolean |
isSupportsGeneratedKeys()
|
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
|
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)
|
void |
optimizeQueryExpression(Query query)
Optimize a query.
|
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
|
void |
popSubQueryInfo()
Remove the current subquery info from the stack.
|
void |
popSubQueryInfo()
Remove the current subquery info from the stack.
|
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 |
pushSubQueryInfo(int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder)
Add a subquery info on top of the subquery info stack.
|
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
|
void |
registerTableAsLocked(Table table)
Register table as updated within current transaction.
|
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
|
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(Value v)
Remember that the given LOB value must be removed at commit.
|
void |
removeAtCommit(Value v)
Remember that the given LOB value must be removed at commit.
Parameters:
v - the value
|
void |
removeAtCommitStop(Value v)
Do not remove this LOB value at commit any longer.
|
void |
removeAtCommitStop(Value 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 |
rollback()
Fully roll back the current transaction.
|
void |
rollback()
Fully roll back the current transaction.
|
void |
rollbackTo(Session.Savepoint savepoint)
Partially roll back the current transaction.
|
void |
rollbackTo(Session.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 |
setAllowLiterals(boolean b)
|
void |
setAllowLiterals(boolean b)
|
void |
setAutoCommit(boolean b)
|
void |
setAutoCommit(boolean b)
|
void |
setColumnNamerConfiguration(ColumnNamerConfiguration columnNamerConfiguration)
|
void |
setColumnNamerConfiguration(ColumnNamerConfiguration columnNamerConfiguration)
|
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 |
setCurrentValueFor(Sequence sequence, Value value)
Sets the current value of the sequence and last identity value for this
session.
|
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
|
void |
setForceJoinOrder(boolean forceJoinOrder)
|
void |
setForceJoinOrder(boolean forceJoinOrder)
|
void |
setIsolationLevel(IsolationLevel isolationLevel)
|
void |
setIsolationLevel(IsolationLevel isolationLevel)
|
void |
setJoinBatchEnabled(boolean joinBatchEnabled)
|
void |
setJoinBatchEnabled(boolean joinBatchEnabled)
|
void |
setLastIdentity(Value last)
|
void |
setLastIdentity(Value last)
|
void |
setLastScopeIdentity(Value last)
|
void |
setLastScopeIdentity(Value last)
|
void |
setLastTriggerIdentity(Value last)
|
void |
setLastTriggerIdentity(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 |
setParsingCreateView(boolean parsingView, String viewName)
Stores name of currently parsed view in a stack so it can be determined
during
|
void |
setParsingCreateView(boolean parsingView, String viewName)
Stores name of currently parsed view in a stack so it can be determined
during {@code prepare()}.
Parameters:
parsingView - {@code true} to store one more name, {@code false} to remove it
from stack
viewName - name of the view
|
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(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.
|