Re: Re: DB_Table: Summary and Pre-Call
| From: | Paul M Jones | Date: | Wed, 07 Apr 2004 14:39:24 +0000 |
| Subject: | Re: Re: DB_Table: Summary and Pre-Call | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27125@lists.php.net to get a copy of this message | ||
On Apr 6, 2004, at 9:38 PM, Alan Knowles wrote:
I'll give you a +1 = as long as you sort out a few bugs (which came up when I tried implementing alot of these features in dataobjects :)The words and wisdom of experience. :-)
- dates - you cant use strtotime - it is borked beyhond belief :) try storing my birthday in 1969 in there .... * Date is a good idea here - have a look DB_DataObject::***Value()You're right, and will do. Hey, HTML_QuickForm guys: your automated date discovery routine uses strtotime() and that'll mess up non-Unix-epoch dates; might you think of switching to Date as well?
- It took me a long time to realize that a NON-NUL Date column being sent '' should use null - i spent ages getting 0000-00-00 or 1999-12-31 crap from it..Will work on that and come up with something sensible.
- defines - have a read of georges's performance talk. - these are evil :) defining define('DB_TABLE_COL_STRING', 'string'); etc. is very redundant.. - and very expensive.Will remove them in favor of using string literals. Do you think it's OK to leave the DB_TABLE_ERR_* error constants in place? Can you share the link to the performance talk?
(ideas - not required though...) ** it would be nice if you could have used the same bitwise integers for the types, as dataobjects - that way the suggestion below would mean that we could share the database creation code....I considered using integers for the data types and decided against it for reasons of human readability. Not trying to be obstinate, I just can never remember if (e.g.) 8, 16, and 32 are DATE, TIME, and UNIXTIME, or the other way around.
- i'd be tempted to move your create routine (and the big $GLOBALS['DB_TABLE']['type'] setting stuff into a DB_Table_Create class)It's sort of in the Manager.php file now, and the Table.php create() method is just a local convenience method and interface. Certainly the $GLOBALS stuff can move into Manager.php easily enough.
- The addFromElements/getForm .. etc. seem very redundant.. - why not pass make DB_Table_QuickForm handle it all independant ... $a = DB_Table_QuickForm::construct($mytable);Hey, that's a good idea. I'd like to leave a convenience getForm() method in Table.php but the other stuff could easily go. I will work on these today and try to get the changes out in the next 6-10 hours. Thanks for the pointers. :-) -- Paul M. Jones Savant: the simple alternative to Smarty. http://phpsavant.com/