Re: numRows + oci8
| From: | Tomas V.V.Cox | Date: | Tue, 02 Apr 2002 10:03:07 +0000 |
| Subject: | Re: numRows + oci8 | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1075@lists.php.net to get a copy of this message | ||
Ignat Ikryanov wrote:
>
> Hello!
> I have a problem when I try use numRows() function with oci8 driver (PHP
> 4.1.2, Oracle 8.1.7, Apache 1.3.20).
> <?php
> ...........
>
> $dns = sprintf("oci8://$oracle_user:$oracle_password@$oracle_db_name");
> $db=DB::connect($dns,true);
> if(DB::isError($db))die ($db->getMessage());
> $query="SELECT * FROM (SELECT rownum rnum,t1.* from (SELECT id,head FROM t2)
> t1) WHERE rnum<10";
> $result=$db->query($query);
> if(DB::isError($result))die ($result->getMessage());
> $rnum=$result->numRows();
> if(DB::isError($rnum))die ($rnum->getMessage());
> // Error is generated in this line ^^^^^^^^^^^^^^
> echo $rnum;
> ?>
>
> I always receive the error message: "DB Error: DB backend not capable."
>
> What is wrong?
Oracle is not natively capable to get the number of rows from a result
set. We have an emulation for it in PEAR DB in portability mode. Try it
so:
$db = DB::connect($dsn, array('persistent' => true, 'optimize' =>
'portability'));
<rest of code>
Tomas V.V.Cox