PHP Class PhpOrient\Protocols\Binary\Transaction\TxCommit

Commits a transaction. This operation flushes all the pending changes to the server side.
 
   Request: (tx-id:int)(using-tx-log:byte)(tx-entry)*(0-byte indicating end-of-records)
   tx-entry: (operation-type:byte)(cluster-id:short)(cluster-position:long)(record-type:byte)(entry-content)

   entry-content for CREATE: (record-content:bytes)
   entry-content for UPDATE: (version:record-version)(content-changed:boolean)(record-content:bytes)
   entry-content for DELETE: (version:record-version)

   Response: (created-record-count:int)[(client-specified-cluster-id:short)(client-specified-cluster-position:long)(created-cluster-id:short)(created-cluster-position:long)]*(updated-record-count:int)[(updated-cluster-id:short)(updated-cluster-position:long)(new-record-version:int)]*(count-of-collection-changes:int)[(uuid-most-sig-bits:long)(uuid-least-sig-bits:long)(updated-file-id:long)(updated-page-index:long)(updated-page-offset:int)]*
  
Where:
  • tx-id is the Transaction's Id
  • use-tx-log tells if the server must use the Transaction Log to recover the transaction. 1 = true, 0 = false
  • operation-type can be:
    • 1, for UPDATES
    • 2, for DELETES
    • 3, for CREATIONS
  • record-content depends on the operation type:
    • For UPDATED (1): (original-record-version:int)(record-content:bytes)
    • For DELETED (2): (original-record-version:int)
    • For CREATED (3): (record-content:bytes)
This response contains two parts: a map of 'temporary' client-generated record ids to 'real' server-provided record ids for each CREATED record, and a map of UPDATED record ids to update record-versions. Look at Optimistic Transaction to know how temporary RecordIDs are managed. The last part or response is referred to RidBag management. Take a look at the main page for more details.
Inheritance: extends PhpOrient\Protocols\Binary\Abstracts\Operation, use trait PhpOrient\Protocols\Binary\Abstracts\NeedDBOpenedTrait
Mostrar archivo Open project: ostico/phporient Class Usage Examples

Protected Properties

Property Type Description
$_operation_records array Records after the transaction
$_operation_stack array List of operation to execute
$_pre_operation_records array Records backup before the transaction execution
$_temp_cluster_position_seq integer When a record is created in transaction it's position is negative
$_txId integer Transaction Id
$opCode The op code.

Public Methods

Method Description
attach ( Operation $operation )
begin ( ) Starts a transaction by initializing params
commit ( )
rollback ( )

Protected Methods

Method Description
_getTransactionId ( ) : integer
_read ( ) : mixed Read the response from the socket.
_write ( ) Write the data to the socket.

Method Details

_getTransactionId() protected method

protected _getTransactionId ( ) : integer
return integer

_read() protected method

Read the response from the socket.
protected _read ( ) : mixed
return mixed the response.

_write() protected method

Write the data to the socket.
protected _write ( )

attach() public method

public attach ( Operation $operation )
$operation PhpOrient\Protocols\Binary\Abstracts\Operation

begin() public method

Starts a transaction by initializing params
public begin ( )

commit() public method

public commit ( )

rollback() public method

public rollback ( )

Property Details

$_operation_records protected_oe property

Records after the transaction
protected array $_operation_records
return array

$_operation_stack protected_oe property

List of operation to execute
protected array $_operation_stack
return array

$_pre_operation_records protected_oe property

Records backup before the transaction execution
protected array $_pre_operation_records
return array

$_temp_cluster_position_seq protected_oe property

When a record is created in transaction it's position is negative
protected int $_temp_cluster_position_seq
return integer

$_txId protected_oe property

Transaction Id
protected int $_txId
return integer

$opCode protected_oe property

The op code.
protected $opCode