Validates current transaction.
|
bool i5_commit ( |
string comment |
Validate current transaction started with i5_transaction function for the specified connection.
A comment will be added in the journal file.
All files involved in a transaction must be journalized.
See column Journals and transactions with I5 files .
|
comment |
Chain with transaction comment |
|
connection |
Connection ID |
Returns:
TRUE if transaction is valid, FALSE in case of error.
|
I5_ERR_PHP_HDLDFT |
256 |
No default connection found. |
|
I5_ERR_PHP_HDLCONN |
257 |
This resource has no connection active. |
|
I5_ERR_PHP_RESOURCE_BAD |
261 |
No resource found . |
|
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
|
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
|
I5_ERR_PHP_NBPARAM_BAD |
263 |
Wrong parameter count |
$conn = i5_connect("MY_AS", "USER", "PASSWORD");
if ($conn) {
$res = i5_query("SELECT count(*) FROM animals");
$rec = i5_fetch_array($res );
echo $rec[0] . "\n";
/* Transaction beginning */
i5_transaction(I5_ISOLEVEL_NONE);
/* Lines insertion in ANIMALS */
i5_query("INSERT INTO Animals VALUES ('CAT', 'Misstic', 'F', 3.2)");
i5_query("INSERT INTO Language VALUES ('DOG', 'Hercule', 'M', 4.4)");
$res = i5_query("SELECT count(*) FROM animals");
$rec = i5_fetch_array($res);
echo $rec[0] . "\n";
/* Transaction and DELETE request validation */
i5_commit($conn);
$res = i5_query("SELECT count(*) FROM animals");
$rec = i5_fetch_array($res);
echo $rec[0] . "\n";
i5_close($conn);
}