mirror of
https://github.com/dg/dibi.git
synced 2025-08-10 16:14:57 +02:00
dibi internally uses DateTime object in PHP 5.2
This commit is contained in:
@@ -244,7 +244,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
/**
|
||||
* Encodes data for use in a SQL statement.
|
||||
* @param string value
|
||||
* @param mixed value
|
||||
* @param string type (dibi::TEXT, dibi::BOOL, ...)
|
||||
* @return string encoded value
|
||||
* @throws InvalidArgumentException
|
||||
@@ -263,10 +263,10 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return date("'Y-m-d'", $value);
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d'") : date("'Y-m-d'", $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return date("'Y-m-d H:i:s'", $value);
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d H:i:s'") : date("'Y-m-d H:i:s'", $value);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
|
Reference in New Issue
Block a user