Subject Re: [firebird-php] ibase_num_rows instead of count(*)
Author Lester Caine
Milan Babuskov wrote:

> Lester Caine wrote:
>
>>>I do know that kind of trick, but it only return the total record count. I
>>>want to show the user the no. of record their query returns :(.
>>
>>THAT is a different problem. There has been some work on returning the
>>number of rows affected in PHP5 !
>
> It is very simple. Firebird does *not* provide any means to know how
> many record are available in the dataset. I even believe that the engine
> is designed that way, that in many cases it doesn't know either...

Since the engine does not need to visit every record before giving the
first record of a set, I think that is to be expected. Getting the first
record is fast, waiting for a count to be generated would be slow. Which
is why internal management of counts is the best way forward.

> OTOH, Firebird does provide the way to count number of rows *affected*
> by and UPDATE, DELETE and INSERT (with SELECT) statements, and that
> feature has been there since InterBase6 (or even earlier), just now it
> is going to be exposed in PHP5.

The count of the number of rows affected has to be available, because
all records have to be visited to complete the operation.

> Hope this clears things a bit.

My original comments were a bit rushed - sorry for that.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services