1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-20 09:16:30 +02:00
Files
php-dibi/examples/metatypes.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

29 lines
531 B
PHP

<h1>dibi metatypes example</h1>
<pre>
<?php
require_once '../dibi/dibi.php';
dibi::connect(array(
'driver' => 'sqlite',
'database' => 'sample.sdb',
));
$res = dibi::query('SELECT * FROM [customers]');
if (!$res) die('SQL error');
// auto-convert this field to integer
$res->setType('customer_id', Dibi::FIELD_INTEGER);
$row = $res->fetch();
var_dump($row);
// auto-detect all types
// WARNING: THIS WILL NOT WORK WITH SQLITE
$res->setType(TRUE);
$row = $res->fetch();
var_dump($row);