I'm faced with the task of adding "DB pagination" while executing the query and not while serving the user with results. The problem is that each DB engine has it's own approach to SQL for subtracting a set of results from the entire set. To be more precise, if one wants results N to N+d using:
mysql ---> select X from Y where Z limit N, d
oracle --> select * ( select X, ROW_NUMBER() OVER ( ORDER BY Y.colName ) from Y where Z ) WHERE R BETWEEN N and N+d
For now we provide support for Oracle & MySQL, but one can never know the clients requests, so I am trying to have a general implementation available, therefore I am looking for a library that provides some functionality like this:
qWithSubset = performLimitationOverQuery( qNoSubset, offset, amount, sortOnSet )
Any suggestion is welcome. Thank you.