public class SessionRemote extends java.lang.Object implements DataHandler
| Modifier and Type | Field and Description |
|---|---|
static int |
CHANGE_ID |
static int |
COMMAND_CLOSE |
static int |
COMMAND_COMMIT |
static int |
COMMAND_EXECUTE_QUERY |
static int |
COMMAND_EXECUTE_UPDATE |
static int |
COMMAND_GET_META_DATA |
static int |
LOB_READ |
static int |
RESULT_CLOSE |
static int |
RESULT_FETCH_ROWS |
static int |
RESULT_RESET |
static int |
SESSION_CANCEL_STATEMENT |
static int |
SESSION_CHECK_KEY |
static int |
SESSION_CLOSE |
static int |
SESSION_HAS_PENDING_TRANSACTION |
static int |
SESSION_PREPARE |
static int |
SESSION_PREPARE_READ_PARAMS |
static int |
SESSION_PREPARE_READ_PARAMS2 |
static int |
SESSION_SET_AUTOCOMMIT |
static int |
SESSION_SET_ID |
protected java.util.ArrayList<java.lang.String> |
sessionState |
protected boolean |
sessionStateChanged |
static int |
STATUS_CLOSED |
static int |
STATUS_ERROR |
static int |
STATUS_OK |
static int |
STATUS_OK_STATE_CHANGED |
| Constructor and Description |
|---|
SessionRemote(ConnectionInfo ci) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTemporaryLob(Value v)
Add a temporary LOB, which is closed when the session commits.
|
void |
afterWriting()
Called after writing has ended.
|
void |
autoCommitIfCluster()
Calls COMMIT if the session is in cluster mode.
|
void |
cancel()
Cancel the current or next command (called when closing a connection).
|
void |
cancelStatement(int id)
Cancel the statement with the given id.
|
void |
checkClosed()
Check if this session is closed and throws an exception if so.
|
void |
checkPowerOff()
Check if the simulated power failure occurred.
|
void |
checkWritingAllowed()
Check if writing is allowed.
|
void |
close()
Roll back pending transactions and close the session.
|
SessionInterface |
connectEmbeddedOrServer(boolean openNew)
Open a new (remote or embedded) session.
|
void |
done(Transfer transfer)
Called to flush the output after data has been sent to the server and
just before receiving data.
|
boolean |
getAutoCommit()
Check if this session is in auto-commit mode.
|
int |
getClientVersion() |
java.util.ArrayList<java.lang.String> |
getClusterServers()
Get the list of the cluster servers for this session.
|
CompareMode |
getCompareMode()
Return compare mode.
|
int |
getCurrentId() |
java.lang.String |
getCurrentSchemaName()
Get current schema.
|
java.lang.String |
getDatabasePath()
Get the database path.
|
DataHandler |
getDataHandler()
Get the data handler object.
|
JavaObjectSerializer |
getJavaObjectSerializer()
Return the serializer to be used for java objects being stored in
column of type OTHER.
|
int |
getLastReconnect() |
java.lang.String |
getLobCompressionAlgorithm(int type)
Get the compression algorithm used for large objects.
|
SmallLRUCache<java.lang.String,java.lang.String[]> |
getLobFileListCache()
Get the lob file list cache if it is used.
|
LobStorageInterface |
getLobStorage()
Get the lob storage mechanism to use.
|
java.lang.Object |
getLobSyncObject()
Get the synchronization object for lob operations.
|
int |
getMaxLengthInplaceLob()
Get the maximum length of a in-place large object
|
int |
getNextId() |
int |
getPowerOffCount()
Get the number of disk operations before power failure is simulated.
|
TempFileDeleter |
getTempFileDeleter()
Get the temp file deleter mechanism.
|
Trace |
getTrace()
Get the trace object
|
boolean |
hasPendingTransaction()
Check whether this session has a pending transaction.
|
boolean |
isClosed()
Check if close was called.
|
boolean |
isClustered()
Returns true if the connection was opened in cluster mode.
|
boolean |
isReconnectNeeded(boolean write)
Check if the database changed and therefore reconnecting is required.
|
boolean |
isRemote()
Check if this session is remote or embedded.
|
boolean |
isSupportsGeneratedKeys()
Returns is this session supports generated keys.
|
FileStore |
openFile(java.lang.String name,
java.lang.String mode,
boolean mustExist)
Open a file at the given location.
|
CommandInterface |
prepareCommand(java.lang.String sql,
int fetchSize)
Parse a command and prepare it for execution.
|
int |
readLob(long lobId,
byte[] hmac,
long offset,
byte[] buff,
int off,
int length)
Read from a lob.
|
void |
readSessionState()
Read the session state if necessary.
|
SessionInterface |
reconnect(boolean write)
Close the connection and open a new connection.
|
protected void |
recreateSessionState()
Re-create the session state using the stored sessionState list.
|
void |
removeServer(java.io.IOException e,
int i,
int count)
Remove a server from the list of cluster nodes and disables the cluster
mode.
|
void |
setAutoCommit(boolean autoCommit)
Set the auto-commit mode.
|
void |
setAutoCommitFromServer(boolean autoCommit) |
void |
setCurrentSchemaName(java.lang.String schema)
Set current schema.
|
void |
setPowerOffCount(int count)
Set the number of disk operations before power failure is simulated.
|
void |
traceOperation(java.lang.String operation,
int id)
Write the operation to the trace system if debug trace is enabled.
|
public static final int SESSION_PREPARE
public static final int SESSION_CLOSE
public static final int COMMAND_EXECUTE_QUERY
public static final int COMMAND_EXECUTE_UPDATE
public static final int COMMAND_CLOSE
public static final int RESULT_FETCH_ROWS
public static final int RESULT_RESET
public static final int RESULT_CLOSE
public static final int COMMAND_COMMIT
public static final int CHANGE_ID
public static final int COMMAND_GET_META_DATA
public static final int SESSION_PREPARE_READ_PARAMS
public static final int SESSION_SET_ID
public static final int SESSION_CANCEL_STATEMENT
public static final int SESSION_CHECK_KEY
public static final int SESSION_SET_AUTOCOMMIT
public static final int SESSION_HAS_PENDING_TRANSACTION
public static final int LOB_READ
public static final int SESSION_PREPARE_READ_PARAMS2
public static final int STATUS_ERROR
public static final int STATUS_OK
public static final int STATUS_CLOSED
public static final int STATUS_OK_STATE_CHANGED
protected java.util.ArrayList<java.lang.String> sessionState
protected boolean sessionStateChanged
public SessionRemote(ConnectionInfo ci)
public java.util.ArrayList<java.lang.String> getClusterServers()
SessionInterfacegetClusterServers in interface SessionInterfacepublic boolean hasPendingTransaction()
SessionInterfacehasPendingTransaction in interface SessionInterfacepublic void cancel()
SessionInterfacecancel in interface SessionInterfacepublic void cancelStatement(int id)
id - the statement idpublic int getClientVersion()
public boolean getAutoCommit()
SessionInterfacegetAutoCommit in interface SessionInterfacepublic void setAutoCommit(boolean autoCommit)
SessionInterfacesetAutoCommit in interface SessionInterfaceautoCommit - the new valuepublic void setAutoCommitFromServer(boolean autoCommit)
public void autoCommitIfCluster()
public int getPowerOffCount()
SessionInterfacegetPowerOffCount in interface SessionInterfacepublic void setPowerOffCount(int count)
SessionInterfacesetPowerOffCount in interface SessionInterfacecount - the number of operationspublic SessionInterface connectEmbeddedOrServer(boolean openNew)
openNew - whether to open a new session in any casepublic void removeServer(java.io.IOException e,
int i,
int count)
e - the exception (used for debugging)i - the index of the server to removecount - the retry count indexpublic CommandInterface prepareCommand(java.lang.String sql, int fetchSize)
SessionInterfaceprepareCommand in interface SessionInterfacesql - the SQL statementfetchSize - the number of rows to fetch in one steppublic void checkClosed()
DbException - if the session is closedpublic void close()
SessionInterfaceclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface SessionInterfacepublic Trace getTrace()
SessionInterfacegetTrace in interface SessionInterfacepublic int getNextId()
public int getCurrentId()
public void done(Transfer transfer) throws java.io.IOException
transfer - the transfer objectDbException - if the server sent an exceptionjava.io.IOException - if there is a communication problem between client
and serverpublic boolean isClustered()
public boolean isClosed()
SessionInterfaceisClosed in interface SessionInterfacepublic void traceOperation(java.lang.String operation,
int id)
operation - the operation performedid - the id of the operationpublic void checkPowerOff()
DataHandlercheckPowerOff in interface DataHandlerpublic void checkWritingAllowed()
DataHandlercheckWritingAllowed in interface DataHandlerpublic java.lang.String getDatabasePath()
DataHandlergetDatabasePath in interface DataHandlerpublic java.lang.String getLobCompressionAlgorithm(int type)
DataHandlergetLobCompressionAlgorithm in interface DataHandlertype - the data type (CLOB or BLOB)public int getMaxLengthInplaceLob()
DataHandlergetMaxLengthInplaceLob in interface DataHandlerpublic FileStore openFile(java.lang.String name, java.lang.String mode, boolean mustExist)
DataHandleropenFile in interface DataHandlername - the file namemode - the modemustExist - whether the file must already existpublic DataHandler getDataHandler()
SessionInterfacegetDataHandler in interface SessionInterfacepublic java.lang.Object getLobSyncObject()
DataHandlergetLobSyncObject in interface DataHandlerpublic SmallLRUCache<java.lang.String,java.lang.String[]> getLobFileListCache()
DataHandlergetLobFileListCache in interface DataHandlerpublic int getLastReconnect()
public TempFileDeleter getTempFileDeleter()
DataHandlergetTempFileDeleter in interface DataHandlerpublic boolean isReconnectNeeded(boolean write)
SessionInterfaceisReconnectNeeded in interface SessionInterfacewrite - if the next operation may be writingpublic SessionInterface reconnect(boolean write)
SessionInterfacereconnect in interface SessionInterfacewrite - if the next operation may be writingpublic void afterWriting()
SessionInterfaceafterWriting in interface SessionInterfacepublic LobStorageInterface getLobStorage()
DataHandlergetLobStorage in interface DataHandlerpublic int readLob(long lobId,
byte[] hmac,
long offset,
byte[] buff,
int off,
int length)
DataHandlerreadLob in interface DataHandlerlobId - the lob idhmac - the message authentication codeoffset - the offset within the lobbuff - the target bufferoff - the offset within the target bufferlength - the number of bytes to readpublic JavaObjectSerializer getJavaObjectSerializer()
DataHandlergetJavaObjectSerializer in interface DataHandlerpublic void addTemporaryLob(Value v)
SessionInterfaceaddTemporaryLob in interface SessionInterfacev - the valuepublic CompareMode getCompareMode()
DataHandlergetCompareMode in interface DataHandlerpublic boolean isRemote()
SessionInterfaceisRemote in interface SessionInterfacepublic java.lang.String getCurrentSchemaName()
SessionInterfacegetCurrentSchemaName in interface SessionInterfacepublic void setCurrentSchemaName(java.lang.String schema)
SessionInterfacesetCurrentSchemaName in interface SessionInterfaceschema - the schema namepublic boolean isSupportsGeneratedKeys()
SessionInterfaceisSupportsGeneratedKeys in interface SessionInterfacetrue if generated keys are supported, false if only
SCOPE_IDENTITY() is supportedprotected void recreateSessionState()
public void readSessionState()