|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.engine.SessionWithState
org.h2.engine.Session
public class Session
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.
Field Summary |
---|
Fields inherited from class org.h2.engine.SessionWithState |
---|
sessionState, sessionStateChanged |
Constructor Summary | |
---|---|
Session(Database database,
User user,
int id)
|
Method Summary | |
---|---|
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 |
addLock(Table table)
Add a lock for the given table. |
void |
addLogPos(int logId,
int pos)
Called when a log entry for this session is added. |
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. |
void |
addTemporaryResult(LocalResult result)
Remember the result set and close it as soon as the transaction is committed (if it needs to be closed). |
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 |
close()
Roll back pending transactions and close the session. |
void |
closeTemporaryResults()
Close all temporary result set. |
void |
commit(boolean ddl)
Commit the current transaction. |
JdbcConnection |
createConnection(boolean columnList)
Create an internal connection. |
protected void |
finalize()
|
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()
|
Command |
getCurrentCommand()
|
long |
getCurrentCommandStart()
|
java.lang.String |
getCurrentSchemaName()
|
Database |
getDatabase()
|
DataHandler |
getDataHandler()
Get the data handler object. |
int |
getFirstUncommittedLog()
|
int |
getFirstUncommittedPos()
|
int |
getId()
|
Value |
getLastIdentity()
|
int |
getLastUncommittedDelete()
|
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()
|
ObjectArray<Table> |
getLocalTempTables()
|
Table[] |
getLocks()
|
int |
getLockTimeout()
|
int |
getLogId()
|
int |
getModificationId()
|
java.lang.String |
getNextSystemIdentifier(java.lang.String sql)
Get the next system generated identifiers. |
int |
getPowerOffCount()
Get the number of disk operations before power failure is simulated. |
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()
|
long |
getSessionStart()
|
Trace |
getTrace()
Get the trace object |
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. |
Table |
getWaitForLock()
|
int |
hashCode()
|
boolean |
isClosed()
Check if close was called. |
boolean |
isReconnectNeeded(boolean write)
Check if the database changed and therefore reconnecting is required. |
boolean |
isUndoLogEnabled()
|
void |
log(Table table,
short type,
Row row)
Add an undo log entry to this session. |
int |
nextObjectId()
Get the next object id. |
Prepared |
prepare(java.lang.String sql)
Parse and prepare the given SQL statement. |
Prepared |
prepare(java.lang.String sql,
boolean rightsChecked)
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. |
SessionInterface |
reconnect()
Close the connection and open a new connection. |
void |
removeLocalTempTable(Table table)
Drop and remove the given local temporary table from this session. |
void |
removeLocalTempTableConstraint(Constraint constraint)
Drop and remove the given local temporary constraint 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 |
rollback()
Fully roll back the current transaction. |
void |
rollbackTo(int index,
boolean trimToSize)
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 |
setAllCommitted()
This method is called after the log file has committed this session. |
void |
setAllowLiterals(boolean b)
|
void |
setAutoCommit(boolean b)
Change the autocommit setting for this session. |
boolean |
setCommitOrRollbackDisabled(boolean x)
|
void |
setConnectionInfo(ConnectionInfo ci)
|
void |
setCurrentCommand(Command command,
long startTime)
Set the current command of this session. |
void |
setCurrentSchema(Schema schema)
|
void |
setLastIdentity(Value last)
|
void |
setLastUncommittedDelete(int deleteId)
|
void |
setLockTimeout(int lockTimeout)
|
void |
setPowerOffCount(int count)
Set the number of disk operations before power failure is simulated. |
void |
setPreparedTransaction(java.lang.String transactionName,
boolean commit)
Commit or roll back the given transaction. |
void |
setQueryTimeout(int queryTimeout)
|
void |
setSchemaSearchPath(java.lang.String[] schemas)
|
void |
setThrottle(int throttle)
|
void |
setUndoLogEnabled(boolean b)
|
void |
setVariable(java.lang.String name,
Value value)
Set the value of the given variable for this session. |
void |
setWaitForLock(Table table)
|
void |
throttle()
Wait for some time if this session is throttled (slowed down). |
java.lang.String |
toString()
|
void |
unlinkAtCommit(ValueLob v)
Remember that the given LOB value must be un-linked (disconnected from the table) at commit. |
void |
unlinkAtCommitStop(Value v)
Do not unlink this LOB value at commit any longer. |
void |
unlockReadLocks()
Unlock all read locks. |
void |
waitIfExclusiveModeEnabled()
Wait if the exclusive mode has been enabled for another session. |
Methods inherited from class org.h2.engine.SessionWithState |
---|
readSessionState, recreateSessionState |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Session(Database database, User user, int id)
Method Detail |
---|
public boolean setCommitOrRollbackDisabled(boolean x)
public void setVariable(java.lang.String name, Value value) throws java.sql.SQLException
name
- the name of the variable (may not be null)value
- the new value (may not be null)
java.sql.SQLException
public Value getVariable(java.lang.String name)
name
- the variable name
public java.lang.String[] getVariableNames()
public Table findLocalTempTable(java.lang.String name)
name
- the table name
public ObjectArray<Table> getLocalTempTables()
public void addLocalTempTable(Table table) throws java.sql.SQLException
table
- the table to add
java.sql.SQLException
- if a table with this name already existspublic void removeLocalTempTable(Table table) throws java.sql.SQLException
table
- the table
java.sql.SQLException
public Index findLocalTempTableIndex(java.lang.String name)
name
- the table name
public java.util.HashMap<java.lang.String,Index> getLocalTempTableIndexes()
public void addLocalTempTableIndex(Index index) throws java.sql.SQLException
index
- the index to add
java.sql.SQLException
- if a index with this name already existspublic void removeLocalTempTableIndex(Index index) throws java.sql.SQLException
index
- the index
java.sql.SQLException
public Constraint findLocalTempTableConstraint(java.lang.String name)
name
- the constraint name
public java.util.HashMap<java.lang.String,Constraint> getLocalTempTableConstraints()
public void addLocalTempTableConstraint(Constraint constraint) throws java.sql.SQLException
constraint
- the constraint to add
java.sql.SQLException
- if a constraint with the same name already existspublic void removeLocalTempTableConstraint(Constraint constraint) throws java.sql.SQLException
constraint
- the constraint
java.sql.SQLException
protected void finalize()
finalize
in class java.lang.Object
public boolean getAutoCommit()
public User getUser()
public void setAutoCommit(boolean b)
b
- the new valuepublic int getLockTimeout()
public void setLockTimeout(int lockTimeout)
public CommandInterface prepareCommand(java.lang.String sql, int fetchSize) throws java.sql.SQLException
SessionInterface
sql
- the SQL statementfetchSize
- the number of rows to fetch in one step
java.sql.SQLException
public Prepared prepare(java.lang.String sql) throws java.sql.SQLException
sql
- the SQL statement
java.sql.SQLException
public Prepared prepare(java.lang.String sql, boolean rightsChecked) throws java.sql.SQLException
sql
- the SQL statementrightsChecked
- true if the rights have already been checked
java.sql.SQLException
public Command prepareLocal(java.lang.String sql) throws java.sql.SQLException
sql
- the SQL statement
java.sql.SQLException
public Database getDatabase()
public int getPowerOffCount()
SessionInterface
public void setPowerOffCount(int count)
SessionInterface
count
- the number of operationspublic int getLastUncommittedDelete()
public void setLastUncommittedDelete(int deleteId)
public void commit(boolean ddl) throws java.sql.SQLException
ddl
- if the statement was a data definition statement
java.sql.SQLException
public void rollback() throws java.sql.SQLException
java.sql.SQLException
public void rollbackTo(int index, boolean trimToSize) throws java.sql.SQLException
index
- the position to which should be rolled backtrimToSize
- if the list should be trimmed
java.sql.SQLException
public int getLogId()
public int getId()
public void cancel()
SessionInterface
public void close() throws java.sql.SQLException
SessionInterface
java.sql.SQLException
public void addLock(Table table)
table
- the table that is lockedpublic void log(Table table, short type, Row row) throws java.sql.SQLException
table
- the tabletype
- the operation type (see UndoLogRecord
)row
- the row
java.sql.SQLException
public void unlockReadLocks()
public java.util.Random getRandom()
public Trace getTrace()
SessionInterface
public void setLastIdentity(Value last)
public Value getLastIdentity()
public void addLogPos(int logId, int pos)
logId
- the log file idpos
- the position of the log entry in the log filepublic int getFirstUncommittedLog()
public int getFirstUncommittedPos()
public void setAllCommitted()
public void addSavepoint(java.lang.String name)
name
- the savepoint namepublic void rollbackToSavepoint(java.lang.String name) throws java.sql.SQLException
name
- the savepoint name
java.sql.SQLException
public void prepareCommit(java.lang.String transactionName) throws java.sql.SQLException
transactionName
- the name of the transaction
java.sql.SQLException
public void setPreparedTransaction(java.lang.String transactionName, boolean commit) throws java.sql.SQLException
transactionName
- the name of the transactioncommit
- true for commit, false for rollback
java.sql.SQLException
public boolean isClosed()
SessionInterface
public void setThrottle(int throttle)
public void throttle()
public void setCurrentCommand(Command command, long startTime)
command
- the commandstartTime
- the time execution has been startedpublic void checkCanceled() throws java.sql.SQLException
java.sql.SQLException
- if the transaction is canceledpublic Command getCurrentCommand()
public long getCurrentCommandStart()
public boolean getAllowLiterals()
public void setAllowLiterals(boolean b)
public void setCurrentSchema(Schema schema)
public java.lang.String getCurrentSchemaName()
public JdbcConnection createConnection(boolean columnList)
columnList
- if the url should be 'jdbc:columnlist:connection'
public DataHandler getDataHandler()
SessionInterface
public void unlinkAtCommit(ValueLob v)
v
- the valuepublic void unlinkAtCommitStop(Value v)
v
- the valuepublic java.lang.String getNextSystemIdentifier(java.lang.String sql)
sql
- the SQL statement
public 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 name
public 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 setUndoLogEnabled(boolean b)
public boolean isUndoLogEnabled()
public void begin()
public long getSessionStart()
public Table[] getLocks()
public void waitIfExclusiveModeEnabled()
public void addTemporaryResult(LocalResult result)
result
- the temporary result setpublic void closeTemporaryResults()
public void setQueryTimeout(int queryTimeout)
public int getQueryTimeout()
public void setWaitForLock(Table table)
public Table getWaitForLock()
public int getModificationId()
public boolean isReconnectNeeded(boolean write)
SessionInterface
write
- if the next operation may be writing
public SessionInterface reconnect() throws java.sql.SQLException
SessionInterface
java.sql.SQLException
public void setConnectionInfo(ConnectionInfo ci)
public Value getTransactionId()
public int nextObjectId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |