RE: [PHP-DEV] Bug #729: mysql_connect reuses connection ids
| From: | Shane Caraveo | Date: | Wed, 09 Sep 1998 16:34:52 +0000 |
| Subject: | RE: [PHP-DEV] Bug #729: mysql_connect reuses connection ids | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-889@lists.php.net to get a copy of this message | ||
It only re-uses when connecting to the same database. Why have multiple
connections to the same database? It just creates more overhead in your
script, your doubling (or more) you connections so you will run out of
connections faster, and if coding carefully, there just is no need for it.
Shane
> -----Original Message-----
> From: Zeev Suraski [mailto:bourbon@netvision.net.il]
> Sent: Wednesday, September 09, 1998 1:58 PM
> To: walton@nordicdms.com; php-dev@lists.php.net
> Subject: Re: [PHP-DEV] Bug #729: mysql_connect reuses connection ids
>
>
> That's true. I guess we'll have to decide whether we want it to reuse
> connections or not, perhaps make it toggleable.
>
> Zeev
>
> At 06:02 09/09/98 -0000, walton@nordicdms.com wrote:
> >From: walton@nordicdms.com
> >Operating system: FreeBSD 2.2.6
> >PHP version: 3.0.3
> >PHP Bug Type: MySQL related
> >Bug description:
> >This can cause unpleasant problems when using a library function that
> cleans up after itself.
> >
> >The script:
> >
> ><?
> > function some_reuseable_function() {
> > // Pretend this function was included from another file
> > $conn2 = mysql_connect('host', 'uid', 'pwd');
> > echo "Function connection is: $conn2<br>\n";
> > mysql_close($conn2);
> > }
> >
> >$conn1 = mysql_connect('host', 'uid', 'pwd');
> >echo "Main connection is: $conn1<br>\n";
> >some_reuseable_function();
> >mysql_close($conn1);
> >?>
> >
> >The output:
> >
> >Main connection is: 1
> >Function connection is: 1
> >
> >Warning: 1 is not a MySQL link index in test.php3 on line 12
> >
> >
> >
> >
> >--
> >PHP Development Mailing List http://www.php.net/
> >To unsubscribe send an empty message to
> php-dev-unsubscribe@lists.php.net
> >For help: php-dev-help@lists.php.net
> >
> >
> >
> --
> Zeev Suraski <zeev@php.net>
> For a PGP public key, finger bourbon@netvision.net.il
>
>
> --
> PHP Development Mailing List http://www.php.net/
> To unsubscribe send an empty message to
> php-dev-unsubscribe@lists.php.net
> For help: php-dev-help@lists.php.net
>
>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net