Views
Data Access Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Static Public Member Functions
IliTransactionManager Class Reference

Table class. More...

#include <ilviews/dataccess/transmgr.h>

Inheritance diagram for IliTransactionManager:
IliRefCounted

Public Member Functions

 IliTransactionManager ()
 Initializes an anonymous transaction manager.
 
IlBoolean accept ()
 Accepts all recorded events. More...
 
void addErrorSink (IliErrorSink *sink)
 Adds an error sink to the transaction manager. More...
 
IlBoolean cancel ()
 Cancels all recorded events. More...
 
IlInt getEventCount () const
 Returns the number of events recorded in the transaction manager. More...
 
IliTablegetEventTable (IlInt idx) const
 Returns an event table. More...
 
EventType getEventType (IlInt idx) const
 Returns an event type. More...
 
const char * getName () const
 Returns the transaction manager name. More...
 
IlBoolean hasAName () const
 Indicates whether the transaction manager has a name. More...
 
IlBoolean isRecording () const
 Returns IlTrue if the transaction manager has been started and if events should be recorded. More...
 
IlBoolean isStarted () const
 Returns IlTrue if the transaction manager has been started. More...
 
void recordDeleteRow (IliTable *tbl, IlInt row)
 This member function should be called just before a row is deleted. More...
 
void recordExchangeRows (IliTable *tbl, IlInt row1, IlInt row2)
 This member function should be called when a row in the table has been exchanged with another. More...
 
void recordInsertRow (IliTable *tbl, IlInt row, const IliTableBuffer *buff)
 This member function should be called when a row is inserted. More...
 
void recordMoveRow (IliTable *tbl, IlInt from, IlInt to)
 This member function should be called when a row is moved to another position. More...
 
void recordUpdateRow (IliTable *tbl, IlInt row, const IliTableBuffer *buff)
 This member function should be called when a row is updated. More...
 
void removeErrorSink (IliErrorSink *sink)
 Removes an error sink from this transaction manager. More...
 
void start ()
 Starts the transaction manager.
 
void stop ()
 Stops the transaction manager.
 
- Public Member Functions inherited from IliRefCounted
IlInt getRefCount () const
 Returns the reference count of the object. Initially, this property is set to 0. More...
 
void lock () const
 Increments the reference count of the object.
 
void unLock () const
 Decrements the reference count of the object. More...
 

Static Public Member Functions

static IliTransactionManagerAt (IlInt idx)
 Returns a transaction manager. More...
 
static IlInt Count ()
 Returns the number of named transaction managers that exist. More...
 
static IliTransactionManagerGet (const char *name, IlBoolean createIt=IlFalse)
 Returns a transaction manager. More...
 

Additional Inherited Members

- Protected Member Functions inherited from IliRefCounted
virtual ~IliRefCounted ()
 This is the virtual destructor of the IliRefCounted class. More...
 

Detailed Description

Table class.

Library: dataccess

The IliTransactionManager class manages so-called local transactions where one or more IliTable objects can defer the propagation of changes they undergo until a later function call occurs. The transaction manager is responsible for recording all these changes as they happen so that it can do one of the following:

See also
IliTable.

Accessors\nAccessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods <tt>IlvValueInterface::queryValue()</tt>, <tt>IlvValueInterface::queryValues()</tt>, <tt>IlvValueInterface::changeValue()</tt>, <tt>IlvValueInterface::changeValues()</tt>.\n\nThis class defines the following accessors:

Data accessors

Name Type Equivalent methods
eventCount Int getEventCount() (read-only)

Method accessors

Name Return type Equivalent methods
isStarted() Boolean isStarted()
start() Void start(). See [start] below.
stop() Void stop()
cancel() Boolean cancel()
accept() Boolean accept()
getEventTable(Int idx) Object getEventTable(idx)
getEventType(Int idx) Int getEventType(idx)
addErrorSink(Object sink) Void See [errorSink] below.
removeErrorSink(Object sink) Void See [errorSink] below.

[start]: The following Rogue Wave Views Script code assigns the same transaction manager to two given IliTable objects and then starts the transaction manager:

var tbl_EMP = IliRepository.EMP_DS.table;
var tbl_DEPT = IliRepository.DEPT_DS.table;
tbl_EMP.transactionManagerName = 'TM_1';
tbl_DEPT.transactionManagerName = 'TM_1';
var tm = tbl_EMP.transactionManager;
tm.start();

[errorSink]: The sink parameter can be one of the following:

Member Function Documentation

◆ accept()

IlBoolean IliTransactionManager::accept ( )

Accepts all recorded events.

This typically involves having all two-tier tables propagate updates to their remote storage manager. If successful, the event count is reset to 0. Otherwise, the event count remains unchanged. Note that if a two-tier table (such as an IliSQLTable object) is involved in one or more of the events, a rollback should be issued by the user to its SQL session or else the state of the database transaction may become inconsistent with the state of the IliSQLTable object. Events are accepted in order of occurrence (from the oldest to the most recent). In the case where one event fails, no attempt is made to accept the subsequent events in the chain and IlFalse is immediately returned.

Returns
IlTrue if successful.

◆ addErrorSink()

void IliTransactionManager::addErrorSink ( IliErrorSink sink)

Adds an error sink to the transaction manager.

Any errors that occur during calls to the cancel() and accept() member functions will be forwarded to this error sink.

Parameters
sinkThe added error sink.

◆ At()

static IliTransactionManager* IliTransactionManager::At ( IlInt  idx)
static

Returns a transaction manager.

Parameters
idxThe transaction manager index.
Returns
The named transaction manager positioned at idx or 0 if the position is out of bound.

◆ cancel()

IlBoolean IliTransactionManager::cancel ( )

Cancels all recorded events.

This typically involves reverting the IliTable objects to the state they had before the transaction started. If successful, the event count is reset to 0. Otherwise, the event count remains unchanged.

Returns
IlTrue if successful.

◆ Count()

static IlInt IliTransactionManager::Count ( )
static

Returns the number of named transaction managers that exist.

Returns
The count.

◆ Get()

static IliTransactionManager* IliTransactionManager::Get ( const char *  name,
IlBoolean  createIt = IlFalse 
)
static

Returns a transaction manager.

Parameters
nameThe transaction manager name.
createItIf IlTrue, the transaction manager is created when it does not exist.
Returns
The transaction manager. If no such transaction manager exists and if createIt is IlTrue, a new transaction manager named name is created and returned. Otherwise, 0 is returned.

◆ getEventCount()

IlInt IliTransactionManager::getEventCount ( ) const

Returns the number of events recorded in the transaction manager.

Returns
The number of events recorded in the transaction manager. Each event corresponds to one of the following IliTable operations:

◆ getEventTable()

IliTable* IliTransactionManager::getEventTable ( IlInt  idx) const

Returns an event table.

Parameters
idxThe event position.
Returns
The IliTable object from which the event at position idx originates or 0 if the position is out of bound.

◆ getEventType()

EventType IliTransactionManager::getEventType ( IlInt  idx) const

Returns an event type.

Parameters
idxThe event position.
Returns
The type of the event at position idx or UndefinedEvent if idx is out of bound. The type can be one of the following:
  • UndefinedEvent
  • InsertRowEvent
  • UpdateRowEvent
  • DeleteRowEvent
  • MoveRowEvent
  • ExchangeRowsEvent

◆ getName()

const char* IliTransactionManager::getName ( ) const

Returns the transaction manager name.

Returns
The name of the transaction manager or the empty string if it has no name.

◆ hasAName()

IlBoolean IliTransactionManager::hasAName ( ) const

Indicates whether the transaction manager has a name.

Returns
IlTrue if the transaction manager has a name.

◆ isRecording()

IlBoolean IliTransactionManager::isRecording ( ) const

Returns IlTrue if the transaction manager has been started and if events should be recorded.

Returns
IlTrue if the transaction manager has been started and if events should be recorded. Returns IlFalse if the transaction manager has not been started or if it is currently performing one of the accept() or cancel() member functions. In such cases, no events should be recorded.

◆ isStarted()

IlBoolean IliTransactionManager::isStarted ( ) const

Returns IlTrue if the transaction manager has been started.

Returns
IlTrue if the transaction manager has been started.

◆ recordDeleteRow()

void IliTransactionManager::recordDeleteRow ( IliTable tbl,
IlInt  row 
)

This member function should be called just before a row is deleted.

Parameters
tblThe table.
rowThe delete row position.

◆ recordExchangeRows()

void IliTransactionManager::recordExchangeRows ( IliTable tbl,
IlInt  row1,
IlInt  row2 
)

This member function should be called when a row in the table has been exchanged with another.

Parameters
tblThe table.
row1The first row position.
row2The second row position.

◆ recordInsertRow()

void IliTransactionManager::recordInsertRow ( IliTable tbl,
IlInt  row,
const IliTableBuffer buff 
)

This member function should be called when a row is inserted.

Parameters
tblThe table.
rowThe row insertion position.
buffThe values of the new row.

◆ recordMoveRow()

void IliTransactionManager::recordMoveRow ( IliTable tbl,
IlInt  from,
IlInt  to 
)

This member function should be called when a row is moved to another position.

Parameters
tblThe table.
fromThe from position.
toThe to position.

◆ recordUpdateRow()

void IliTransactionManager::recordUpdateRow ( IliTable tbl,
IlInt  row,
const IliTableBuffer buff 
)

This member function should be called when a row is updated.

Parameters
tblThe table.
rowThe position of the updated row.
buffThe modified values of the row.

◆ removeErrorSink()

void IliTransactionManager::removeErrorSink ( IliErrorSink sink)

Removes an error sink from this transaction manager.

Parameters
sinkThe removed error sink.