1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-17 07:46:23 +02:00
Files
php-dibi/examples/metatypes.php
David Grudl ea00d5d37d * seek() or rowCount() in unbuffered mode throws exceptions
* out of range seek() throws exception
* deprecated DibiDriver::errorInfo
* fixed seek(0) on first iteration
* added DibiDatabaseException::catchError() & restore() for converting errors to exceptions
2007-11-12 01:39:26 +00:00

27 lines
499 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]');
// 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);