PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #630

YEAR and TIMESTAMP type in mysql database not handled correctly

Details

Submitted2004-01-27 10:16 UTC
Fromwindey at lpthe dot jussieu dot fr
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.2
OSMac OS 10.2.8 darwin 6.8
Roadmaps(Not assigned)

Comments

[2004-01-27 10:16 UTC] windey at lpthe dot jussieu dot fr

Description:
------------
In forms (built with html_quickform); updating the mysql database
with dataobjects methods :
1) fields of type YEAR in MYSQL are handled
incorrectly and end up the the database with a default of 1970

A fix was proposed by Alan Knowles :
quote : can you try adding this to Generator.php - in the big switch
case section.

case 'YEAR':
$type = DB_DATAOBJECT_INT;
break;
end quote :

THIS DOES WORK

2) TIMESTAMP : the issue sounds more complex here although the
same fix as above but for TIMESTAMP helps to some extent.
A single TIMESTAMP field should be automatically updated to the
current unix timestamp (except in some situations)
the normal mysql behaviour should be for example

UPDATE `table` SET `last_update` = NOW('00000000000000')

while DatabaseObject replaces it by

UPDATE `table` SET `last_update` = '00000000000000'

which is the wrong behaviour.

Thanks
Paul Windey