Adding Pagination to WP_TMS_RUN_QUERY

Hello! I'm hoping someone can help me figure out how to add pagination to the wp_tms_run_query stored procedure.

I want to call this from my web app (already know how to do that) but running queries on very large lists take a long time to run (3+ minutes) and my web session closes the connection at around the 2 minute mark. To solve this, I'm hoping to create a new stored procedure that is a clone of wp_tms_run_query but includes some sort of pagination. That way my web app can just keep track of the offset and make multiple calls. My app will mostly consume smaller lists but I want it to be able to handle larger lists as well.

I also realize that wp_tms_run_query just ultimately calls rp_run_query so i'm ok skipping wp_tms_run_query if thats what you'd recommend. 

I'm sort of new to stored procedures so any advice would be greatly appreciated! 

Thanks for the help! 

Parents Reply Children