Transactions

Solar_Sql begins in auto-commit mode, which means that all queries are committed to the database as they are executed.

If you want leave auto-commit mode and start a transaction, call Solar_Sql_Adapter::begin(). Then, after you save the transaction using Solar_Sql_Adapter::commit() or cancel it using Solar_Sql_Adapter::rollback(), Solar_Sql returns to auto-commit mode until you begin another transaction.

Here's a simple example:

$sql = Solar::factory('Solar_Sql');
$sql->begin(); // autocommit turns off
try {
    // do stuff, and then ...
    $sql->commit(); // autocommit turns on
} catch (Exception $e) {
    $sql->rollback(); // autocommit turns on
}