]> git.saurik.com Git - cyql.git/commitdiff
Commit a path to access result rows via generator. master
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 17 Jan 2016 06:10:12 +0000 (06:10 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 17 Jan 2016 06:10:12 +0000 (06:10 +0000)
__init__.py

index 891978a9053046b78a0b46046fdcb411bb64a170..d40d9b1eb57869e0bf9efb42cc241fae9a777f73 100644 (file)
@@ -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: