Re: do pear packages create their own seperate DB connections?

From: Date: Wed, 23 Apr 2003 14:51:07 +0000
Subject: Re: do pear packages create their own seperate DB connections?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15389@lists.php.net to get a copy of this message
Jeroen Houben wrote:
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
I would wonder how much overhead this will really save.... If you call MDB::connect() with the same params as an existing connection the native PHP database functions will not create a new connection (right...?) but simply return the resource ID for the existing db connection. So at some level PHP is already doing 'singleton' stuff at the db level. What will be saved is the creation of a new MDB class that wraps that db connection. I do think this would be a nice addition, but I'm not sure that the performance gains would be great. (would love to be wrong, though, as I use MDB on several projects -- and could benefit from a singleton() pattern.) Hans

Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
« previous php.pear.dev (#15389) next »