Re: [PEPr] Proposal for Database::DB_Table
| From: | Alan Knowles | Date: | Wed, 07 Jan 2004 15:32:55 +0000 |
| Subject: | Re: [PEPr] Proposal for Database::DB_Table | ||
| References: | 1 | Groups: | php.pear.dev php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24849@lists.php.net to get a copy of this message | ||
I've started implementing a few of the features from this into dataobjects now.
- factory can now create full classes on the fly.
(currently with option "proxy=full")
- schema 'ini' files optional
if schema_location is not set -
+ no schema ini file is created.
+ the table schema is read on the fly
(you can still define table() and keys() to store the DB structure in the class)
- date and time formating done by the overloaded set* methods,
date uses Date.php if strtotime fails
time uses strtotime
datetime tries strtotime (defaults as string if it fails.)
usage: $do->setSomeDateColumn('2003-12-1');
DB_Table
-------------------------------------------------------------------
There are a few flaws with the design of DB_Table that I notice when looking through it.
__construct can assign $this = $someclass..
= setting $this is not recommended in PHP or PEAR (the feature may be removed at some point)
= normal practice is to use a factory method if you need to do things like this.
DB_TABLE_SELECT/DISTINCT constants seem to do very little - using the actually strings seemed to be more clear..
TODO:
-------------------------------------------------------------------
-int/float/numeric recognision..
- think about timestamp (which is not very portable),
- null allowed recognision /checking..
-full type validation (this needs to be in an external class really..)
-creating definitions from the class/file/data..: - I would be keen to leave this totally to DB_Schema when it eventually gets written..
-views - having view($options) - seems pretty simple to implement, as a interface to the $object->_query array. - which does roughly the same thing.
- date and type formating added to setFrom();
- make connect public so it can be used to assign a connection for the database using $db.
-------------------------------------------------------------------------
As I said before, I would prefer to merge as much of the work from DB_Table into DB_DataObject, and MDB/DB_Schema...
Regards
Alan
Pepr wrote:
Paul Jones (http://pear.php.net/user/pmjones) proposes the new package Database::DB_Table. You can find more detailed information here: http://pear.php.net/pepr/pepr-proposal-show.php?id=14 Sent by PEPr Automatic proposal system at http://pear.php.net-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com