'Return all tuples associated with hash.
If hash is None, returns all entries in the
database (be careful with that one!).'

def query(self, hash):

    query = (self.SELECT_ALL if (hash is None) else self.SELECT)
    with self.cursor() as cur:
        cur.execute(query)
        for (sid, offset) in cur:
            (yield (sid, offset))
