mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
- class DateTime support
- DibiProfiler checks whether headers was sent
This commit is contained in:
@@ -527,8 +527,13 @@ class dibi
|
|||||||
{
|
{
|
||||||
if ($time === NULL) {
|
if ($time === NULL) {
|
||||||
$time = time(); // current time
|
$time = time(); // current time
|
||||||
|
|
||||||
} elseif (is_numeric($time)) {
|
} elseif (is_numeric($time)) {
|
||||||
$time = (int) $time; // timestamp
|
$time = (int) $time; // timestamp
|
||||||
|
|
||||||
|
} elseif ($time instanceof DateTime) {
|
||||||
|
$time = $time->format('U');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$time = strtotime($time); // try convert to timestamp
|
$time = strtotime($time); // try convert to timestamp
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ class DibiProfiler extends DibiObject implements IDibiProfiler
|
|||||||
if (($event & $this->filter) === 0) return;
|
if (($event & $this->filter) === 0) return;
|
||||||
|
|
||||||
if ($event & self::QUERY) {
|
if ($event & self::QUERY) {
|
||||||
if ($this->useFirebug) {
|
if ($this->useFirebug && !headers_sent()) {
|
||||||
self::$table[] = array(
|
self::$table[] = array(
|
||||||
sprintf('%0.3f', dibi::$elapsedTime * 1000),
|
sprintf('%0.3f', dibi::$elapsedTime * 1000),
|
||||||
trim($sql),
|
trim($sql),
|
||||||
|
@@ -307,7 +307,8 @@ final class DibiTranslator extends DibiObject
|
|||||||
|
|
||||||
case 'd': // date
|
case 'd': // date
|
||||||
case 't': // datetime
|
case 't': // datetime
|
||||||
return $this->driver->escape(is_numeric($value) ? (int) $value : strtotime($value), $modifier);
|
$value = is_numeric($value) ? (int) $value : ($value instanceof DateTime ? $value->format('U') : strtotime($value));
|
||||||
|
return $this->driver->escape($value, $modifier);
|
||||||
|
|
||||||
case 'by':
|
case 'by':
|
||||||
case 'n': // identifier name
|
case 'n': // identifier name
|
||||||
|
Reference in New Issue
Block a user