mirror of
https://github.com/dg/dibi.git
synced 2025-08-12 17:14:16 +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.');
|
||||
|
@@ -195,7 +195,7 @@ class DibiMsSqlDriver 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
|
||||
@@ -216,10 +216,10 @@ class DibiMsSqlDriver 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.');
|
||||
|
@@ -197,7 +197,7 @@ class DibiMsSql2005Driver 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
|
||||
@@ -218,10 +218,10 @@ class DibiMsSql2005Driver 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.');
|
||||
|
@@ -272,7 +272,7 @@ class DibiMySqlDriver 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
|
||||
@@ -295,10 +295,10 @@ class DibiMySqlDriver 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.');
|
||||
|
@@ -256,7 +256,7 @@ class DibiMySqliDriver 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
|
||||
@@ -278,10 +278,10 @@ class DibiMySqliDriver 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.');
|
||||
|
@@ -203,7 +203,7 @@ class DibiOdbcDriver 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
|
||||
@@ -223,10 +223,10 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return date("#m/d/Y#", $value);
|
||||
return $value instanceof DateTime ? $value->format("#m/d/Y#") : date("#m/d/Y#", $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return date("#m/d/Y H:i:s#", $value);
|
||||
return $value instanceof DateTime ? $value->format("#m/d/Y H:i:s#") : date("#m/d/Y H:i:s#", $value);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
|
@@ -231,10 +231,10 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return date($this->fmtDate, $value);
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDate) : date($this->fmtDate, $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return date($this->fmtDateTime, $value);
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDateTime) : date($this->fmtDateTime, $value);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
|
@@ -222,7 +222,7 @@ class DibiPdoDriver 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
|
||||
@@ -267,10 +267,10 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
return $this->connection->quote($value, PDO::PARAM_BOOL);
|
||||
|
||||
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.');
|
||||
|
@@ -231,7 +231,7 @@ class DibiPostgreDriver 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
|
||||
@@ -267,10 +267,10 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
return $value ? 'TRUE' : 'FALSE';
|
||||
|
||||
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.');
|
||||
|
@@ -218,7 +218,7 @@ class DibiSqliteDriver 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
|
||||
@@ -240,10 +240,10 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return date($this->fmtDate, $value);
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDate) : date($this->fmtDate, $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return date($this->fmtDateTime, $value);
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDateTime) : date($this->fmtDateTime, $value);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
|
Reference in New Issue
Block a user