Re: DB_DataObject and MySQL timestamp: why manual query?
| From: | Markus Fischer | Date: | Fri, 30 Dec 2005 09:19:08 +0000 |
| Subject: | Re: DB_DataObject and MySQL timestamp: why manual query? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40859@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
I need the automatic update feature in some parts of the system because it was introduced in a later stage ... anyway. And what if there would be a logic that can detect if the date has have been changed between get/update? Or if we provide special methods for this case? Is this behaviour documented in the manual? I couldn't find it and only found it after I went through the source. thanks for your reply, - Markusas the http://pear.php.net/bugs/bug.php?id=630 and the source says (// dont insert data into mysql timestamps // use query() if you really want to do this!!!! ), what is the reason behind this? Timestamps have a documented behaviour in MySQL. If it is not set and it is the first column, it's set to the current time. But if it has a value it is set to this value.The problem occurs when you get and update, since the value is set to the old one, it would try and update the value to the wrong thing, so the best way to deal with it was to ignore it. (as this would be the requirement 99% of the time) - if you are trying to set it manually, you probably should be using datetime...??