#4941 - Database cursor support

Identifier #4941
Issue type Feature request or suggestion
Title Database cursor support
Status Open
Handling member Deleted
Addon core_database_drivers
Description We do not currently have any support for database cursors. A query will return as many results as we ask for in one go, and then we're done with it.

Consider this query we were considering doing...

SELECT recipient_id,SUM(amount_points)+SUM(gift_points)-(SELECT SUM(amount_points)+SUM(gift_points) FROM cms11_points_ledger refund WHERE refund.status='refund' AND refund.date_and_time>=START AND refund.date_and_time<END AND refund.recipient_id=normal.recipient_id) AS points FROM cms11_points_ledger normal WHERE normal.status='normal' AND normal.date_and_time>=START AND normal.date_and_time<END GROUP BY recipient_id ORDER BY points DESC LIMIT 10;

This is finding the top members by points within a date range. However, if we were to filter some of the results out in PHP, we'd want to not have a LIMIT clause, and we'd not want to paginate the results (very slow when aggregate functions are involved) - we'd want to just keep cursoring through.

I'm somewhat ambivalent on this change. It's taken until now to find a use case, and the solution to our use case is just to turn off the PHP memory limit as we are running in a Cron hook anyway (and if we're concerned about memory, the cursoring query would still use lots too, just in MySQL rather than in PHP).
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated