1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-22 01:48:05 +01:00
php-dibi/examples/metatypes.php
2007-06-25 17:02:12 +00:00

28 lines
498 B
PHP

<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);