1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-24 11:16:08 +02:00
Files
php-dibi/examples/logger.php
David Grudl d35a850311 * removed $throwExceptions (always throws)
* added DibiLogger, dibi::notify(), dibi::startLogger()
* miniprofiler dibi::$numOfQueries, $totalTime, $elapsedTime
* simplified DibiException, added DibiDatabaseException
* Dibi::nativeQuery splitted into DibiDriver::doQuery & nativeQuery()
* moved dibi::dumpResult -> DibiResult::dump()
* moved dibi::test() -> DibiDriver::test()
* DibiTranslator generates $mask
2007-09-29 07:53:25 +00:00

35 lines
728 B
PHP

<h1>dibi logger example</h1>
<?php
require_once '../dibi/dibi.php';
// enable log to this file, TRUE means "log all queries"
dibi::startLogger('log.sql', TRUE);
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'sample.sdb',
));
try {
$res = dibi::query('SELECT * FROM [customers] WHERE [customer_id] = %i', 1);
$res = dibi::query('SELECT * FROM [customers] WHERE [customer_id] < %i', 5);
$res = dibi::query('SELECT FROM [customers] WHERE [customer_id] < %i', 38);
} catch (DibiException $e) {
echo '<h2>Dibi Exception:</h2>';
echo '<pre>', $e, '</pre>';
}
echo "<h2>File log.sql:</h2>";
echo '<pre>', file_get_contents('log.sql'), '</pre>';