1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 19:30:30 +02:00

examples: files renamed

This commit is contained in:
David Grudl
2010-08-03 13:54:05 +02:00
parent 8f9435b518
commit beee4ee4b7
17 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
<h1>Using Extension Methods | dibi</h1>
<?php
require_once 'Nette/Debug.php';
require_once '../dibi/dibi.php';
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'data/sample.sdb',
));
// using the "prototype" to add custom method to class DibiResult
function DibiResult_prototype_fetchShuffle(DibiResult $obj)
{
$all = $obj->fetchAll();
shuffle($all);
return $all;
}
// fetch complete result set shuffled
$res = dibi::query('SELECT * FROM [customers]');
$all = $res->fetchShuffle();
Debug::dump($all);