Re: Oracle SQLPlus and PHP OCI8 returning different results
| From: | (Michael Mauch) | Date: | Thu, 01 May 2003 23:29:43 +0000 |
| Subject: | Re: Oracle SQLPlus and PHP OCI8 returning different results | ||
| References: | 1 2 3 | Groups: | php.db php.db |
| Request: | Send a blank email to php-db+get-27483@lists.php.net to get a copy of this message | ||
Gozer <gozer@fusion4.com> wrote:
> As I've discovered, and I should have explained more in my first post, the
> OCIFetchStatement does not work as advertised unless I'm missing something?
> I had hoped to use OCIFetchStatement, however inefficient, to get the number
> of result rows. I have since switched to OCIFetchInto and I at least get
> the results I expect. However, I cannot get the number of results found
> without fetching all of them first. I've seen it stated that using
> OCIRowCount after the first fetch might give you the total results, but it
> does not. It only gives your current row. So, I'm now faced with the
> undesirable option of selecting twice or fetching everything, every time.
I don't understand your last sentence. Either you select twice (once
with a "select count(1) from ($YourSelectStatement)", then just with
$YourSelectStatement), or you use OCIFetchStatement() to fetch all of
the results.
If you use OCIFetchStatement(), you fetch "everything, every time". If
the return value of OCIFetchStatement() is not the number of rows like
advertized, you can still count the array. But regardless of that return
value, you will still have fetched everything - before you could get at
the return value or the array count.
> Am I missing something with the OCIFetchStatement function? Is it a bug?
I don't know, and I can't test it, because my Oracle is borked at the
moment.
Regards...
Michael