Bug #17305 Updated: Handle multiple connection in SQL Server
| From: | alex at netflex dot nl | Date: | Fri, 24 May 2002 09:10:00 +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-6381@lists.php.net to get a copy of this message | ||
ID: 17305
Updated by: alex@netflex.nl
Reported By: vania@fe.up.pt
Status: Open
Bug Type: PEAR related
Operating System: Win 2000
PHP Version: 4.2.0
New Comment:
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!!!!!!!!!
Previous Comments:
------------------------------------------------------------------------
[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