RE: [PEAR-DEV] do pear packages create their own seperate DB connections?
| From: | Lukas Smith | Date: | Wed, 23 Apr 2003 09:51:28 +0000 |
| Subject: | RE: [PEAR-DEV] do pear packages create their own seperate DB connections? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15374@lists.php.net to get a copy of this message | ||
> From: Jeroen Houben [mailto:jeroen@terena.nl]
> Sent: Wednesday, April 23, 2003 11:39 AM
> > I don't really understand how standard PEAR packages should be able
to
> > figure out if you have an instance of a certain package from global
> > space without a total mess? I am probably misunderstanding what you
are
> > proposing here.
> >
> Hi Lukas,
>
> Sorry if I'm "over-discussing" this topic, but isn't this
> (http://www.horde.org/papers/kongress2002-design_patterns/) exactly
what
> you're looking for for MDB?
> the example on the bottom of the page shows you can have more
instances of
> one class depending on the passed parameters. If a package requests an
> instance of MDB it will check if such an instance with the same
paramaters
> (like the DSN) exists and if it does it will return a reference to
that
> one. If not, it will create a new instance.
> HTH
yeah this is exactly what I was talking about. Actually I even attented
the original session for which these slides were made :-)
a question to all:
What would everyone prefer:
1) make singleton the default (requiring no changes to any packages)
2) make singleton optional: MDB::singleton($dsn, $options)
3) make singleton optional through a constant
4) make singleton optional through a variable
1) would mean that every package would have to keep some kind of flag
based on which to decide if to request a singleton
2) is probably the cleanest. But it is somewhat inconvenient.
3) would be a bit inflexible
4) would mean another global variable
regards,
Lukas