Re: DB_mysql and multiple conections
| From: | Tomas V.V.Cox | Date: | Thu, 06 Sep 2001 00:55:16 +0000 |
| Subject: | Re: DB_mysql and multiple conections | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1814@lists.php.net to get a copy of this message | ||
Ok, here is the patch. I tested it with:
<?php
error_reporting(E_ALL);
include 'DB.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$db1 = DB::connect('mysql://root:xxxx@localhost/pear');
$db2 = DB::connect('mysql://root:xxxx@localhost/test');
$all1 = $db1->getrow('select * from categories');
print_r($all1);
$all2 = $db2->getrow('select * from phptest');
print_r($all2);
$all1 = $db1->getrow('select * from categories');
print_r($all1);
$all2 = $db2->getrow('select * from phptest');
print_r($all2);
?>
Works for me. If someone has the chance to test it would be great.
I saw that mysql_connect returns the same resource id if equal
user/pass/host is given, so probably we could gain performance if it
would also check that the resource id is different rather than only the
database. Perhaps that's more problematic if we think on more than two
connections. I'll see it.
Tomas V.V.Cox