#24206 [Opn->Fbk]: PEAR::DB does not work properly with multiple databases

From: Date: Tue, 17 Jun 2003 08:27:37 +0000
Subject: #24206 [Opn->Fbk]: PEAR::DB does not work properly with multiple databases
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17529@lists.php.net to get a copy of this message
ID: 24206 Updated by: arnaud@php.net Reported By: fretnoiz at yandex dot ru -Status: Open +Status: Feedback Bug Type: PEAR related Operating System: Windows 2000 PHP Version: 4.3.2 New Comment: Have you tried the code provided by Tomas ? Additionnally you can die on the error function pe($obj) { die($obj->toString()); } PEAR::setErrorHandler(PEAR_ERROR_CALLBACK, 'pe'); Previous Comments: ------------------------------------------------------------------------ [2003-06-16 15:23:12] fretnoiz at yandex dot ru SORRY!! I've submitted the result which I didn't want to reproduce Actual result is following -------------------------- 006.905 Warning: ibase_fetch_row(): supplied argument is not a valid InterBase result resource in d:\php4\pear\DB\ibase.php on line 214 ------------------------------------------------------------------------ [2003-06-16 12:45:01] cox@php.net $result2 =& $cisDB->query("SELECT NAME FROM kod WHERE NAME='$code'"); print_r($result2->fetchRow()); "Fatal error: Call to undefined function: fetchrow() in c:\Web\htdocs\test_pear.php on line 23" The problem seems that you are not checking for errors. At the top of your code put the following lines: function pe($obj) { echo $obj->toString(); } PEAR::setErrorHandler(PEAR_ERROR_CALLBACK, 'pe'); and try again. ------------------------------------------------------------------------ [2003-06-16 11:43:29] fretnoiz at yandex dot ru Description: ------------ If I create two different objects for database access, one of them does not work. For example, one DB object is connected to MySQL, second is connected to Interbase. Interbase does not return results properly. Reproduce code: --------------- define('DB_DSN1', 'mysql://max:max@localhost/autogarant'); define('DB_DSN2', 'ibase://SYSDBA:masterkey@localhost/C:\IB\autogarant'); $siteDB =& DB::connect(DB_DSN1); $cisDB =& DB::connect(DB_DSN2); $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'"); print_r($result2->fetchRow()); echo "<br>\n"; } Expected result: ---------------- The tables in the DBs contain the same data so i expect to get equivalent records. 006.905 Array ( [0] => 006.905 ) Actual result: -------------- 006.905 Fatal error: Call to undefined function: fetchrow() in c:\Web\htdocs\test_pear.php on line 23 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24206&edit=1

« previous php.pear.dev (#17529) next »