mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
* added dibi::date & dibi::datetime
* DibiConnection::insertId && affectedRows throws exception on failure * added protected throwException() to drivers * DibiPostgreDriver - can build connection string * DibiSqliteDriver - support for parameters 'format:date' & 'format:datetime' * fixed query errors in DibiSqliteDriver * DibiConnection prevents serialization and multiple transactions
This commit is contained in:
28
examples/transaction.php
Normal file
28
examples/transaction.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<h1>dibi transaction example</h1>
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
'database' => 'sample.sdb',
|
||||
));
|
||||
|
||||
|
||||
echo "<h2>Before:</h2>\n";
|
||||
dibi::query('SELECT * FROM [products]')->dump();
|
||||
|
||||
|
||||
|
||||
dibi::begin();
|
||||
dibi::query('INSERT INTO [products]', array(
|
||||
'title' => 'Test product',
|
||||
));
|
||||
dibi::rollback(); // or dibi::commit();
|
||||
|
||||
|
||||
|
||||
echo "<h2>After:</h2>\n";
|
||||
dibi::query('SELECT * FROM [products]')->dump();
|
Reference in New Issue
Block a user