From: Jay Freeman (saurik) Date: Sun, 17 Jan 2016 06:10:12 +0000 (+0000) Subject: Commit a path to access result rows via generator. X-Git-Url: https://git.saurik.com/cyql.git/commitdiff_plain/46cac053ae57be2525cb561e4162dd3731db19d6 Commit a path to access result rows via generator. --- diff --git a/__init__.py b/__init__.py index 891978a..d40d9b1 100644 --- a/__init__.py +++ b/__init__.py @@ -180,6 +180,14 @@ class connect(object): with self.execute(statement, 1, context) as cursor: return cursor.rowcount + def gen(self, statement): + with self.execute(statement, 1) as cursor: + while True: + fetch = cursor.fetchone() + if fetch == None: + break + yield fetch + @contextmanager def set(self, statement): with self.execute(statement, 2) as cursor: