Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #630 YEAR and TIMESTAMP type in mysql database not handled correctly
Submitted: 2004-01-27 10:16 UTC
From: windey at lpthe dot jussieu dot fr Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: 4.3.2 OS: Mac OS 10.2.8 darwin 6.8
Roadmaps: (Not assigned)    

 [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


 [2004-01-29 09:50 UTC] alan_k
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. see release notes for next release = timestamps are ignored for insert/update .. - if you really need to set them manually - use query()