I was in the process of fixing one bug, related with resultsets and Oracle when, after one interesting (and long) chat with Martín Langhoff
As you know, there are a buch of cool get_recordsetXXX() functions available under Moodle. This functions are pretty similar to their get_recordXXX() counterparts, but they are specialized to work against BIG sets of records.
And they are really memory efficient because we can iterate, scroll and so over them saving tons of memory.
Currently there are 3 ADOdb (our great low-level DB abstraction layer) functions that we are using in Moodle code to perform such iterations.
As they are ADOdb functions we cannot hack them (and we need to do that in order to fix the bug that originated all this thoughts) and they are ADOdb dependent so we'll suffer if someday (never thought about that before now) we switch from ADODB to another alternative).
So we need to have some functions to handle recordsets in order to:
- Be 100% cross-db compatible for supported DBs.
- Be stable and costant along the time.
- Follow one good OOP approach in order to handle recorsets in a natural way
- Fix the original Oracle bug.
So, in the bug ( http://tracker.moodle.org/browse/MDL-8134 ), thanks to Iñaki by detecting and tracing it! I've posted 4 different alternatives to solve the problem.
Each one has its own pros/cons and we should discuss a bit about them to decide how is going to be our RecordSet API (that, over the time, could be more and more used over the "old" get_recordXXX() functions).
So please, feel free to read, understand and discuss about the thing here.
TIA and ciao