PreviousNext
Help > API Functions > Transaction > i5_transaction
i5_transaction

 

 Starts transaction.

 

 bool i5_transaction (int mode [, resource connection])

 


Parameters

 

connection

Connection ID

mode

Easycom constant (see below)

 

 

Return

TRUE if transaction has started, FALSE in case of error.

 

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipements.

error number 42

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x

and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

 

 

Details

Transactions management requires some rules, i.e. files journalization.

Several transaction modes are possible, they define isolation level, that means, if applied, if changes will be visible or not to other users as well as writing access (open in writing or restricted access).

 

Modes

I5_ISOLEVEL_CHG

UR

READ UNCOMMITED, READ WRITE

 

Modified records remain locked.

Modifications are showed.

I5_ISOLEVEL_CS

CS

READ COMMITED

 

Read records are locked.

Modified records remain locked.

Changes are not showed.

I5_ISOLEVEL_ALL

RS

REPEATABLE READ

 

Read records remain locked.

Modified records remain locked.

Modifications are not showed.

 

Options details are out of this documentation purpose, refer to iSeries and DB2 documentation (particularly LCKLVL parameter of STRCMTCTL command).

If a transaction is currently active, an I5_ALREADYINTRAN error type will be generated.

 

Example  

    /* Transaction beginning */

$ret = i5_transaction(I5_ISOLEVEL_CHG, $Hdlcon);

if (!$ret)

{

               print_r("i5_transaction error : ".i5_errormsg().'<br/>');

}

else

{

               echo 'Transaction started<br/>';

}

 

See also

 

i5_commit

i5_rollback