Use the database API to assign limit/offset