public final class SessionLocal extends Session implements org.h2.mvstore.tx.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(org.h2.table.Table table)
Add a local temporary table to this session.
|
void |
addLocalTempTableConstraint(org.h2.constraint.Constraint constraint)
Add a local temporary constraint to this session.
|
void |
addLocalTempTableIndex(org.h2.index.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.
|
org.h2.value.ValueLob |
addTemporaryLob(org.h2.value.ValueLob v)
Add a temporary LOB, which is closed when the session commits.
|
boolean |
areEqual(org.h2.value.Value a,
org.h2.value.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(org.h2.value.Value a,
org.h2.value.Value b)
Compare two values with the current comparison mode.
|
int |
compareTypeSafe(org.h2.value.Value a,
org.h2.value.Value b)
Compare two values with the current comparison mode.
|
int |
compareWithNull(org.h2.value.Value a,
org.h2.value.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.
|
org.h2.value.ValueTimestampTimeZone |
currentTimestamp()
Returns the current timestamp with maximum resolution.
|
org.h2.util.TimeZoneProvider |
currentTimeZone()
Returns the current time zone.
|
void |
endStatement()
Mark the statement as completed.
|
org.h2.table.Table |
findLocalTempTable(java.lang.String name)
Get the local temporary table if one exists with that name, or null if
not.
|
org.h2.constraint.Constraint |
findLocalTempTableConstraint(java.lang.String name)
Get the local temporary constraint if one exists with that name, or
null if not.
|
org.h2.index.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.
|
org.h2.value.ValueTimestampTimeZone |
getCommandStartOrEnd() |
org.h2.command.Command |
getCurrentCommand() |
java.lang.String |
getCurrentSchemaName()
Get current schema.
|
org.h2.value.Value |
getCurrentValueFor(org.h2.schema.Sequence sequence)
Returns the current value of the sequence in this session.
|
Database |
getDatabase() |
org.h2.jdbc.meta.DatabaseMeta |
getDatabaseMeta()
Returns database meta information.
|
org.h2.store.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 . |
org.h2.value.Value |
getLastIdentity() |
java.util.HashMap<java.lang.String,org.h2.constraint.Constraint> |
getLocalTempTableConstraints()
Get the map of constraints for all constraints on local, temporary
tables, if any.
|
java.util.HashMap<java.lang.String,org.h2.index.Index> |
getLocalTempTableIndexes() |
java.util.List<org.h2.table.Table> |
getLocalTempTables() |
java.util.Set<org.h2.table.Table> |
getLocks() |
int |
getLockTimeout() |
Mode |
getMode()
Returns the database mode.
|
int |
getModificationId() |
org.h2.util.NetworkConnectionInfo |
getNetworkConnectionInfo()
Returns the network connection information, or
null . |
java.lang.String |
getNextSystemIdentifier(java.lang.String sql)
Get the next system generated identifiers.
|
org.h2.value.Value |
getNextValueFor(org.h2.schema.Sequence sequence,
org.h2.command.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() |
org.h2.value.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.
|
org.h2.message.Trace |
getTrace()
Get the trace object
|
org.h2.mvstore.tx.Transaction |
getTransaction()
Get the transaction to use for this session.
|
org.h2.value.Value |
getTransactionId() |
User |
getUser() |
org.h2.value.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,org.h2.index.QueryExpressionIndex> |
getViewIndexCache(boolean derivedTable)
Get the view cache for this session.
|
org.h2.table.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(org.h2.table.Table table)
Mark that the given table needs to be analyzed on commit.
|
int |
nextObjectId()
Get the next object id.
|
void |
onRollback(org.h2.mvstore.MVMap<java.lang.Object,org.h2.value.VersionedValue<java.lang.Object>> map,
java.lang.Object key,
org.h2.value.VersionedValue<java.lang.Object> existingValue,
org.h2.value.VersionedValue<java.lang.Object> restoredValue)
Notified of a single map change (add/update/remove)
|
org.h2.command.Prepared |
prepare(java.lang.String sql)
Parse and prepare the given SQL statement.
|
org.h2.command.Prepared |
prepare(java.lang.String sql,
boolean rightsChecked,
boolean literalsChecked)
Parse and prepare the given SQL statement.
|
org.h2.command.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.
|
org.h2.command.Command |
prepareLocal(java.lang.String sql)
Parse and prepare the given SQL statement.
|
org.h2.command.query.Query |
prepareQueryExpression(java.lang.String sql)
Parse a query and prepare its expressions.
|
void |
registerTableAsLocked(org.h2.table.Table table)
Register table as locked within current transaction.
|
void |
registerTableAsUpdated(org.h2.table.Table table)
Register table as updated within current transaction.
|
void |
removeAtCommit(org.h2.value.ValueLob v)
Remember that the given LOB value must be removed at commit.
|
void |
removeAtCommitStop(org.h2.value.ValueLob v)
Do not remove this LOB value at commit any longer.
|
void |
removeLocalTempTable(org.h2.table.Table table)
Drop and remove the given local temporary table from this session.
|
void |
removeLocalTempTableIndex(org.h2.index.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(org.h2.schema.Schema schema) |
void |
setCurrentSchemaName(java.lang.String schemaName)
Set current schema.
|
void |
setIsolationLevel(IsolationLevel isolationLevel)
Sets the isolation level.
|
void |
setLastIdentity(org.h2.value.Value last) |
void |
setLazyQueryExecution(boolean lazyQueryExecution) |
void |
setLockTimeout(int lockTimeout) |
void |
setNetworkConnectionInfo(org.h2.util.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(org.h2.util.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,
org.h2.value.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(org.h2.table.Table waitForLock,
java.lang.Thread waitForLockThread)
Set the table this session is waiting for, and the thread that is
waiting.
|
void |
startStatementWithinTransaction(org.h2.command.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, unlock
public 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()
Session
getClusterServers
in class Session
public boolean setCommitOrRollbackDisabled(boolean x)
public void setVariable(java.lang.String name, org.h2.value.Value value)
name
- the name of the variable (may not be null)value
- the new value (may not be null)public org.h2.value.Value getVariable(java.lang.String name)
name
- the variable namepublic java.lang.String[] getVariableNames()
public org.h2.table.Table findLocalTempTable(java.lang.String name)
name
- the table namepublic java.util.List<org.h2.table.Table> getLocalTempTables()
public void addLocalTempTable(org.h2.table.Table table)
table
- the table to addorg.h2.message.DbException
- if a table with this name already existspublic void removeLocalTempTable(org.h2.table.Table table)
table
- the tablepublic org.h2.index.Index findLocalTempTableIndex(java.lang.String name)
name
- the table namepublic java.util.HashMap<java.lang.String,org.h2.index.Index> getLocalTempTableIndexes()
public void addLocalTempTableIndex(org.h2.index.Index index)
index
- the index to addorg.h2.message.DbException
- if a index with this name already existspublic void removeLocalTempTableIndex(org.h2.index.Index index)
index
- the indexpublic org.h2.constraint.Constraint findLocalTempTableConstraint(java.lang.String name)
name
- the constraint namepublic java.util.HashMap<java.lang.String,org.h2.constraint.Constraint> getLocalTempTableConstraints()
public void addLocalTempTableConstraint(org.h2.constraint.Constraint constraint)
constraint
- the constraint to addorg.h2.message.DbException
- if a constraint with the same name already existspublic boolean getAutoCommit()
Session
getAutoCommit
in class Session
public User getUser()
public void setAutoCommit(boolean b)
Session
setAutoCommit
in class Session
b
- the new valuepublic int getLockTimeout()
public void setLockTimeout(int lockTimeout)
public org.h2.command.CommandInterface prepareCommand(java.lang.String sql, int fetchSize)
Session
prepareCommand
in class Session
sql
- the SQL statementfetchSize
- the number of rows to fetch in one steppublic org.h2.command.Prepared prepare(java.lang.String sql)
sql
- the SQL statementpublic org.h2.command.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 org.h2.command.query.Query prepareQueryExpression(java.lang.String sql)
sql
- the SQL statementpublic org.h2.command.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()
Session
hasPendingTransaction
in class Session
public SessionLocal.Savepoint setSavepoint()
public int getId()
public void cancel()
Session
public void close()
Session
public void registerTableAsLocked(org.h2.table.Table table)
table
- the table that is lockedpublic void registerTableAsUpdated(org.h2.table.Table table)
table
- to registerpublic java.util.Random getRandom()
public org.h2.message.Trace getTrace()
Session
public org.h2.value.Value getNextValueFor(org.h2.schema.Sequence sequence, org.h2.command.Prepared prepared)
sequence
- the sequenceprepared
- current prepared command, select, or null
public org.h2.value.Value getCurrentValueFor(org.h2.schema.Sequence sequence)
sequence
- the sequenceorg.h2.message.DbException
- if current value is not definedpublic void setLastIdentity(org.h2.value.Value last)
public org.h2.value.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()
Session
public boolean isOpen()
public void setThrottle(int throttle)
public void throttle()
public void checkCanceled()
org.h2.message.DbException
- if the transaction is canceledpublic long getCancel()
public org.h2.command.Command getCurrentCommand()
public org.h2.value.ValueTimestampTimeZone getCommandStartOrEnd()
public boolean getAllowLiterals()
public void setAllowLiterals(boolean b)
public void setCurrentSchema(org.h2.schema.Schema schema)
public java.lang.String getCurrentSchemaName()
Session
getCurrentSchemaName
in class Session
public void setCurrentSchemaName(java.lang.String schemaName)
Session
setCurrentSchemaName
in class Session
schemaName
- the schema namepublic JdbcConnection createConnection(boolean columnList)
columnList
- if the url should be 'jdbc:columnlist:connection'public org.h2.store.DataHandler getDataHandler()
Session
getDataHandler
in class Session
public void removeAtCommit(org.h2.value.ValueLob v)
v
- the valuepublic void removeAtCommitStop(org.h2.value.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.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void begin()
public org.h2.value.ValueTimestampTimeZone getSessionStart()
public java.util.Set<org.h2.table.Table> getLocks()
public void waitIfExclusiveModeEnabled()
public java.util.Map<java.lang.Object,org.h2.index.QueryExpressionIndex> getViewIndexCache(boolean derivedTable)
derivedTable
- true to get the cache of derived tablespublic void setQueryTimeout(int queryTimeout)
public int getQueryTimeout()
public void setWaitForLock(org.h2.table.Table waitForLock, java.lang.Thread waitForLockThread)
waitForLock
- the tablewaitForLockThread
- the current thread (the one that is waiting)public org.h2.table.Table getWaitForLock()
public java.lang.Thread getWaitForLockThread()
public int getModificationId()
public org.h2.value.Value getTransactionId()
public int nextObjectId()
public org.h2.mvstore.tx.Transaction getTransaction()
public void startStatementWithinTransaction(org.h2.command.Command command)
command
- about to be startedpublic void endStatement()
public void clearViewIndexCache()
public org.h2.value.ValueLob addTemporaryLob(org.h2.value.ValueLob v)
Session
addTemporaryLob
in class Session
v
- the valuepublic boolean isRemote()
Session
public void markTableForAnalyze(org.h2.table.Table table)
table
- the tablepublic SessionLocal.State getState()
public int getBlockingSessionId()
public void onRollback(org.h2.mvstore.MVMap<java.lang.Object,org.h2.value.VersionedValue<java.lang.Object>> map, java.lang.Object key, org.h2.value.VersionedValue<java.lang.Object> existingValue, org.h2.value.VersionedValue<java.lang.Object> restoredValue)
org.h2.mvstore.tx.TransactionStore.RollbackListener
onRollback
in interface org.h2.mvstore.tx.TransactionStore.RollbackListener
map
- 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 org.h2.util.NetworkConnectionInfo getNetworkConnectionInfo()
null
.null
public void setNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo)
Session
setNetworkConnectionInfo
in class Session
networkConnectionInfo
- the network connection informationpublic org.h2.value.ValueTimestampTimeZone currentTimestamp()
CastDataProvider
currentTimestamp
in interface CastDataProvider
public Mode getMode()
CastDataProvider
getMode
in interface CastDataProvider
public JavaObjectSerializer getJavaObjectSerializer()
CastDataProvider
null
.getJavaObjectSerializer
in interface CastDataProvider
null
public IsolationLevel getIsolationLevel()
Session
getIsolationLevel
in class Session
public void setIsolationLevel(IsolationLevel isolationLevel)
Session
setIsolationLevel
in class Session
isolationLevel
- the isolation level to setpublic java.util.BitSet getNonKeywords()
null
public void setNonKeywords(java.util.BitSet nonKeywords)
nonKeywords
- set of non-keywords, or null
public Session.StaticSettings getStaticSettings()
Session
getStaticSettings
in class Session
public Session.DynamicSettings getDynamicSettings()
Session
getDynamicSettings
in class Session
public org.h2.util.TimeZoneProvider currentTimeZone()
CastDataProvider
currentTimeZone
in interface CastDataProvider
public void setTimeZone(org.h2.util.TimeZoneProvider timeZone)
timeZone
- time zonepublic boolean areEqual(org.h2.value.Value a, org.h2.value.Value b)
a
- the first valueb
- the second valuepublic int compare(org.h2.value.Value a, org.h2.value.Value b)
a
- the first valueb
- the second valuepublic int compareWithNull(org.h2.value.Value a, org.h2.value.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(org.h2.value.Value a, org.h2.value.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()
Session
isOldInformationSchema
in class Session
public org.h2.jdbc.meta.DatabaseMeta getDatabaseMeta()
Session
getDatabaseMeta
in class Session
public boolean zeroBasedEnums()
CastDataProvider
zeroBasedEnums
in interface CastDataProvider
public 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()
Session
setThreadLocalSession
in class Session
null
public void resetThreadLocalSession(Session oldSession)
Session
resetThreadLocalSession
in class Session
oldSession
- the old thread local session, or null