Bug #14478 Updated: mutliple calls to mysql_[p]connect() with same arguments return same resourceID
| From: | mfischer@php.net | Date: | Thu, 13 Dec 2001 05:42:30 +0000 |
| Subject: | Bug #14478 Updated: mutliple calls to mysql_[p]connect() with same arguments return same resourceID | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-73459@lists.php.net to get a copy of this message | ||
ID: 14478
Updated by: mfischer
Reported By: shawn@trnsplnt.com
Old Status: Bogus
Status: Closed
Bug Type: MySQL related
Operating System: FreeBSD
PHP Version: 4.0.6
New Comment:
Not bogus :) This is a feature request and has already been done a short time ago.
Previous Comments:
------------------------------------------------------------------------
[2001-12-13 00:40:59] zak@php.net
Thank you for your report. However, please review the
documentation before submitting a bug report - this is the
intentional and expected behavior.
------------------------------------------------------------------------
[2001-12-13 00:39:53] mfischer@php.net
This is/was an intended behaviour. There's a new expiremental optional parameter to
mysql_connect() in CVS which allows you to force to create new resource rather than reuse existing
ones, e.g.:
$con1 = mysql_connect('foo','bar','baz');
$con2 = mysql_connect('foo','bar','baz', true);
Will result in $con2 being a new resource, not the same again.
Closing.
------------------------------------------------------------------------
[2001-12-12 21:21:00] shawn@trnsplnt.com
I've noticed what appears to be a bug in the
mysql_connect() and mysql_pconnect() (or perhaps the mysql
client libraries): multiple calls to either function with
identical arguments return the same resource id, preventing
me from connecting to multiple databases on the same host,
with the same credentials. Example:
<?php
$conn1 = mysql_connect('host','username','pass');
$conn2 = mysql_connect('host','username','pass');
echo "conn1: $conn1\n";
echo "conn2: $conn2\n";
?>
Produces:
conn1: Resource id #1
conn2: Resource id #1
If I then issue a call to mysql_select_db('foo',$conn1),
'foo' also becomes the active database on $conn2 since the
handles point to the same resource. Doesn't this contradict
the idea of having separate connection handles? Or is it a
short-coming of the client libraries?
Thanks!
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14478&edit=1