'Build a subset [start:limit] from rows and ids
@param rows: the Rows
@param ids: all matching record IDs
@param start: start index of the page
@param limit: maximum length of the page
@param has_id: whether the Rows contain the primary key
@return: tuple (rows, page), with:
rows = the Rows in the subset, in order
page = the record IDs in the subset, in order'

def subset(self, rows, ids, start=None, limit=None, has_id=True):

    if (limit and (start is None)):
        start = 0
    if ((start is not None) and (limit is not None)):
        rows = rows[start:(start + limit)]
        page = ids[start:(start + limit)]
    elif (start is not None):
        rows = rows[start:]
        page = ids[start:]
    else:
        page = ids
    return (rows, page)
