i5_rollback

 

Cancels current transaction.

 

bool i5_rollback

( [resource connection] )

 

Details

 

Cancels all changes made since transaction was started with i5_transaction function.

An I5_NOTINTRAN error will be generated if no transaction was started.

 

Parameters

 

connection

Connection ID(optional)

 

Returns:

True if OK, false if failed.

 

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipement; 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.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

 

 

Example

 

<?php
$conn = i5_connect("MON_AS", "USER", "PASSWORD");

if ($conn) {
    $res = i5_query("SELECT count(*) FROM animals");
    $rec = i5_fetch_array($res );
    echo $res[0] . "\n";
    

    /* Transaction beginning */

    i5_transaction($conn); 

   


    /* All ANIMALS lines deletion */
    i5_query("DELETE * FROM animals");
    
    $res = i5_query("SELECT count(*) FROM animals");
    $rec = i5_fetch_array($res);
    echo $res[0] . "\n";


    /* Cancel DELETE request */
    i5_rollback($conn);
    
    $res = i5_query("SELECT count(*) FROM animals");
    $rec = i5_fetch_array($res);
    echo $rec[0] . "\n";
    i5_close($conn);
    
}
?>

 

This will display:

43

0

43

 

See also

 

i5_transaction

i5_commit