From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.16
PHP version:      4.0.6
PHP Bug Type:     *Database Functions
Bug description:  PEAR messes up with simultaneous connections.

PEAR seems to not be able to handle multiple connections to different
databases.  To illustrate, create two tables in different databases (can be
on the same server, but different databases within that server).

include("DB.php");
$oneWrapper = new DB();
$oneDB = $oneWrapper->connect("type://user:pass@server/one");
printRes($oneDB->query("select count(*) from table_one"));
$twoWrapper = new DB();
$twoDB = $twoWrapper->connect("type://user:pass@server/two");
printRes($twoDB->query("select count(*) from table_two"));
printRes($oneDB->query("select count(*) from table_one"));
printRes($oneDB->query("select count(*) from table_two"));
function printRes($res) {
   if (DB::isError($res)) {
      echo "Error:  " . DB::errorMessage($res) . "\n";
   } else {
      $data = $res->fetchRow();
      echo "Result: " . $count[0] . "\n";
   }
}


This code will print out

Result:  0
Result:  0
Error:  no such table
Result:  0

Looking back at the code, you will see that $oneDB is now pointing at the
$twoDB's database instead of its correct one.
-- 
Edit bug report at: http://bugs.php.net/?id=13232&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to