cvs: pear /MDB2/MDB2/Driver/Datatype Common.php
| From: | Lukas Smith | Date: | Tue, 21 Mar 2006 09:20:36 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39214@lists.php.net to get a copy of this message | ||
lsmith Tue Mar 21 09:20:36 2006 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Datatype Common.php
Log:
- fixed default values for date and timestamp
- if MDB2_PORTABILITY_EMPTY_TO_NULL is set change '' to ' ' in
_getDeclaration()
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.54&r2=1.55&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/Common.php
diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.54
pear/MDB2/MDB2/Driver/Datatype/Common.php:1.55
--- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.54 Wed Mar 1 12:15:32 2006
+++ pear/MDB2/MDB2/Driver/Datatype/Common.php Tue Mar 21 09:20:36 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.54 2006/03/01 12:15:32 lsmith Exp $
+// $Id: Common.php,v 1.55 2006/03/21 09:20:36 lsmith Exp $
require_once 'MDB2/LOB.php';
@@ -67,9 +67,9 @@
'integer' => 0,
'decimal' => 0.0,
'float' => 0.0,
- 'date' => '0000-00-00 00:00:00',
+ 'timestamp' => '1970-01-01 00:00:00',
'time' => '00:00:00',
- 'timestamp' => '0000-00-00',
+ 'date' => '1970-01-01',
'clob' => '',
'blob' => '',
);
@@ -359,7 +359,13 @@
if ($field['default'] === '') {
$field['default'] = (array_key_exists('notnull', $field)
&& $field['notnull'])
? $this->valid_types[$field['type']] : null;
+ if ($field['default'] === ''
+ && $db->options['portability'] &
MDB2_PORTABILITY_EMPTY_TO_NULL
+ ) {
+ $field['default'] = ' ';
+ }
}
+
$default = ' DEFAULT '.$this->quote($field['default'],
$field['type']);
}