Re: Problem with Informix and PHP
| From: | Danny Heijl | Date: | Sat, 20 Nov 1999 11:16:01 +0000 |
| Subject: | Re: Problem with Informix and PHP | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-12817@lists.php.net to get a copy of this message | ||
> Yes. But I don't wait real digits from ifx_affected_rows after select
> statement. After reading php docs (but before writing to list :) i
> have tried to use ifx_num_rows. PHP docs say -- this function returns
> number of lines, without any additional words about select statements.
> And... I got "zero" onesmore :( This situation repeated on
> PHP3.0.8+Apache1.3.4 and PHP3.0.12+Apache1.3.6
Not true : the manual says :
***********************************
int ifx_num_rows(int result_id);
Gives the number of rows fetched so far for a query with result_id after a
ifx_query() or ifx_do() query.
***********************************
It returns the number of rows you have FETCHED so far (with
ifx_fetch_row()).
It is impossible to get the exact number of rows without fetching all rows
first, as I explained in my previous mail. This has nothing to do with PHP,
but everything with how the Informix optimizer works. Informix preferred an
"estimate" to an excact number for obvious performance reasons. Try it out
on a database where every table has millions of rows, with a join query
where 27 tables and views are involved, with an order by and a group by
involved, and you will know what I mean. Because that is wath Informix (and
Oracle, and Sybase) is all about.
Danny
---
>
> And I want to know -- is anybody use ifx_num_rows without this problem?
> Can I see little example of real live code with getin number of rows
> after _any_ informix operation?
>
> P.S. Sorry for my English, it's not my first language :)
> --
> Sergey Afonin <afonin@artel.nsk.su>
> Web-programmer, Artel http://artel.nsk.su
>