Re: Using the DB methods in another class

From: Date: Sun, 24 Feb 2002 20:57:56 +0000
Subject: Re: Using the DB methods in another class
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4859@lists.php.net to get a copy of this message
[CC'ing this to pear-dev, since it fits better there.] On Sun, 24 Feb 2002 18:03:45 +0100, Wolfram Kriesing wrote: >On Wednesday 13 February 2002 14:02, Ron Dyck wrote: >> What is the best way to use methods from the DB class in another >> class. When I used phplib I did the following: >> >> function start_db() { >> $name = $this->database_class; >> $this->db = new $name; >> >> But I don't feel this is the best way to do it with PEAR's DB >> because the class is not normally instantiated using 'new'. > >in Tree/OptionsDB.php there is an implementation that in my eyes >could be used to provide some kind of PEAR-Common class, which does >the DB-connecting stuff in a PEAR class, as Auth does it >if we made this class somehow PEAR-common (i.e. putting it in >PEAR/Common.php or ???) then we could provide an easy start for >implementing classes, that use a DB-connection, and this can not only >be used for creating classes inside PEAR, but also by applications >using PEAR If we are going to integrate it a central place, we should put the code somewhere in the PEAR DB files, not in Common.php. I currently think, that it would be useful in fact to do this central integration, eventhough I haven't really considered the pros and cons yet. Stig, Tomas? >Martin, i would also be interested in your opinion about it, since >Auth also uses the PEAR-DB Apart from Auth, PEAR Cache and Config also use the same mechanism. - Martin -- Martin Jansen, <mail@martin-jansen.de> http://www.martin-jansen.de/

« previous php.pear.dev (#4859) next »