Re: About DB class.
| From: | Tomas V.V.Cox | Date: | Sun, 10 Feb 2002 13:49:25 +0000 |
| Subject: | Re: About DB class. | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4553@lists.php.net to get a copy of this message | ||
"Stig S. Bakken" wrote:
>
> On Mon, 2002-02-04 at 18:27, Vitaly N. Kravchenko wrote:
> > Hi people!
> >
> > I have idea, about adding some function(methods) to DB class..
> > __sleep() and __wakeup(), for storing DB objects in sessions..
> > Is it possible?
> > Cox?
> >
> > P.S. Have one question: if I have object with property = other object,
> > for example:
> > $myobj = new MyObj();
> > but $myobj->$db = new DB(...);
> >
> > if I have __wakeup() methods in both classes, wich function
> > are executed first? __wakeup() in DB ($myobj->db)
> > or in MyObj ($myobj)?
> >
> > Thanks!
>
> Serializing the connection objects should be trivial, just call
> $this->connect($this->dsn) from __wakeup().
>
I wonder if we could make a "connection on-demand" feature. So people
could create the object in the typical "default.php" but don't spend
system resources until they need them.
Tomas V.V.Cox