again for the DB_storage.php

From: Date: Wed, 20 Jun 2001 13:55:50 +0000
Subject: again for the DB_storage.php
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-167@lists.php.net to get a copy of this message
Hi Stig, as you have probably noticed i am working quite some using your storage class and i have thought of some extensions which make sense to me, so i wanted to ask what you think about it 1. for now the storage class only works on one row of a table so my first thought is to extend it to work as a join, which means the table parameter in the constructor could be an array may be of this kind: array( t1=>table_1,t2=>table_2 ) the index ie. "t1" can than later be used in the keycolumn parameter to identify the table one wnats to access, like array( "t1.id", "t2.name" ) one of the major problems i see there is: what happens if tables use the same column name? how can you return the data, but first how can a query read the data since i dont know a way to retreive data from joined tables without using "as" when columns have the same name this could be solved by getting the table description first and then using "as" on each column. but that makes the programming quite complicated, or at least needs a lot of effort the return of the data could be as follows: $myStorage->t1->id $myStorage->t2->name which seems ok, but not perfect to me since it doesnt provide the data table independently which i see as one of the features of a query 2. another thought i had was extending the storage class to work on multiple rows, a little bit like DB_commom::getAll, but more in the way DB_storage does it, say providing the methods to update a row using set and store, etc. where i see a problem here is, that if this, lets call it multi-storage class extends the storage class then retreiving x rows would fire at least x queries which is quite insufficient and makes it very slow so may be overwritting a number of methods which fire only one query (like getAll) might be concidered, but then the result has to be put into the objects so the user can also call set-store for each row singlely what do you think?

« previous php.pear.general (#167) next »