views:

14

answers:

1

I am researching the possibility of porting an application written in classic ASP with ADO record sets and an Oracle database to PHP5 and OCI8. We have lots of stored procedures and queries with bind variables for performance.

My problem is that we have become lazy from using the ADO classes and the EOF and BOF indicators along with MoveFirst, MoveNext and MovePrevious.

I can not find any similar functionality in the OCI module. Is there any hope?

A: 

This is outside my area of expertise, but I think the equivalent functionality outside of ADO would be to retrieve the dataset into an array, then use standard array navigation techniques, rather than functionality that is specific to the database API.


If you're dealing with datasets that are large enough that you don't want to load the whole thing at one time, you should try to find a way to narrow the result set in the query before you start navigating the results. For instance, if you find yourself loading a result set, then just going to the last row, it's easy enough to make the query just return the last row in the first place. If you find yourself retrieving a result set, then looping through it (or filtering) for a specific row (or set of rows), I think you'll find that letting Oracle do that for you will show significantly better performance.

The reason that you need to use arrays to do this kind of navigation with Oracle is that Oracle cursors are always forward-only (whereas with ADO, you have dynamic, keyset, and static cursors as well). If you really need to be able to navigate an entire large result set, loading the whole thing into an array is about your only choice.

Allan
The array method will work for some of our smaller datasets, but we do have some possibly large ones that I am going to have to figure out another way to deal with the navigation.
mggates
Mostly they are selecting the record set and then going through it and performing actions on each row. Turns out they just needed EOF, BOF and MoveNext emulation.As I understand it, Oracle supports the dynamic cursors, since 9i, however the OCI8 interface has not been updated to support them.Still thanks to your suggestions and some I found on other forums, I have a small 'RecordSet' class that give me the behavior I need for the other programmers.
mggates