2013-07-02 18:42:55 +02:00
|
|
|
<?php ob_start() // needed by FirePHP ?>
|
2010-08-03 11:48:51 +02:00
|
|
|
|
2010-08-03 12:28:07 +02:00
|
|
|
<!DOCTYPE html><link rel="stylesheet" href="data/style.css">
|
|
|
|
|
2010-08-03 11:48:51 +02:00
|
|
|
<h1>Using Profiler | dibi</h1>
|
2010-08-03 12:28:07 +02:00
|
|
|
|
2008-07-17 03:51:29 +00:00
|
|
|
<?php
|
|
|
|
|
2013-12-19 04:37:53 +01:00
|
|
|
require __DIR__ . '/../dibi/dibi.php';
|
2008-07-17 03:51:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
dibi::connect(array(
|
2015-06-19 03:11:36 +02:00
|
|
|
'driver' => 'sqlite3',
|
2012-10-18 23:00:12 +02:00
|
|
|
'database' => 'data/sample.s3db',
|
2012-01-19 03:02:36 +01:00
|
|
|
'profiler' => array(
|
|
|
|
'run' => TRUE,
|
2015-06-19 03:11:36 +02:00
|
|
|
),
|
2008-07-17 03:51:29 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
|
2010-08-03 11:48:51 +02:00
|
|
|
// execute some queries...
|
2015-06-19 03:11:36 +02:00
|
|
|
for ($i = 0; $i < 20; $i++) {
|
2012-01-03 05:14:44 +01:00
|
|
|
$res = dibi::query('SELECT * FROM [customers] WHERE [customer_id] < ?', $i);
|
2008-07-17 03:51:29 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 11:48:51 +02:00
|
|
|
// display output
|
2008-07-17 03:51:29 +00:00
|
|
|
?>
|
|
|
|
<p>Last query: <strong><?php echo dibi::$sql; ?></strong></p>
|
|
|
|
|
|
|
|
<p>Number of queries: <strong><?php echo dibi::$numOfQueries; ?></strong></p>
|
|
|
|
|
|
|
|
<p>Elapsed time for last query: <strong><?php echo sprintf('%0.3f', dibi::$elapsedTime * 1000); ?> ms</strong></p>
|
|
|
|
|
|
|
|
<p>Total elapsed time: <strong><?php echo sprintf('%0.3f', dibi::$totalTime * 1000); ?> ms</strong></p>
|
2008-10-28 02:06:55 +00:00
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<p>Dibi can log to your Firebug Console. You first need to install the Firefox, Firebug and FirePHP extensions. You can install them from here:</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843
|
|
|
|
<li>FirePHP: http://www.firephp.org/
|
2011-07-01 08:06:36 +02:00
|
|
|
</ul>
|