mirror of
https://github.com/dg/dibi.git
synced 2025-10-17 07:46:23 +02:00
* out of range seek() throws exception * deprecated DibiDriver::errorInfo * fixed seek(0) on first iteration * added DibiDatabaseException::catchError() & restore() for converting errors to exceptions
27 lines
499 B
PHP
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);
|