It's not a silly behaviour. Database connections are a very limited
resource, much more so than open files, and time after time we saw code
that would open up multiple identical connections for no reason
whatsoever. This is especially true of large apps that are able to swallow
other apps. Like PHP-Nuke with various plug-in modules. If you patch 3 or
4 different things together that all talk to a DB on localhost, you do not
need to go through the code and unify the database handling to avoid
having 4 separate connections per request. PHP automatically optimizes
that for you. Opening a new connection is also extremely expensive, much
more so than a simple db switch call on an existing one.

-Rasmus

On Mon, 22 Apr 2002, Daniel Lorch wrote:

> Hi,
>
> > No, it doesn't satisfy me at all.  Your application design is broken and
> > forcing multiple identical connections doesn't solve it at all.  You are
> > trying to associate a selected DB with a database connection artificially.
>
> a couple of years ago I was using PHPLIBs db-class and my own
> db-class at the same time and I was wondering why these classes mixed
> up result sets. After serveral nights of code-review I gave up and
> rewrote most parts from scratch. I finally understand why it didn't
> work (and don't ask me why I was using two different db-classes, I
> can't remember).
>
> What's the rationale behind this silly behaviour? Do you also enforce
> people to reuse file-handles?
>
> -daniel
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to