public class CTBase
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected FairCom.CtreeDb.CTHANDLE |
m_handle
Internal JTDB handle
|
Constructor and Description |
---|
CTBase()
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
Abort()
Aborts a transaction started with a call to Begin().
|
void |
Begin()
Begins a transaction using the current
BEGIN_MODE value. |
void |
ClearSavePoint()
Clears the last transaction save point.
|
void |
Commit()
Commits a transaction started with a call to Begin().
|
boolean |
GetAutoCommit()
Retrieves the auto commit flag.
|
FairCom.CtreeDb.CTHANDLE |
GetHandle()
Retrieves the internal JTDB handle.
|
int |
GetKeepLock()
Retrieves the current
KEEPLOCK_MODE . |
int |
GetLockMode()
Retrieves the current
LOCK_MODE . |
int |
GetOperation()
Retrieves the
OPS_MODE for special performance-related
functionality and tests operational states for critical events. |
int |
GetTransactionMode()
Gets the current
BEGIN_MODE . |
boolean |
IsLockActive()
Checks if the locks are active.
|
boolean |
IsTransActive()
Indicates if a transaction has been started with a call to Begin(),
but not terminated with a call to Commit() or Abort().
|
boolean |
IsUnicodeLib()
Retrieves c-treeDB UNICODE mode.
|
void |
Lock(int mode)
Enables or disables record locks.
|
void |
PrepareCommit()
Prepares a two-phase commit transaction to be committed.
|
void |
RestoreSavePoint(int SavePoint)
Restores a previously set save point.
|
void |
SetAutoCommit(boolean flag)
Sets the auto commit mode.
|
void |
SetHandle(FairCom.CtreeDb.CTHANDLE Handle)
Sets the internal JTDB handle.
|
void |
SetKeepLock(int mode)
Sets the
KEEPLOCK_MODE applied when an active
transaction is commited or aborted by calling Abort() or Commit(). |
void |
SetOperation(int mode,
int state)
Sets the
OPS_MODE for special performance-related
functionality and tests operational states for critical events. |
int |
SetSavePoint()
Sets a new transaction save point.
|
void |
SetTransactionMode(int mode)
Sets the
BEGIN_MODE . |
void |
Unlock()
Disables record locks.
|
public boolean IsTransActive()
public void Begin() throws CTException
BEGIN_MODE
value.CTException
- in case of errorIsLockActive()
,
Commit()
,
Abort()
,
PrepareCommit()
,
SetTransactionMode(int)
public void Commit() throws CTException
CTException
- in case of errorIsLockActive()
,
Commit()
,
Abort()
,
PrepareCommit()
,
SetTransactionMode(int)
public void Abort() throws CTException
CTException
- in case of errorIsLockActive()
,
Commit()
,
Abort()
,
PrepareCommit()
,
SetTransactionMode(int)
public void PrepareCommit() throws CTException
CTException
- in case of errorIsLockActive()
,
Begin()
,
Commit()
,
Abort()
,
SetTransactionMode(int)
public int SetSavePoint() throws CTException
CTException
- in case of errorBegin()
,
Commit()
,
Abort()
,
RestoreSavePoint(int)
public void RestoreSavePoint(int SavePoint) throws CTException
SavePoint
- Previously saved save point number.CTException
- in case of errorBegin()
,
Commit()
,
Abort()
,
SetSavePoint()
public void ClearSavePoint() throws CTException
CTException
- in case of errorBegin()
,
Commit()
,
Abort()
,
SetSavePoint()
public FairCom.CtreeDb.CTHANDLE GetHandle()
SetHandle(FairCom.CtreeDb.CTHANDLE)
public void SetHandle(FairCom.CtreeDb.CTHANDLE Handle)
Handle
- internal JTDB handle.GetHandle()
public boolean GetAutoCommit()
CTRecord.Write()
method.SetAutoCommit(boolean)
public boolean IsLockActive()
LOCK_MODE
for the other modes.Lock(int)
,
GetLockMode()
,
Unlock()
public int GetLockMode()
LOCK_MODE
.Lock(int)
,
Unlock()
,
IsLockActive()
public void Lock(int mode) throws CTException
mode
- One of the c-tree plus lock modes LOCK_MODE
.CTException
- in case of errorGetLockMode()
,
Unlock()
public void Unlock() throws CTException
CTException
- in case of errorLock(int)
,
GetLockMode()
public int GetKeepLock()
KEEPLOCK_MODE
.Lock(int)
,
GetLockMode()
,
SetKeepLock(int)
public void SetKeepLock(int mode) throws CTException
KEEPLOCK_MODE
applied when an active
transaction is commited or aborted by calling Abort() or Commit().mode
- New KEEPLOCK_MODE
value.CTException
- in case of errorLock(int)
,
GetLockMode()
,
GetKeepLock()
public void SetTransactionMode(int mode) throws CTException
BEGIN_MODE
. If the transaction mode is
CTBEGIN_NONE, the ctTRNLOG mode is used to start a new transaction.mode
- New BEGIN_MODE
value.CTException
- in case of errorBegin()
,
Commit()
,
Abort()
,
GetTransactionMode()
public int GetTransactionMode()
BEGIN_MODE
.BEGIN_MODE
value.SetTransactionMode(int)
,
Begin()
,
Commit()
,
Abort()
public void SetAutoCommit(boolean flag) throws CTException
CTRecord.Write()
.
Automatic transactions may increase performance by reducing network traffic for
single record updates since this is equivalent of performing the following class:
hRecord.Begin()
try
{
hRecord.Write();
hRecord.Commit();
}
catch (CTException)
{
hRecord.Abort();
}
The following applies when an automatic transaction is performed:
1. An automatic transaction will only free locks acquired by
the CTRecord.Write()
method.
2. If an automatic transaction is aborted because of errors
detected by ctdbWriteRecord, all locks acquired by
CTRecord.Write()
are released.
3. If locks are active, by calling Lock() method, an automatic transaction will not release any locks when it commits or aborts the write operation.
4. If OPS_UNLOCK_UPD is on, both commits and aborts on automatic transactions release only locks obtained within the transaction and/or locks on records updated within the transaction, regardless of whether the c-treeDB session lock state is active or not.
flag
- New auto commit mode: true for enabled and false for disabled.CTException
- in case of errorGetAutoCommit()
,
Begin()
,
Commit()
,
Abort()
public int GetOperation()
OPS_MODE
for special performance-related
functionality and tests operational states for critical events.OPS_MODE
value.SetOperation(int, int)
public void SetOperation(int mode, int state) throws CTException
OPS_MODE
for special performance-related
functionality and tests operational states for critical events.mode
- new OPS_MODE
valuestate
- new OPS_STATE
valueCTException
- in case of errorSetOperation(int, int)
public boolean IsUnicodeLib()