RE: [PEAR-DEV] numRows in the oracle driver
| From: | Lukas Smith | Date: | Mon, 10 Mar 2003 10:25:06 +0000 |
| Subject: | RE: [PEAR-DEV] numRows in the oracle driver | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14165@lists.php.net to get a copy of this message | ||
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
> Sent: Monday, March 10, 2003 11:08 AM
> <smith@backendmedia.com> wrote :
> > I am having some trouble getting the numRows() method to work like I
> > want it to in the oracle driver.
> >
> > 1) Right now numRows() works the Metabase way of simply fetching all
the
> > rows and then returning that number.
> >
> > 2) PEAR works by checking if the last query was the query for which
> > numRows() was called and then doing "SELECT COUNT(*) FROM
> > (".$this->last_query.")";.
> PEAR DB approach was not so bad, using a flag to tell whether to be
> portable
> or optimized IIRC.
>
> The only problem I see is if you issue a select query and get a
result,
> then
> issue your numrows query, the result content might have been changed
in
> between the two queries.
Could that be fixed by simply storing the query in an array with the
resource handle as an index?
> I don't have a preference, I am just a bit afraid that solution 1)
might
> take a lot of memory.
Well that is another story. Currently MDB reads in all the data into an
array and then returns the data as needed. This is of course horrible
for larger result sets. I am also investigating this. A client of mine
is using the oracle driver and right now he is at down to 60%
performance versus the native API in the worst cases, which is
surprisingly good from my POV. This is all due to the Metabase heritage.
There Manuel probably did things like he did because he was doing per
"cell" fetches and not "bulk" fetches.
Regards,
Lukas