1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-21 17:58:02 +02:00
Files
php-dibi/examples/metatypes.php
2007-05-11 22:25:32 +00:00

28 lines
510 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);
$record = $res->fetch();
var_dump($record);
// auto-detect all types
// WARNING: THIS WILL NOT WORK WITH SQLITE
$res->setType(TRUE);
$record = $res->fetch();
var_dump($record);