cvs: pear /MDB2/MDB2/Driver/Datatype Common.php
| From: | Lukas Smith | Date: | Thu, 23 Mar 2006 13:29:16 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39294@lists.php.net to get a copy of this message | ||
lsmith Thu Mar 23 13:29:16 2006 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Datatype Common.php
Log:
- use function module if available to generate the value for a CURRENT_* for temporal types in
quote*()
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.56&r2=1.57&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/Common.php
diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.56
pear/MDB2/MDB2/Driver/Datatype/Common.php:1.57
--- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.56 Tue Mar 21 09:38:01 2006
+++ pear/MDB2/MDB2/Driver/Datatype/Common.php Thu Mar 23 13:29:16 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.56 2006/03/21 09:38:01 lsmith Exp $
+// $Id: Common.php,v 1.57 2006/03/23 13:29:16 lsmith Exp $
require_once 'MDB2/LOB.php';
@@ -1152,6 +1152,13 @@
function _quoteDate($value, $quote)
{
if ($value === 'CURRENT_DATE') {
+ $db =& $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+ if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ return $db->function->now('date');
+ }
return 'CURRENT_DATE';
}
return $this->_quoteText($value, $quote);
@@ -1173,6 +1180,13 @@
function _quoteTimestamp($value, $quote)
{
if ($value === 'CURRENT_TIMESTAMP') {
+ $db =& $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+ if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ return $db->function->now('timestamp');
+ }
return 'CURRENT_TIMESTAMP';
}
return $this->_quoteText($value, $quote);
@@ -1194,6 +1208,13 @@
function _quoteTime($value, $quote)
{
if ($value === 'CURRENT_TIME') {
+ $db =& $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+ if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ return $db->function->now('time');
+ }
return 'CURRENT_TIME';
}
return $this->_quoteText($value, $quote);