From 277c4c0aabda033713710e03614b9e732de37f53 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Fri, 22 Nov 2024 23:56:28 -0500 Subject: [PATCH] Implement each() convenience method --- lib/nntp/tiny/db.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/nntp/tiny/db.py b/lib/nntp/tiny/db.py index 2eca781..6b398ff 100644 --- a/lib/nntp/tiny/db.py +++ b/lib/nntp/tiny/db.py @@ -43,6 +43,15 @@ class DatabaseTableCursor(): def fetchall(self): return map(self.__map__, self.cr.fetchall()) + def each(self): + while True: + obj = self.fetchone() + + if obj is None: + break + + yield obj + class Database(): __slots__ = 'db',