RE: [PEAR-DEV] DB_mysql and multiple conections
| From: | Max Holman | Date: | Thu, 06 Sep 2001 01:15:02 +0000 |
| Subject: | RE: [PEAR-DEV] DB_mysql and multiple conections | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1816@lists.php.net to get a copy of this message | ||
I patched my sources, and it works great for me. Thanks
Now to research DB::IsError returning true when executing an SQL statement
such as...
"update table_name set testfield='testval', testfield='testval'"
I havent looked into it yet, but MySQL does complain and it doesnt seem to
be picked up.
Max
-----Original Message-----
From: cox@idecnet.com [mailto:cox@idecnet.com]
Sent: Thursday, 6 September 2001 10:55 AM
To: PEAR DEV; Max Holman
Subject: Re: [PEAR-DEV] DB_mysql and multiple conections
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
Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s