DB_common::commit() -- Commits the current transaction
Descripción
Commits the current transaction.
Valor devuelto
integer - DB_OK on success
or a DB_Error object on failure
Nota
Esta función no puede ser llamada
estáticamente.
When using MySQL as your DBMS, transactions can only be used when the
tables in question use the InnoDB format.
Ejemplo
Ejemplo 35-1. Using commit()
<?php
// Once you have a valid DB object named $db...
$db->autoCommit(false);
$db->query('CREATE TABLE blah (a integer)');
$db->commit();
$db->query('INSERT INTO blah (a) VALUES (11)');
$res =& $db->query('SELECT a FROM blah');
if (DB::isError($res)) {
echo $res->getMessage() . "\n";
}
while ($res->fetchInto($row, DB_FETCHMODE_ORDERED)) {
echo $row[0] . "\n";
}
$res->free();
$db->query('DROP TABLE blah');
$db->commit();
?>
|
|