Re: 2 newbie Qs: DB_DataObjects
| From: | Dan Rossi | Date: | Wed, 15 Jun 2005 16:00:10 +0000 |
| Subject: | Re: 2 newbie Qs: DB_DataObjects | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19636@lists.php.net to get a copy of this message | ||
On 16/06/2005, at 1:10 AM, C.J. Mackie wrote:
I'm setting up DB_DO on PHP5/MySQL4. I've got most things working, but I've run into a couple of quirks on which I could use some help. 1) is it possible to force DB_DO to use PEAR sequences for inserts to MySQL? The docs say it uses PEAR sequences for every db except MySQL. I'm using PEAR sequences already, and need to continue doing so. I can always get the sequence #s and add them manually, but it seems more elegant to ask DB_DO to use them itself, if possible.It does it automatically if its setup with no autoinc primary key :)
2) Everything else seems to be working fine except for date parsing, which isn't working at all. I try to insert a record that contains a 'CreateDate' field, and MySQL inserts a default (0000-00-00 00:00:00, to be precise).For me the only way to do this is you have to cast the date in the insert method or the setter method. So $this->fromValue('date_added',DB_DataObject_Cast::sql("NOW()")); or function setDate_added() { $this->fromValue('date_added',DB_DataObject_Cast::sql("NOW()")); } something like that.
Can anyone tell me what I'm doing wrong? (n.b., I've looked at the 'DB_DO::Cast' objects as a solution, but I'm not allowed to use code labeled as 'beta'.)LOL spanky your behind , not allowed ? , sounds like a system admin who doesnt actually understand software or thinks PEAR is c library php internals LOL , dont worry I hear you on those issues. What I did to workaround such troubles, is create a local PEAR repository , therefore if you are restricted to a non root user u can still install PEAR on your own. I used to have a development machine which I had restricted access which was completely nuts.