Re: Bug #13232 Updated: PEAR messes up with simultaneous connections.
| From: | Tomas V.V.Cox | Date: | Tue, 09 Oct 2001 22:47:23 +0000 |
| Subject: | Re: Bug #13232 Updated: PEAR messes up with simultaneous connections. | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-2213@lists.php.net to get a copy of this message | ||
If I'm not wrong I fixed that problem time ago for mysql.
mj@php.net wrote:
>
> ID: 13232
> Updated by: mj
> Reported By: fidian@commnav.com
> Status: Feedback
> Bug Type: PEAR related
> Operating System: Linux 2.2.16
> PHP Version: 4.0.6
> New Comment:
>
> Two additional points:
>
> 1.: What DBMS do you use? (I tested with MySQL and it worked)
>
> 2.: Of course you have to change the line
>
> echo "Result: " . $count[0] . "\n";
>
> into
>
> echo "Result: " . $data[0] . "\n";
>
> to make your example work.
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2001-10-09 15:44:09] mj@php.net
>
> Your example works for me. Please try with the latest CVS version of DB.php
>
> ------------------------------------------------------------------------
>
> [2001-10-09 13:58:11] sander@php.net
>
> Reclassified.
>
> ------------------------------------------------------------------------
>
> [2001-09-10 10:30:19] fidian@commnav.com
>
> 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 this bug report at
> http://bugs.php.net/?id=13232&edit=1
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net