'Extract all unique record IDs from rows, preserving the
order by first match
@param rows: the Rows
@param pkey: the primary key
@return: list of unique record IDs'

def getids(self, rows, pkey):

    x = set()
    seen = x.add
    result = []
    append = result.append
    for row in rows:
        row_id = row[pkey]
        if (row_id not in x):
            seen(row_id)
            append(row_id)
    return result
