#24206 [Opn]: PEAR::DB does not work properly with multiple databases
| From: | fretnoiz at yandex dot ru | Date: | Tue, 17 Jun 2003 15:14:19 +0000 |
| Subject: | #24206 [Opn]: PEAR::DB does not work properly with multiple databases | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17541@lists.php.net to get a copy of this message | ||
ID: 24206
User updated by: fretnoiz at yandex dot ru
Reported By: fretnoiz at yandex dot ru
Status: Open
Bug Type: PEAR related
Operating System: Windows 2000
PHP Version: 4.3.2
New Comment:
Yes, I also noticed that mysql databases work fine.
Maybe the problem is in the interbase driver?
Previous Comments:
------------------------------------------------------------------------
[2003-06-17 09:40:40] arnaud@php.net
works fine with two mysql databases. I don't know what's wrong
------------------------------------------------------------------------
[2003-06-17 09:11:58] fretnoiz at yandex dot ru
If I do a PEAR::setErrorHandling(PEAR_ERROR_DIE);
output is following
---
006.905
Warning: ibase_fetch_row(): supplied argument is not a valid InterBase
result resource in c:\Web\htdocs\pear\DB\ibase.php on line 214
---
and testing $result2 for error gives nothing
I've also noticed that if I remove WHERE clause i.e.
$result2 =& $cisDB->query("SELECT NAME FROM kod");
the script works fine and I successfully get the first row from
interbase table:
006.905
Array ( [0] => 006.905 )
But when I change connection order the error returns:
$cisDB =& DB::connect(DB_DSN2);
$siteDB =& DB::connect(DB_DSN1);
$result1 =& $siteDB->query("SELECT NAME FROM kod");
if ($row = $result1->fetchRow(DB_FETCHMODE_ASSOC)) {
$code = $row['NAME'];
echo $code . "<br>\n";
$result2 =& $cisDB->query("SELECT NAME FROM kod WHERE
NAME='$code'");
if (DB::isError($result2)) {
die($result2->getErrorMessage() . ' ' . $result2->getUserinfo());
}
print_r($result2->fetchRow());
echo "<br>\n";
}
After that if I remove check "if (DB::isError($result2)) {"
I get correct result again. =))
It seems that two database objects are not isolated from each other...
------------------------------------------------------------------------
[2003-06-17 06:32:00] arnaud@php.net
BTW, not sure about that but try removing the reference
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$result2 = $cisDB->query("SELECT NAME FROM kod WHERE
NAME='$code'");
print_r($result2->fetchRow());
echo "<br>\n";
}
------------------------------------------------------------------------
[2003-06-17 06:28:58] arnaud@php.net
So, if you do a
PEAR::setErrorHandling(PEAR_ERROR_DIE);
What does it give ?
alternatively you can try the following
$result2 =& $cisDB->query("SELECT NAME FROM kod WHERE
NAME='$code'");
if (DB::isError($result2)) {
die($result2->getErrorMessage() . ' ' . $result2->getUserinfo());
}
------------------------------------------------------------------------
[2003-06-17 05:59:02] fretnoiz at yandex dot ru
Yes, I've tried but error handler was not called and the result
remained the same. Additionally, I've reproduced the same result in
Linux environment.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/24206
--
Edit this bug report at http://bugs.php.net/?id=24206&edit=1