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

From: Date: Mon, 16 Jun 2003 20:23:12 +0000
Subject: #24206 [Bgs->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-17527@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: Bogus +Status: Open Bug Type: PEAR related Operating System: Windows 2000 PHP Version: 4.3.2 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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 (#17527) next »