Package org.h2.engine
Class SessionLocal
java.lang.Object
org.h2.engine.Session
org.h2.engine.SessionLocal
- All Implemented Interfaces:
AutoCloseable,Comparator<org.h2.value.Value>,CastDataProvider,org.h2.mvstore.tx.TransactionStore.RollbackListener
public final class SessionLocal
extends Session
implements org.h2.mvstore.tx.TransactionStore.RollbackListener, Comparator<org.h2.value.Value>
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a savepoint (a position in a transaction to where one can roll back to).static enumstatic classAn LOB object with a timeout.Nested classes/interfaces inherited from class org.h2.engine.Session
Session.DynamicSettings, Session.StaticSettings -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocalTempTable(org.h2.table.Table table) Add a local temporary table to this session.voidaddLocalTempTableConstraint(org.h2.constraint.Constraint constraint) Add a local temporary constraint to this session.voidaddLocalTempTableIndex(org.h2.index.Index index) Add a local temporary index to this session.voidaddProcedure(Procedure procedure) Add a procedure to this session.voidaddSavepoint(String name) Create a savepoint that is linked to the current log position.org.h2.value.ValueLobaddTemporaryLob(org.h2.value.ValueLob v) Add a temporary LOB, which is closed when the session commits.booleanareEqual(org.h2.value.Value a, org.h2.value.Value b) Check if two values are equal with the current comparison mode.voidbegin()Begin a transaction.voidcancel()Cancel the current or next command (called when closing a connection).voidCheck if the current transaction is canceled by calling Statement.cancel() or because a session timeout was set and expired.voidClear the view cache for this session.voidclose()Roll back pending transactions and close the session.voidcommit(boolean ddl) Commit the current transaction.intcompare(org.h2.value.Value a, org.h2.value.Value b) Compare two values with the current comparison mode.intcompareTypeSafe(org.h2.value.Value a, org.h2.value.Value b) Compare two values with the current comparison mode.intcompareWithNull(org.h2.value.Value a, org.h2.value.Value b, boolean forEquality) Compare two values with the current comparison mode.booleanWhether the session contains any uncommitted changes.createConnection(boolean columnList) Create an internal connection.org.h2.value.ValueTimestampTimeZoneReturns the current timestamp with maximum resolution.org.h2.util.TimeZoneProviderReturns the current time zone.voidMark the statement as completed.org.h2.table.TablefindLocalTempTable(String name) Get the local temporary table if one exists with that name, or null if not.org.h2.constraint.ConstraintGet the local temporary constraint if one exists with that name, or null if not.org.h2.index.IndexGet the local temporary index if one exists with that name, or null if not.booleanbooleanCheck if this session is in auto-commit mode.intlongGet the cancel time.Get the list of the cluster servers for this session.org.h2.value.ValueTimestampTimeZoneorg.h2.command.CommandGet current schema.org.h2.value.ValuegetCurrentValueFor(org.h2.schema.Sequence sequence) Returns the current value of the sequence in this session.org.h2.jdbc.meta.DatabaseMetaReturns database meta information.org.h2.store.DataHandlerGet the data handler object.Returns dynamic settings.intgetId()Returns the isolation level.Returns the custom Java object serializer, ornull.org.h2.value.ValueGet the map of constraints for all constraints on local, temporary tables, if any.List<org.h2.table.Table> Set<org.h2.table.Table> getLocks()intgetMode()Returns the database mode.intorg.h2.util.NetworkConnectionInfoReturns the network connection information, ornull.Get the next system generated identifiers.org.h2.value.ValuegetNextValueFor(org.h2.schema.Sequence sequence, org.h2.command.Prepared prepared) Returns the next value of the sequence in this session.Gets bit set of non-keywords.getProcedure(String name) Get the procedure with the given name, or null if none exists.intString[]org.h2.value.ValueTimestampTimeZonelongReturns the data modification id of transaction's snapshot, or 0 if isolation level doesn't use snapshots.getState()longReturns database data modification id on start of the current command.Returns static settings.org.h2.message.TracegetTrace()Get the trace objectorg.h2.mvstore.tx.TransactionGet the transaction to use for this session.org.h2.value.ValuegetUser()org.h2.value.ValuegetVariable(String name) Get the value of the specified user defined variable.String[]Get the list of variable names that are set for this session.getViewIndexCache(boolean derivedTable) Get the view cache for this session.org.h2.table.TableinthashCode()booleanCheck whether this session has a pending transaction.booleanChecks presence of prepared transaction in this session.voidinvalidateCachedResults(org.h2.table.Table table) booleanisClosed()Check if close was called.booleanbooleanReturns whether INFORMATION_SCHEMA contains old-style tables.booleanisOpen()booleanbooleanReturns whether quirks mode is enabled explicitly or implicitly.booleanisRemote()Check if this session is remote or embedded.booleanReturns parsing mode of data types with too large length.booleanisUpdatedInCurrentTransaction(org.h2.table.Table table) Checks if table was updated within current transaction.booleanReturns BINARY data type parsing mode.voidmarkTableForAnalyze(org.h2.table.Table table) Mark that the given table needs to be analyzed on commit.intGet the next object id.voidonRollback(org.h2.mvstore.MVMap<Object, org.h2.value.VersionedValue<Object>> map, Object key, org.h2.value.VersionedValue<Object> existingValue, org.h2.value.VersionedValue<Object> restoredValue) Notified of a single map change (add/update/remove)org.h2.command.PreparedParse and prepare the given SQL statement.org.h2.command.Preparedprepare(String sql, boolean rightsChecked, boolean literalsChecked, org.h2.command.QueryScope queryScope) Parse and prepare the given SQL statement.org.h2.command.CommandInterfaceprepareCommand(String sql) Parse a command and prepare it for execution.voidprepareCommit(String transactionName) Prepare the given transaction.org.h2.command.CommandprepareLocal(String sql) Parse and prepare the given SQL statement.org.h2.command.query.QueryprepareQueryExpression(String sql, org.h2.command.QueryScope queryScope) Parse a query and prepare its expressions.voidregisterTableAsLocked(org.h2.table.Table table) Register table as locked within current transaction.voidregisterTableAsUpdated(org.h2.table.Table table) Register table as updated within current transaction.voidremoveAtCommit(org.h2.value.ValueLob v) Remember that the given LOB value must be removed at commit.voidremoveAtCommitStop(org.h2.value.ValueLob v) Do not remove this LOB value at commit any longer.voidremoveLocalTempTable(org.h2.table.Table table) Drop and remove the given local temporary table from this session.voidremoveLocalTempTableIndex(org.h2.index.Index index) Drop and remove the given local temporary index from this session.voidremoveProcedure(String name) Remove a procedure from this session.voidresetThreadLocalSession(Session oldSession) Resets old thread local session.voidrollback()Fully roll back the current transaction.voidrollbackTo(SessionLocal.Savepoint savepoint) Partially roll back the current transaction.voidrollbackToSavepoint(String name) Undo all operations back to the log position of the given savepoint.voidsetAllowLiterals(boolean b) voidsetAutoCommit(boolean b) Set the auto-commit mode.booleansetCommitOrRollbackDisabled(boolean x) voidsetCurrentSchema(org.h2.schema.Schema schema) voidsetCurrentSchemaName(String schemaName) Set current schema.voidsetIsolationLevel(IsolationLevel isolationLevel) Sets the isolation level.voidsetLastIdentity(org.h2.value.Value last) voidsetLazyQueryExecution(boolean lazyQueryExecution) voidsetLockTimeout(int lockTimeout) voidsetNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo) Sets the network connection information if possible.voidsetNonKeywords(BitSet nonKeywords) Sets bit set of non-keywords.voidsetOldInformationSchema(boolean oldInformationSchema) Changes INFORMATION_SCHEMA content.voidsetParsingCreateView(boolean parsingView) This method is called before and after parsing of view definition and may be called recursively.voidsetPreparedTransaction(String transactionName, boolean commit) Commit or roll back the given transaction.voidsetQueryTimeout(int queryTimeout) voidsetQuirksMode(boolean quirksMode) Enables or disables the quirks mode.Create a savepoint to allow rolling back to this state.voidsetSchemaSearchPath(String[] schemas) Sets this session as thread local session, if this session is a local session.voidsetThrottle(int throttle) voidsetTimeZone(org.h2.util.TimeZoneProvider timeZone) Sets current time zone.voidsetTruncateLargeLength(boolean truncateLargeLength) Changes parsing mode of data types with too large length.voidsetVariable(String name, org.h2.value.Value value) Set the value of the given variable for this session.voidsetVariableBinary(boolean variableBinary) Changes parsing of a BINARY data type.voidsetWaitForLock(org.h2.table.Table waitForLock, Thread waitForLockThread) Set the table this session is waiting for, and the thread that is waiting.voidstartStatementWithinTransaction(org.h2.command.Command command) Start a new statement within a transaction.voidthrottle()Wait for some time if this session is throttled (slowed down).toString()voidWait if the exclusive mode has been enabled for another session.booleanReturns are ENUM values 0-based.Methods inherited from class org.h2.engine.Session
isLockedByCurrentThread, lock, unlockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
SessionLocal
-
-
Method Details
-
setLazyQueryExecution
public void setLazyQueryExecution(boolean lazyQueryExecution) -
isLazyQueryExecution
public boolean isLazyQueryExecution() -
setParsingCreateView
public void setParsingCreateView(boolean parsingView) This method is called before and after parsing of view definition and may be called recursively.- Parameters:
parsingView-trueif this method is called before parsing of view definition,falseif it is called after it.
-
isParsingCreateView
public boolean isParsingCreateView() -
getClusterServers
Description copied from class:SessionGet the list of the cluster servers for this session.- Specified by:
getClusterServersin classSession- Returns:
- A list of "ip:port" strings for the cluster servers in this session.
-
setCommitOrRollbackDisabled
public boolean setCommitOrRollbackDisabled(boolean x) -
setVariable
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)
-
getVariable
Get the value of the specified user defined variable. This method always returns a value; it returnsValueNull.INSTANCEif the variable doesn't exist.- Parameters:
name- the variable name- Returns:
- the value, or NULL
-
getVariableNames
Get the list of variable names that are set for this session.- Returns:
- String[] of names
-
findLocalTempTable
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
-
getLocalTempTables
-
addLocalTempTable
public void addLocalTempTable(org.h2.table.Table table) Add a local temporary table to this session.- Parameters:
table- the table to add- Throws:
org.h2.message.DbException- if a table with this name already exists
-
removeLocalTempTable
public void removeLocalTempTable(org.h2.table.Table table) Drop and remove the given local temporary table from this session.- Parameters:
table- the table
-
findLocalTempTableIndex
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
-
getLocalTempTableIndexes
-
addLocalTempTableIndex
public void addLocalTempTableIndex(org.h2.index.Index index) Add a local temporary index to this session.- Parameters:
index- the index to add- Throws:
org.h2.message.DbException- if an index with this name already exists
-
removeLocalTempTableIndex
public void removeLocalTempTableIndex(org.h2.index.Index index) Drop and remove the given local temporary index from this session.- Parameters:
index- the index
-
findLocalTempTableConstraint
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
-
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
-
addLocalTempTableConstraint
public void addLocalTempTableConstraint(org.h2.constraint.Constraint constraint) Add a local temporary constraint to this session.- Parameters:
constraint- the constraint to add- Throws:
org.h2.message.DbException- if a constraint with the same name already exists
-
getAutoCommit
public boolean getAutoCommit()Description copied from class:SessionCheck if this session is in auto-commit mode.- Specified by:
getAutoCommitin classSession- Returns:
- true if the session is in auto-commit mode
-
getUser
-
setAutoCommit
public void setAutoCommit(boolean b) Description copied from class:SessionSet the auto-commit mode. This call doesn't commit the current transaction.- Specified by:
setAutoCommitin classSession- Parameters:
b- the new value
-
getLockTimeout
public int getLockTimeout() -
setLockTimeout
public void setLockTimeout(int lockTimeout) -
prepareCommand
Description copied from class:SessionParse a command and prepare it for execution.- Specified by:
prepareCommandin classSession- Parameters:
sql- the SQL statement- Returns:
- the prepared command
-
prepare
Parse and prepare the given SQL statement. This method also checks the rights.- Parameters:
sql- the SQL statement- Returns:
- the prepared statement
-
prepare
public org.h2.command.Prepared prepare(String sql, boolean rightsChecked, boolean literalsChecked, org.h2.command.QueryScope queryScope) Parse and prepare the given SQL statement.- Parameters:
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).queryScope- the scope of this query, ornull- Returns:
- the prepared statement
-
prepareQueryExpression
public org.h2.command.query.Query prepareQueryExpression(String sql, org.h2.command.QueryScope queryScope) Parse a query and prepare its expressions. Rights and literals must be already checked.- Parameters:
sql- the SQL statementqueryScope- the scope of this query, ornull- Returns:
- the prepared statement
-
prepareLocal
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
-
getDatabase
-
commit
public 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
-
invalidateCachedResults
public void invalidateCachedResults(org.h2.table.Table table) -
getSnapshotDataModificationId
public 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
-
rollback
public void rollback()Fully roll back the current transaction. -
rollbackTo
Partially roll back the current transaction.- Parameters:
savepoint- the savepoint to which should be rolled back
-
hasPendingTransaction
public boolean hasPendingTransaction()Description copied from class:SessionCheck whether this session has a pending transaction.- Specified by:
hasPendingTransactionin classSession- Returns:
- true if it has
-
setSavepoint
Create a savepoint to allow rolling back to this state.- Returns:
- the savepoint
-
getId
public int getId() -
cancel
public void cancel()Description copied from class:SessionCancel the current or next command (called when closing a connection). -
close
public void close()Description copied from class:SessionRoll back pending transactions and close the session.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classSession
-
registerTableAsLocked
public void registerTableAsLocked(org.h2.table.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
-
registerTableAsUpdated
public void registerTableAsUpdated(org.h2.table.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
-
isUpdatedInCurrentTransaction
public boolean isUpdatedInCurrentTransaction(org.h2.table.Table table) Checks if table was updated within current transaction.- Parameters:
table- to check
-
getRandom
-
getTrace
public org.h2.message.Trace getTrace()Description copied from class:SessionGet the trace object -
getNextValueFor
public 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.- Parameters:
sequence- the sequenceprepared- current prepared command, select, ornull- Returns:
- the next value of the sequence in this session
-
getCurrentValueFor
public org.h2.value.Value getCurrentValueFor(org.h2.schema.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:
org.h2.message.DbException- if current value is not defined
-
setLastIdentity
public void setLastIdentity(org.h2.value.Value last) -
getLastIdentity
public org.h2.value.Value getLastIdentity() -
containsUncommitted
public boolean containsUncommitted()Whether the session contains any uncommitted changes.- Returns:
- true if yes
-
addSavepoint
Create a savepoint that is linked to the current log position.- Parameters:
name- the savepoint name
-
rollbackToSavepoint
Undo all operations back to the log position of the given savepoint.- Parameters:
name- the savepoint name
-
prepareCommit
Prepare the given transaction.- Parameters:
transactionName- the name of the transaction
-
hasPreparedTransaction
public boolean hasPreparedTransaction()Checks presence of prepared transaction in this session.- Returns:
trueif there is a prepared transaction,falseotherwise
-
setPreparedTransaction
Commit or roll back the given transaction.- Parameters:
transactionName- the name of the transactioncommit- true for commit, false for rollback
-
isClosed
public boolean isClosed()Description copied from class:SessionCheck if close was called. -
isOpen
public boolean isOpen() -
setThrottle
public void setThrottle(int throttle) -
throttle
public void throttle()Wait for some time if this session is throttled (slowed down). -
checkCanceled
public void checkCanceled()Check if the current transaction is canceled by calling Statement.cancel() or because a session timeout was set and expired.- Throws:
org.h2.message.DbException- if the transaction is canceled
-
getCancel
public long getCancel()Get the cancel time.- Returns:
- the time or 0 if not set
-
getCurrentCommand
public org.h2.command.Command getCurrentCommand() -
getCommandStartOrEnd
public org.h2.value.ValueTimestampTimeZone getCommandStartOrEnd() -
getAllowLiterals
public boolean getAllowLiterals() -
setAllowLiterals
public void setAllowLiterals(boolean b) -
setCurrentSchema
public void setCurrentSchema(org.h2.schema.Schema schema) -
getCurrentSchemaName
Description copied from class:SessionGet current schema.- Specified by:
getCurrentSchemaNamein classSession- Returns:
- the current schema name
-
setCurrentSchemaName
Description copied from class:SessionSet current schema.- Specified by:
setCurrentSchemaNamein classSession- Parameters:
schemaName- the schema name
-
createConnection
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
-
getDataHandler
public org.h2.store.DataHandler getDataHandler()Description copied from class:SessionGet the data handler object.- Specified by:
getDataHandlerin classSession- Returns:
- the data handler
-
removeAtCommit
public void removeAtCommit(org.h2.value.ValueLob v) Remember that the given LOB value must be removed at commit.- Parameters:
v- the value
-
removeAtCommitStop
public void removeAtCommitStop(org.h2.value.ValueLob v) Do not remove this LOB value at commit any longer.- Parameters:
v- the value
-
getNextSystemIdentifier
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
-
addProcedure
Add a procedure to this session.- Parameters:
procedure- the procedure to add
-
removeProcedure
Remove a procedure from this session.- Parameters:
name- the name of the procedure to remove
-
getProcedure
Get the procedure with the given name, or null if none exists.- Parameters:
name- the procedure name- Returns:
- the procedure or null
-
setSchemaSearchPath
-
getSchemaSearchPath
-
hashCode
public int hashCode() -
toString
-
begin
public void begin()Begin a transaction. -
getSessionStart
public org.h2.value.ValueTimestampTimeZone getSessionStart() -
getLocks
-
waitIfExclusiveModeEnabled
public 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. -
getViewIndexCache
Get the view cache for this session. There are two caches: the derived table cache (which is only use for a single query, has no bounds, and is cleared after use), and the cache for regular views.- Parameters:
derivedTable- true to get the cache of derived tables- Returns:
- the view cache or derived table cache
-
setQueryTimeout
public void setQueryTimeout(int queryTimeout) -
getQueryTimeout
public int getQueryTimeout() -
setWaitForLock
Set the table this session is waiting for, and the thread that is waiting.- Parameters:
waitForLock- the tablewaitForLockThread- the current thread (the one that is waiting)
-
getWaitForLock
public org.h2.table.Table getWaitForLock() -
getWaitForLockThread
-
getModificationId
public int getModificationId() -
getTransactionId
public org.h2.value.Value getTransactionId() -
nextObjectId
public int nextObjectId()Get the next object id.- Returns:
- the next object id
-
getTransaction
public org.h2.mvstore.tx.Transaction getTransaction()Get the transaction to use for this session.- Returns:
- the transaction
-
startStatementWithinTransaction
public void startStatementWithinTransaction(org.h2.command.Command command) Start a new statement within a transaction.- Parameters:
command- about to be started
-
endStatement
public void endStatement()Mark the statement as completed. This also close all temporary result set, and deletes all temporary files held by the result sets. -
getStatementModificationDataId
public long getStatementModificationDataId()Returns database data modification id on start of the current command.- Returns:
- database data modification id on start of the current command
-
clearViewIndexCache
public void clearViewIndexCache()Clear the view cache for this session. -
addTemporaryLob
public org.h2.value.ValueLob addTemporaryLob(org.h2.value.ValueLob v) Description copied from class:SessionAdd a temporary LOB, which is closed when the session commits.- Specified by:
addTemporaryLobin classSession- Parameters:
v- the value- Returns:
- the specified value
-
isRemote
public boolean isRemote()Description copied from class:SessionCheck if this session is remote or embedded. -
markTableForAnalyze
public void markTableForAnalyze(org.h2.table.Table table) Mark that the given table needs to be analyzed on commit.- Parameters:
table- the table
-
getState
-
getBlockingSessionId
public int getBlockingSessionId() -
onRollback
public void onRollback(org.h2.mvstore.MVMap<Object, org.h2.value.VersionedValue<Object>> map, Object key, org.h2.value.VersionedValue<Object> existingValue, org.h2.value.VersionedValue<Object> restoredValue) Description copied from interface:org.h2.mvstore.tx.TransactionStore.RollbackListenerNotified of a single map change (add/update/remove)- Specified by:
onRollbackin interfaceorg.h2.mvstore.tx.TransactionStore.RollbackListener- Parameters:
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)
-
getNetworkConnectionInfo
public org.h2.util.NetworkConnectionInfo getNetworkConnectionInfo()Returns the network connection information, ornull.- Returns:
- the network connection information, or
null
-
setNetworkConnectionInfo
public void setNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo) Description copied from class:SessionSets the network connection information if possible.- Specified by:
setNetworkConnectionInfoin classSession- Parameters:
networkConnectionInfo- the network connection information
-
currentTimestamp
public org.h2.value.ValueTimestampTimeZone currentTimestamp()Description copied from interface:CastDataProviderReturns the current timestamp with maximum resolution. The value must be the same within a transaction or within execution of a command.- Specified by:
currentTimestampin interfaceCastDataProvider- Returns:
- the current timestamp for CURRENT_TIMESTAMP(9)
-
getMode
Description copied from interface:CastDataProviderReturns the database mode.- Specified by:
getModein interfaceCastDataProvider- Returns:
- the database mode
-
getJavaObjectSerializer
Description copied from interface:CastDataProviderReturns the custom Java object serializer, ornull.- Specified by:
getJavaObjectSerializerin interfaceCastDataProvider- Returns:
- the custom Java object serializer, or
null
-
getIsolationLevel
Description copied from class:SessionReturns the isolation level.- Specified by:
getIsolationLevelin classSession- Returns:
- the isolation level
-
setIsolationLevel
Description copied from class:SessionSets the isolation level.- Specified by:
setIsolationLevelin classSession- Parameters:
isolationLevel- the isolation level to set
-
getNonKeywords
Gets bit set of non-keywords.- Returns:
- set of non-keywords, or
null
-
setNonKeywords
Sets bit set of non-keywords.- Parameters:
nonKeywords- set of non-keywords, ornull
-
getStaticSettings
Description copied from class:SessionReturns static settings. These settings cannot be changed during lifecycle of session.- Specified by:
getStaticSettingsin classSession- Returns:
- static settings
-
getDynamicSettings
Description copied from class:SessionReturns dynamic settings. These settings can be changed during lifecycle of session.- Specified by:
getDynamicSettingsin classSession- Returns:
- dynamic settings
-
currentTimeZone
public org.h2.util.TimeZoneProvider currentTimeZone()Description copied from interface:CastDataProviderReturns the current time zone.- Specified by:
currentTimeZonein interfaceCastDataProvider- Returns:
- the current time zone
-
setTimeZone
public void setTimeZone(org.h2.util.TimeZoneProvider timeZone) Sets current time zone.- Parameters:
timeZone- time zone
-
areEqual
public boolean areEqual(org.h2.value.Value a, org.h2.value.Value b) Check if two values are equal with the current comparison mode.- Parameters:
a- the first valueb- the second value- Returns:
- true if both objects are equal
-
compare
public int compare(org.h2.value.Value a, org.h2.value.Value b) Compare two values with the current comparison mode. The values may have different data types including NULL.- Specified by:
comparein interfaceComparator<org.h2.value.Value>- Parameters:
a- the first valueb- the second value- Returns:
- 0 if both values are equal, -1 if the first value is smaller, and 1 otherwise
-
compareWithNull
public int compareWithNull(org.h2.value.Value a, org.h2.value.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 valueb- the second valueforEquality- 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,
Integer.MIN_VALUEif order is not defined due to NULL comparison
-
compareTypeSafe
public int compareTypeSafe(org.h2.value.Value a, org.h2.value.Value b) Compare two values with the current comparison mode. The values must be of the same type.- Parameters:
a- the first valueb- the second value- Returns:
- 0 if both values are equal, -1 if the first value is smaller, and 1 otherwise
-
setTruncateLargeLength
public void setTruncateLargeLength(boolean truncateLargeLength) Changes parsing mode of data types with too large length.- Parameters:
truncateLargeLength-trueto truncate to valid bound,falseto throw an exception
-
isTruncateLargeLength
public boolean isTruncateLargeLength()Returns parsing mode of data types with too large length.- Returns:
trueif large length is truncated,falseif an exception is thrown
-
setVariableBinary
public void setVariableBinary(boolean variableBinary) Changes parsing of a BINARY data type.- Parameters:
variableBinary-trueto parse BINARY as VARBINARY,falseto parse it as is
-
isVariableBinary
public boolean isVariableBinary()Returns BINARY data type parsing mode.- Returns:
trueif BINARY should be parsed as VARBINARY,falseif it should be parsed as is
-
setOldInformationSchema
public void setOldInformationSchema(boolean oldInformationSchema) Changes INFORMATION_SCHEMA content.- Parameters:
oldInformationSchema-trueto have old-style tables in INFORMATION_SCHEMA,falseto have modern tables
-
isOldInformationSchema
public boolean isOldInformationSchema()Description copied from class:SessionReturns whether INFORMATION_SCHEMA contains old-style tables.- Specified by:
isOldInformationSchemain classSession- Returns:
- whether INFORMATION_SCHEMA contains old-style tables
-
getDatabaseMeta
public org.h2.jdbc.meta.DatabaseMeta getDatabaseMeta()Description copied from class:SessionReturns database meta information.- Specified by:
getDatabaseMetain classSession- Returns:
- database meta information
-
zeroBasedEnums
public boolean zeroBasedEnums()Description copied from interface:CastDataProviderReturns are ENUM values 0-based.- Specified by:
zeroBasedEnumsin interfaceCastDataProvider- Returns:
- are ENUM values 0-based
-
setQuirksMode
public void setQuirksMode(boolean quirksMode) Enables or disables the quirks mode.- Parameters:
quirksMode- whether quirks mode should be enabled
-
isQuirksMode
public boolean isQuirksMode()Returns whether quirks mode is enabled explicitly or implicitly.- Returns:
trueif database is starting or quirks mode was enabled explicitly,falseotherwise
-
setThreadLocalSession
Description copied from class:SessionSets this session as thread local session, if this session is a local session.- Overrides:
setThreadLocalSessionin classSession- Returns:
- old thread local session, or
null
-
resetThreadLocalSession
Description copied from class:SessionResets old thread local session.- Overrides:
resetThreadLocalSessionin classSession- Parameters:
oldSession- the old thread local session, ornull
-