Bug #17305 Updated: Handle multiple connection in SQL Server
| From: | cox@php.net | Date: | Fri, 24 May 2002 10:57:15 +0000 |
| Subject: | Bug #17305 Updated: Handle multiple connection in SQL Server | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6384@lists.php.net to get a copy of this message | ||
ID: 17305
Updated by: cox@php.net
Reported By: vania@fe.up.pt
-Status: Open
+Status: Closed
Bug Type: PEAR related
Operating System: Win 2000
PHP Version: 4.2.0
New Comment:
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a
documentation
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-05-24 05:10:00] alex@netflex.nl
Hi,
i am running w2k php 4.2 too.
$conn1 = mysql_connect("localhost", "user", "pass");
$conn2 = mysql_connect("localhost", "user", "pass");
mysql_select_db("test1" , $conn1);
mysql_select_db("test2" , $conn2); // it sets the db for $conn1 and
$conn2!!! NOT only for $conn2
$sql = "SELECT * FROM test";
$result1 = mysql_query($sql, $conn1);
$result2 = mysql_query($sql, $conn2);
$result1 is the same as $result2!!!!!!!!!
------------------------------------------------------------------------
[2002-05-18 08:16:53] vania@fe.up.pt
It seems that DB.php cannot handle different connections for SQL
Server. I noticed that you fixed this for MySQL.
In mysql.php you have this:
if ($dsninfo['database']) {
// fix to allow calls to different databases in
the same script
if (empty($GLOBALS['_DB_mysql_changed_database'])) {
$this->_changed_db = false;
if (!@mysql_select_db($dsninfo['database'], $conn)) {
return $this->raiseError(DB_ERROR_NODBSELECTED,
null, null, null, mysql_error($conn));
}
} else {
$GLOBALS['_DB_mysql_changed_database'] = true;
$this->_changed_db = $dsninfo['database'];
}
}
And in mssql.php it's only this:
if ($dsninfo['database']) {
if (!@mssql_select_db($dsninfo['database'], $conn)) {
return $this->raiseError(DB_ERROR_NODBSELECTED, null,
null, null, mssql_get_last_message());
}
}
In my scripts I noticed that it handles only the last connection made
and ignores queries with the other objects created to access database.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17305&edit=1