mirror of
https://github.com/dg/dibi.git
synced 2025-08-30 01:09:50 +02:00
* added dibi::date & dibi::datetime
* DibiConnection::insertId && affectedRows throws exception on failure * added protected throwException() to drivers * DibiPostgreDriver - can build connection string * DibiSqliteDriver - support for parameters 'format:date' & 'format:datetime' * fixed query errors in DibiSqliteDriver * DibiConnection prevents serialization and multiple transactions
This commit is contained in:
30
examples/datetime.demo.php
Normal file
30
examples/datetime.demo.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<h1>DibiVariableInterface example</h1>
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
// required since PHP 5.1.0
|
||||
if (function_exists('date_default_timezone_set')) {
|
||||
date_default_timezone_set('Europe/Prague');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// CHANGE TO REAL PARAMETERS!
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
'database' => 'sample.sdb',
|
||||
'format:date' => "'Y-m-d'",
|
||||
'format:datetime' => "'Y-m-d H-i-s'",
|
||||
));
|
||||
|
||||
|
||||
|
||||
// generate and dump SQL
|
||||
dibi::test("
|
||||
INSERT INTO [mytable]", array(
|
||||
'id' => 123,
|
||||
'date' => dibi::date('12.3.2007'),
|
||||
'stamp' => dibi::dateTime('23.1.2007 10:23'),
|
||||
));
|
Reference in New Issue
Block a user