cvs: pear /DB_DataObject TODO

From: Date: Tue, 31 Dec 2002 05:42:35 +0000
Subject: cvs: pear /DB_DataObject TODO
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8019@lists.php.net to get a copy of this message
alan_k Tue Dec 31 00:42:35 2002 EDT Modified files: /pear/DB_DataObject TODO Log: mega update on TODO list - thx to Brian Micheal for these.. now lets see how many get done...

Index: pear/DB_DataObject/TODO diff -u pear/DB_DataObject/TODO:1.8 pear/DB_DataObject/TODO:1.9 --- pear/DB_DataObject/TODO:1.8 Wed Dec 4 00:11:06 2002 +++ pear/DB_DataObject/TODO Tue Dec 31 00:42:35 2002 @@ -1,154 +1,171 @@ -Current TODO list: ----------------------------------- -Issue: Table Rebuilds - -If you modify the database table, then DB_DataObject will be unaware of the change until you -run createTables.php again. - - -Solution: -if the 'production' option is off, then it should rebuild the table information at the same time as loading -the table description. and compare the current definition to the new generated one... - ------------------------------------ -Issue: More detailed cached table information +Development of DB_DataObject_NG (Next Generation DataObject).. -make available an extra ini file database.details.ini, which contains -[table] -column = type:size:notnull: etc. -from the tableInfo() call +To assist in the development of addtional features for the growth of DB_DataObject, +the plan is to develop an extended version DB_DataObject_NG, which extends the current +version and adds alot of the more experiemental features as listed below.. -to allow quick lookup/retrieval of this data for any purpose... - - ------------------------------------ -Issue: Replace - -Mysql has a nice replace feature, It would be nice to have in dataObjects - -Solution: -Add a method, if the database is mysql, use the native 'REPLACE call' -otherwise, do a select on ID then insert|update.. - ----------------------------------- -Issue: Delete -- DONE 0.7 +Features from the NG version can then be carefully moved back into the core DataObject. -delete can be called in many ways: -$object->get(12); -$object->delete(); -in which case deleting on the primary key is desired. - -$object->colour = 'red'; -$object->delete(); -in which case deleting on the _build_condition is desired -(eg. when the primary key is not set) - -$object->whereAdd("colour like 'r%'); -$object->delete(TRUE); -works OK - just uses the where condition, not the values. - - +Current TODO list: ---------------------------------- -Issue: Crosstable Joins - -Althought the main documents indicate that a join version ended up being too complex, this -was based on doing multiple joins on many tables. - It has been suggested (and code provided), -that doing a simpler version may be possible: - -One suggestion by Stejn de Reede was to do this - -$product = new DataObjects_Product(); -$product->get(24); -$img = new DataObjects_Image(); -$img->orderBy('product_image.sort'); -$product->getCrossLink($img); - -which would result in the queries: -SELECT * FROM produce WHERE id = 24; - -SELECT * from image - INNER JOIN product_image - ON product_image.image = image.id - WHERE product_image.product_id = 24 - ORDER BY product_image.sort; - - - -** Reservations: -* introduction of 'magic table' product_image, that is not clear from the code. -* use of assumed defaults like id and column names product_id which are 'magicly generated' - - The initial links code used this, and proved slightly troublesome - the links.ini file solved alot of this. -* query results have little relation to the object that they are exectuted on. (eg. product object is filled with image and product_image join results) - -From a totally abstract view (thinking out loud), It would be clearer to do something like: -$image = new DataObjects_Image; -$productimage = new DataObjects_Productimage -$productimage->productid = 24; + Issue: More detailed cached table information -$image->addJoin( $productimage ); -$image->orderBy('productimage.sort') -$image->findJoin(); + make available an extra ini file database.details.ini, which contains + [table] + column = type:size:notnull: etc. + from the tableInfo() call + + to allow quick lookup/retrieval of this data for any purpose... + + *****Updated based on DB_DataObject_NG + + the plan here is to move to an XML based caching format, along with a class based + description layer, + + Add:method - getTableColumnObject('column name'); + returns an object (which includes utililites specifically useful for that type of object) + // eg. validation?, date conversion...???/ + + + + Issue: Table Rebuilds + + If you modify the database table, then DB_DataObject will be unaware of the change until you + run createTables.php again. + + + Solution: + if the 'production' option is off, then it should rebuild the table information at the same time as loading + the table description. and compare the current definition to the new generated one... + + + + Issue: Replace + + Mysql has a nice replace feature, It would be nice to have in dataObjects + + Solution: + Add a method, if the database is mysql, use the native 'REPLACE call' + otherwise, do a select on ID then insert|update.. + + Issue: Delete -- DONE 0.7 + + delete can be called in many ways: + + $object->get(12); + $object->delete(); + in which case deleting on the primary key is desired. + + $object->colour = 'red'; + $object->delete(); + in which case deleting on the _build_condition is desired + (eg. when the primary key is not set) + ** THIS DOES NOT APPEAR TO WORK *** CHECK THIS!!! + + $object->whereAdd("colour like 'r%'); + $object->delete(TRUE); + works OK - just uses the where condition, not the values. -Which would build: - -SELECT * from image - - INNER JOIN productimage - ON productimage.image = image.id - - WHERE productimage.productid = 24 - ORDER BY productimage.sort; - - - -$productimage = new DataObjects_Productimage; -$product = new DataObjects_Product; -$image = new DataObjects_Image - -$product->id = 24; - -$productimage->addJoin( $image ); -$productimage->addJoin( $product ); - -$productimage->orderBy('productimage.sort') -$productimage->findJoin(); - - - -Which would build: - -SELECT * from productimage - INNER JOIN image - ON productimage.image = image.id - - INNER JOIN product - ON productimage.product = product.id - - WHERE product.id = 24 - ORDER BY productimage.sort; - - -** I've no idea is this query would work or is valuable - so it needs a bit of testing. - - - - -Based on a configuration: (joins.ini) // or could be shared with links.ini ? -[productimage] -;; many to 1 -;; joins table productimage:image to image:id -image = image:id -;; joins table productimage:product to product:id -product = product:id - + + Issue: Crosstable Joins - - - + Althought the main documents indicate that a join version ended up being too complex, this + was based on doing multiple joins on many tables. - It has been suggested (and code provided), + that doing a simpler version may be possible: + + + This is currently implemented - check the source at present for usage examples + ** this need documenting... + + It would also be nice to have a better way to return join or link results... + eg. + getJoin('table'); // returns the dataobject for that table, based on the join results. + in a similar way to the getLinks stuff.. + + + + Issue: Simplify the connection configuration. + + Current suggestion is to replace + database = dsn + with + default_database = dsn + and treat default more like a database name + + Issue: adding more realms to configuration + + Proposal here is to add realms for database dsn's, table mappings etc. along + with hard coding the location of database cache files... + + + + Issue: connection Pooling and resources + + Connections and Results have just been moved out of the getStaticProperty method, to + a $GLOBALS array, and results are only stored when you do find (Eg. not for insert/update/delete) + - this already has a significant speed improvement. (over 10x faster when doing 3000+ inserts) + + It has been suggested that storing the connection/result in the object may be an idea, this + needs more study on what performance impact (both speed and memory) + it has when doing things like + + while ($dbo->fetch()) { + $array[] = $dbo->__clone(); + } + + along with this, it may be worth considering if a Connection Manager class can be spun off.? + + + Issue: Persistant Storage.. + + At present DB_DataObject, caches results to get queries, within the same page, this can be + expected to work 'most of the time', as most of the time concurrent updates are not that frequent. + however, it is expected that the object may be used in a situation where this may affect it. + + As well as this, there may be times where it is preferable to have persistant storage over a number + of page calls.. + + The plan here is to implement a configuation option, that defaults to no caching, and can be set + to either + a) do caching withing a single page request (as per current) + b) do full caching with manual clearing... + c) do no caching..... + + along with this expanding the quantity of data being cached may be considered. + + either this, or a method, that specifically tags something as cachable....... + + + Issue: Constructor/initializer is a bit kludgy, (depends on a small piece of global code).. + + Move to use ZE2's __construct() ?? method, and make generator create object constructors + for the time being that call __construct(). + + + Issue: RaiseError, should really use the dynamic, not static methods.. + + DB_DataObject::raiseError should be replaced with $this->raiseError(), in most non static + method calls. + + Issue: $__DB->dsn["database'] does not work with oracle. + + Need to work around this somehow... ??? + + Issue :Generator does not work with oracle.. + + Looks like it is using the wrong data from the Oracle getTableInfo call... + + Issue: use isset rather than @ + + as it tokenizes down to one opcode, and is 'better practice..' + + + + \ No newline at end of file
« previous php.pear.cvs (#8019) next »