2006-06-04 23:06:33 +00:00
|
|
|
<pre>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once '../dibi/dibi.php';
|
|
|
|
|
|
|
|
|
|
|
|
dibi::connect(array(
|
2007-05-11 22:25:32 +00:00
|
|
|
'driver' => 'sqlite',
|
|
|
|
'database' => 'sample.sdb',
|
2006-06-04 23:06:33 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
|
2007-05-11 22:25:32 +00:00
|
|
|
$res = dibi::query('SELECT * FROM [customers]');
|
2007-01-08 00:55:11 +00:00
|
|
|
if (!$res) die('SQL error');
|
2006-06-07 15:50:32 +00:00
|
|
|
|
2006-06-04 23:06:33 +00:00
|
|
|
|
|
|
|
// auto-convert this field to integer
|
2007-05-11 22:25:32 +00:00
|
|
|
$res->setType('customer_id', Dibi::FIELD_INTEGER);
|
2007-06-25 17:02:12 +00:00
|
|
|
$row = $res->fetch();
|
|
|
|
var_dump($row);
|
2006-06-04 23:06:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
// auto-detect all types
|
2007-05-11 22:25:32 +00:00
|
|
|
// WARNING: THIS WILL NOT WORK WITH SQLITE
|
2006-06-04 23:06:33 +00:00
|
|
|
$res->setType(TRUE);
|
2007-06-25 17:02:12 +00:00
|
|
|
$row = $res->fetch();
|
|
|
|
var_dump($row);
|