From 46cac053ae57be2525cb561e4162dd3731db19d6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 17 Jan 2016 06:10:12 +0000 Subject: [PATCH] Commit a path to access result rows via generator. --- __init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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: -- 2.47.2