public final class SessionLocal extends Session implements TransactionStore.RollbackListener
| Modifier and Type | Class and Description |
|---|---|
static class |
SessionLocal.Savepoint
Represents a savepoint (a position in a transaction to where one can roll
back to).
|
static class |
SessionLocal.State |
static class |
SessionLocal.TimeoutValue
An LOB object with a timeout.
|
Session.DynamicSettings, Session.StaticSettings| Constructor and Description |
|---|
SessionLocal(Database database,
User user,
int id) |
| Modifier and Type | Method and Description |
|---|---|
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 |
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.
|
ValueLob |
addTemporaryLob(ValueLob v)
Add a temporary LOB, which is closed when the session commits.
|
boolean |
areEqual(Value a,
Value b)
Check if two values are equal with the current comparison mode.
|
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.
|
int |
compare(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.
|
int |
compareWithNull(Value a,
Value b,
boolean forEquality)
Compare two values with the current comparison mode.
|
boolean |
containsUncommitted()
Whether the session contains any uncommitted changes.
|
JdbcConnection |
createConnection(boolean columnList)
Create an internal connection.
|
ValueTimestampTimeZone |
currentTimestamp()
Returns the current timestamp with maximum resolution.
|
TimeZoneProvider |
currentTimeZone()
Returns the current time zone.
|
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.
|
ValueTimestampTimeZone |
getCommandStartOrEnd() |
Command |
getCurrentCommand() |
java.lang.String |
getCurrentSchemaName()
Get current schema.
|
Value |
getCurrentValueFor(Sequence sequence)
Returns the current value of the sequence in this session.
|
Database |
getDatabase() |
DatabaseMeta |
getDatabaseMeta()
Returns database meta information.
|
DataHandler |
getDataHandler()
Get the data handler object.
|
Session.DynamicSettings |
getDynamicSettings()
Returns dynamic settings.
|
int |
getId() |
IsolationLevel |
getIsolationLevel()
Returns the isolation level.
|
JavaObjectSerializer |
getJavaObjectSerializer()
Returns the custom Java object serializer, or
null. |
Value |
getLastIdentity() |
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.List<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.
|
Value |
getNextValueFor(Sequence sequence,
Prepared prepared)
Returns the next value of the sequence in this session.
|
java.util.BitSet |
getNonKeywords()
Gets bit set of non-keywords.
|
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() |
ValueTimestampTimeZone |
getSessionStart() |
long |
getSnapshotDataModificationId()
Returns the data modification id of transaction's snapshot, or 0 if
isolation level doesn't use snapshots.
|
SessionLocal.State |
getState() |
Session.StaticSettings |
getStaticSettings()
Returns static settings.
|
Trace |
getTrace()
Get the trace object
|
Transaction |
getTransaction()
Get the transaction to use for this session.
|
Value |
getTransactionId() |
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,QueryExpressionIndex> |
getViewIndexCache(boolean derivedTable)
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 |
hasPreparedTransaction()
Checks presence of prepared transaction in this session.
|
boolean |
isClosed()
Check if close was called.
|
boolean |
isLazyQueryExecution() |
boolean |
isOldInformationSchema()
Returns whether INFORMATION_SCHEMA contains old-style tables.
|
boolean |
isOpen() |
boolean |
isParsingCreateView() |
boolean |
isQuirksMode()
Returns whether quirks mode is enabled explicitly or implicitly.
|
boolean |
isRemote()
Check if this session is remote or embedded.
|
boolean |
isTruncateLargeLength()
Returns parsing mode of data types with too large length.
|
boolean |
isVariableBinary()
Returns BINARY data type parsing mode.
|
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<java.lang.Object>> map,
java.lang.Object key,
VersionedValue<java.lang.Object> existingValue,
VersionedValue<java.lang.Object> restoredValue)
Notified of a single map change (add/update/remove)
|
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.
|
Query |
prepareQueryExpression(java.lang.String sql)
Parse a query and prepare its expressions.
|
void |
registerTableAsLocked(Table table)
Register table as locked within current transaction.
|
void |
registerTableAsUpdated(Table table)
Register table as updated within current transaction.
|
void |
removeAtCommit(ValueLob v)
Remember that the given LOB value must be removed at commit.
|
void |
removeAtCommitStop(ValueLob 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 |
resetThreadLocalSession(Session oldSession)
Resets old thread local session.
|
void |
rollback()
Fully roll back the current transaction.
|
void |
rollbackTo(SessionLocal.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.
|
boolean |
setCommitOrRollbackDisabled(boolean x) |
void |
setCurrentSchema(Schema schema) |
void |
setCurrentSchemaName(java.lang.String schemaName)
Set current schema.
|
void |
setIsolationLevel(IsolationLevel isolationLevel)
Sets the isolation level.
|
void |
setLastIdentity(Value last) |
void |
setLazyQueryExecution(boolean lazyQueryExecution) |
void |
setLockTimeout(int lockTimeout) |
void |
setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)
Sets the network connection information if possible.
|
void |
setNonKeywords(java.util.BitSet nonKeywords)
Sets bit set of non-keywords.
|
void |
setOldInformationSchema(boolean oldInformationSchema)
Changes INFORMATION_SCHEMA content.
|
void |
setParsingCreateView(boolean parsingView)
This method is called before and after parsing of view definition and may
be called recursively.
|
void |
setPreparedTransaction(java.lang.String transactionName,
boolean commit)
Commit or roll back the given transaction.
|
void |
setQueryTimeout(int queryTimeout) |
void |
setQuirksMode(boolean quirksMode)
Enables or disables the quirks mode.
|
SessionLocal.Savepoint |
setSavepoint()
Create a savepoint to allow rolling back to this state.
|
void |
setSchemaSearchPath(java.lang.String[] schemas) |
Session |
setThreadLocalSession()
Sets this session as thread local session, if this session is a local
session.
|
void |
setThrottle(int throttle) |
void |
setTimeZone(TimeZoneProvider timeZone)
Sets current time zone.
|
void |
setTruncateLargeLength(boolean truncateLargeLength)
Changes parsing mode of data types with too large length.
|
void |
setVariable(java.lang.String name,
Value value)
Set the value of the given variable for this session.
|
void |
setVariableBinary(boolean variableBinary)
Changes parsing of a BINARY data type.
|
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.
|
boolean |
zeroBasedEnums()
Returns are ENUM values 0-based.
|
isLockedByCurrentThread, lock, readSessionState, unlockpublic void setLazyQueryExecution(boolean lazyQueryExecution)
public boolean isLazyQueryExecution()
public void setParsingCreateView(boolean parsingView)
parsingView - true if this method is called before parsing of view
definition, false if it is called after it.public boolean isParsingCreateView()
public java.util.ArrayList<java.lang.String> getClusterServers()
SessiongetClusterServers in class Sessionpublic boolean setCommitOrRollbackDisabled(boolean x)
public void setVariable(java.lang.String name,
Value value)
name - the name of the variable (may not be null)value - the new value (may not be null)public Value getVariable(java.lang.String name)
name - the variable namepublic java.lang.String[] getVariableNames()
public Table findLocalTempTable(java.lang.String name)
name - the table namepublic java.util.List<Table> getLocalTempTables()
public void addLocalTempTable(Table table)
table - the table to addDbException - if a table with this name already existspublic void removeLocalTempTable(Table table)
table - the tablepublic Index findLocalTempTableIndex(java.lang.String name)
name - the table namepublic java.util.HashMap<java.lang.String,Index> getLocalTempTableIndexes()
public void addLocalTempTableIndex(Index index)
index - the index to addDbException - if a index with this name already existspublic void removeLocalTempTableIndex(Index index)
index - the indexpublic Constraint findLocalTempTableConstraint(java.lang.String name)
name - the constraint namepublic java.util.HashMap<java.lang.String,Constraint> getLocalTempTableConstraints()
public void addLocalTempTableConstraint(Constraint constraint)
constraint - the constraint to addDbException - if a constraint with the same name already existspublic boolean getAutoCommit()
SessiongetAutoCommit in class Sessionpublic User getUser()
public void setAutoCommit(boolean b)
SessionsetAutoCommit in class Sessionb - the new valuepublic int getLockTimeout()
public void setLockTimeout(int lockTimeout)
public CommandInterface prepareCommand(java.lang.String sql, int fetchSize)
SessionprepareCommand in class Sessionsql - the SQL statementfetchSize - the number of rows to fetch in one steppublic Prepared prepare(java.lang.String sql)
sql - the SQL statementpublic Prepared prepare(java.lang.String sql, boolean rightsChecked, boolean literalsChecked)
sql - the SQL statementrightsChecked - true if the rights have already been checkedliteralsChecked - true if the sql string has already been checked
for literals (only used if ALLOW_LITERALS NONE is set).public Query prepareQueryExpression(java.lang.String sql)
sql - the SQL statementpublic Command prepareLocal(java.lang.String sql)
sql - the SQL statementpublic Database getDatabase()
public void commit(boolean ddl)
ddl - if the statement was a data definition statementpublic long getSnapshotDataModificationId()
public void rollback()
public void rollbackTo(SessionLocal.Savepoint savepoint)
savepoint - the savepoint to which should be rolled backpublic boolean hasPendingTransaction()
SessionhasPendingTransaction in class Sessionpublic SessionLocal.Savepoint setSavepoint()
public int getId()
public void cancel()
Sessionpublic void close()
Sessionpublic void registerTableAsLocked(Table table)
table - the table that is lockedpublic void registerTableAsUpdated(Table table)
table - to registerpublic java.util.Random getRandom()
public Value getNextValueFor(Sequence sequence, Prepared prepared)
sequence - the sequenceprepared - current prepared command, select, or nullpublic Value getCurrentValueFor(Sequence sequence)
sequence - the sequenceDbException - if current value is not definedpublic void setLastIdentity(Value last)
public Value getLastIdentity()
public boolean containsUncommitted()
public void addSavepoint(java.lang.String name)
name - the savepoint namepublic void rollbackToSavepoint(java.lang.String name)
name - the savepoint namepublic void prepareCommit(java.lang.String transactionName)
transactionName - the name of the transactionpublic boolean hasPreparedTransaction()
true if there is a prepared transaction,
false otherwisepublic void setPreparedTransaction(java.lang.String transactionName,
boolean commit)
transactionName - the name of the transactioncommit - true for commit, false for rollbackpublic boolean isClosed()
Sessionpublic boolean isOpen()
public void setThrottle(int throttle)
public void throttle()
public void checkCanceled()
DbException - if the transaction is canceledpublic long getCancel()
public Command getCurrentCommand()
public ValueTimestampTimeZone getCommandStartOrEnd()
public boolean getAllowLiterals()
public void setAllowLiterals(boolean b)
public void setCurrentSchema(Schema schema)
public java.lang.String getCurrentSchemaName()
SessiongetCurrentSchemaName in class Sessionpublic void setCurrentSchemaName(java.lang.String schemaName)
SessionsetCurrentSchemaName in class SessionschemaName - the schema namepublic JdbcConnection createConnection(boolean columnList)
columnList - if the url should be 'jdbc:columnlist:connection'public DataHandler getDataHandler()
SessiongetDataHandler in class Sessionpublic void removeAtCommit(ValueLob v)
v - the valuepublic void removeAtCommitStop(ValueLob v)
v - the valuepublic java.lang.String getNextSystemIdentifier(java.lang.String sql)
sql - the SQL statementpublic void addProcedure(Procedure procedure)
procedure - the procedure to addpublic void removeProcedure(java.lang.String name)
name - the name of the procedure to removepublic Procedure getProcedure(java.lang.String name)
name - the procedure namepublic void setSchemaSearchPath(java.lang.String[] schemas)
public java.lang.String[] getSchemaSearchPath()
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void begin()
public ValueTimestampTimeZone getSessionStart()
public java.util.Set<Table> getLocks()
public void waitIfExclusiveModeEnabled()
public java.util.Map<java.lang.Object,QueryExpressionIndex> getViewIndexCache(boolean derivedTable)
derivedTable - true to get the cache of derived tablespublic void setQueryTimeout(int queryTimeout)
public int getQueryTimeout()
public void setWaitForLock(Table waitForLock, java.lang.Thread waitForLockThread)
waitForLock - the tablewaitForLockThread - the current thread (the one that is waiting)public Table getWaitForLock()
public java.lang.Thread getWaitForLockThread()
public int getModificationId()
public Value getTransactionId()
public int nextObjectId()
public Transaction getTransaction()
public void startStatementWithinTransaction(Command command)
command - about to be startedpublic void endStatement()
public void clearViewIndexCache()
public ValueLob addTemporaryLob(ValueLob v)
SessionaddTemporaryLob in class Sessionv - the valuepublic boolean isRemote()
Sessionpublic void markTableForAnalyze(Table table)
table - the tablepublic SessionLocal.State getState()
public int getBlockingSessionId()
public void onRollback(MVMap<java.lang.Object,VersionedValue<java.lang.Object>> map, java.lang.Object key, VersionedValue<java.lang.Object> existingValue, VersionedValue<java.lang.Object> restoredValue)
TransactionStore.RollbackListeneronRollback in interface TransactionStore.RollbackListenermap - modifiedkey - of the modified entryexistingValue - value in the map (null if delete is rolled back)restoredValue - value to be restored (null if add is rolled back)public NetworkConnectionInfo getNetworkConnectionInfo()
null.nullpublic void setNetworkConnectionInfo(NetworkConnectionInfo networkConnectionInfo)
SessionsetNetworkConnectionInfo in class SessionnetworkConnectionInfo - the network connection informationpublic ValueTimestampTimeZone currentTimestamp()
CastDataProvidercurrentTimestamp in interface CastDataProviderpublic Mode getMode()
CastDataProvidergetMode in interface CastDataProviderpublic JavaObjectSerializer getJavaObjectSerializer()
CastDataProvidernull.getJavaObjectSerializer in interface CastDataProvidernullpublic IsolationLevel getIsolationLevel()
SessiongetIsolationLevel in class Sessionpublic void setIsolationLevel(IsolationLevel isolationLevel)
SessionsetIsolationLevel in class SessionisolationLevel - the isolation level to setpublic java.util.BitSet getNonKeywords()
nullpublic void setNonKeywords(java.util.BitSet nonKeywords)
nonKeywords - set of non-keywords, or nullpublic Session.StaticSettings getStaticSettings()
SessiongetStaticSettings in class Sessionpublic Session.DynamicSettings getDynamicSettings()
SessiongetDynamicSettings in class Sessionpublic TimeZoneProvider currentTimeZone()
CastDataProvidercurrentTimeZone in interface CastDataProviderpublic void setTimeZone(TimeZoneProvider timeZone)
timeZone - time zonepublic boolean areEqual(Value a, Value b)
a - the first valueb - the second valuepublic int compare(Value a, Value b)
a - the first valueb - the second valuepublic int compareWithNull(Value a, Value b, boolean forEquality)
a - the first valueb - the second valueforEquality - perform only check for equality (= or <>)Integer.MIN_VALUE if order
is not defined due to NULL comparisonpublic int compareTypeSafe(Value a, Value b)
a - the first valueb - the second valuepublic void setTruncateLargeLength(boolean truncateLargeLength)
truncateLargeLength - true to truncate to valid bound, false to
throw an exceptionpublic boolean isTruncateLargeLength()
true if large length is truncated, false if an
exception is thrownpublic void setVariableBinary(boolean variableBinary)
variableBinary - true to parse BINARY as VARBINARY, false to
parse it as ispublic boolean isVariableBinary()
true if BINARY should be parsed as VARBINARY,
false if it should be parsed as ispublic void setOldInformationSchema(boolean oldInformationSchema)
oldInformationSchema - true to have old-style tables in INFORMATION_SCHEMA,
false to have modern tablespublic boolean isOldInformationSchema()
SessionisOldInformationSchema in class Sessionpublic DatabaseMeta getDatabaseMeta()
SessiongetDatabaseMeta in class Sessionpublic boolean zeroBasedEnums()
CastDataProviderzeroBasedEnums in interface CastDataProviderpublic void setQuirksMode(boolean quirksMode)
quirksMode - whether quirks mode should be enabledpublic boolean isQuirksMode()
true if database is starting or quirks mode was enabled
explicitly, false otherwisepublic Session setThreadLocalSession()
SessionsetThreadLocalSession in class Sessionnullpublic void resetThreadLocalSession(Session oldSession)
SessionresetThreadLocalSession in class SessionoldSession - the old thread local session, or null