mirror of
https://github.com/dg/dibi.git
synced 2025-07-31 19:30:30 +02:00
updated Nette Debugger
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -7,6 +7,7 @@
|
||||
require_once 'Nette/Debugger.php';
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
ndebug();
|
||||
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
@@ -29,38 +30,38 @@ product_id | title
|
||||
// fetch a single row
|
||||
echo "<h2>fetch()</h2>\n";
|
||||
$row = dibi::fetch('SELECT title FROM products');
|
||||
Debugger::dump($row); // Chair
|
||||
dump($row); // Chair
|
||||
|
||||
|
||||
// fetch a single value
|
||||
echo "<h2>fetchSingle()</h2>\n";
|
||||
$value = dibi::fetchSingle('SELECT title FROM products');
|
||||
Debugger::dump($value); // Chair
|
||||
dump($value); // Chair
|
||||
|
||||
|
||||
// fetch complete result set
|
||||
echo "<h2>fetchAll()</h2>\n";
|
||||
$all = dibi::fetchAll('SELECT * FROM products');
|
||||
Debugger::dump($all);
|
||||
dump($all);
|
||||
|
||||
|
||||
// fetch complete result set like association array
|
||||
echo "<h2>fetchAssoc('title')</h2>\n";
|
||||
$res = dibi::query('SELECT * FROM products');
|
||||
$assoc = $res->fetchAssoc('title'); // key
|
||||
Debugger::dump($assoc);
|
||||
dump($assoc);
|
||||
|
||||
|
||||
// fetch complete result set like pairs key => value
|
||||
echo "<h2>fetchPairs('product_id', 'title')</h2>\n";
|
||||
$pairs = $res->fetchPairs('product_id', 'title');
|
||||
Debugger::dump($pairs);
|
||||
dump($pairs);
|
||||
|
||||
|
||||
// fetch row by row
|
||||
echo "<h2>using foreach</h2>\n";
|
||||
foreach ($res as $n => $row) {
|
||||
Debugger::dump($row);
|
||||
dump($row);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,12 +75,12 @@ $res = dibi::query('
|
||||
|
||||
echo "<h2>fetchAssoc('customers.name|products.title')</h2>\n";
|
||||
$assoc = $res->fetchAssoc('customers.name|products.title'); // key
|
||||
Debugger::dump($assoc);
|
||||
dump($assoc);
|
||||
|
||||
echo "<h2>fetchAssoc('customers.name[]products.title')</h2>\n";
|
||||
$assoc = $res->fetchAssoc('customers.name[]products.title'); // key
|
||||
Debugger::dump($assoc);
|
||||
dump($assoc);
|
||||
|
||||
echo "<h2>fetchAssoc('customers.name->products.title')</h2>\n";
|
||||
$assoc = $res->fetchAssoc('customers.name->products.title'); // key
|
||||
Debugger::dump($assoc);
|
||||
dump($assoc);
|
||||
|
@@ -15,7 +15,7 @@ require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
// enable Nette Debugger
|
||||
Debugger::enable();
|
||||
ndebug();
|
||||
|
||||
|
||||
dibi::connect(array(
|
||||
|
@@ -15,7 +15,7 @@ require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
// enable Nette Debugger
|
||||
Debugger::enable();
|
||||
NDebugger::enable();
|
||||
|
||||
|
||||
dibi::connect(array(
|
||||
@@ -27,4 +27,4 @@ dibi::connect(array(
|
||||
));
|
||||
|
||||
|
||||
Debugger::barDump( dibi::fetchAll('SELECT * FROM customers WHERE customer_id < ?', 38), '[customers]' );
|
||||
NDebugger::barDump( dibi::fetchAll('SELECT * FROM customers WHERE customer_id < ?', 38), '[customers]' );
|
||||
|
@@ -7,6 +7,7 @@
|
||||
require_once 'Nette/Debugger.php';
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
ndebug();
|
||||
date_default_timezone_set('Europe/Prague');
|
||||
|
||||
|
||||
@@ -24,7 +25,7 @@ $res->setType('customer_id', Dibi::INTEGER)
|
||||
->setFormat(dibi::DATETIME, 'Y-m-d H:i:s');
|
||||
|
||||
|
||||
Debugger::dump( $res->fetch() );
|
||||
dump( $res->fetch() );
|
||||
// outputs:
|
||||
// object(DibiRow)#3 (3) {
|
||||
// customer_id => int(1)
|
||||
@@ -37,7 +38,7 @@ Debugger::dump( $res->fetch() );
|
||||
// using auto-detection (works well with MySQL or other strictly typed databases)
|
||||
$res = dibi::query('SELECT * FROM [customers]');
|
||||
|
||||
Debugger::dump( $res->fetch() );
|
||||
dump( $res->fetch() );
|
||||
// outputs:
|
||||
// object(DibiRow)#3 (3) {
|
||||
// customer_id => int(1)
|
||||
|
@@ -7,6 +7,7 @@
|
||||
require_once 'Nette/Debugger.php';
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
ndebug();
|
||||
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
@@ -27,4 +28,4 @@ function DibiResult_prototype_fetchShuffle(DibiResult $obj)
|
||||
// fetch complete result set shuffled
|
||||
$res = dibi::query('SELECT * FROM [customers]');
|
||||
$all = $res->fetchShuffle();
|
||||
Debugger::dump($all);
|
||||
dump($all);
|
||||
|
Reference in New Issue
Block a user