[Yum-devel] [PATCH] Fix .count (atm. it's an sqlite obj.), don't even run the SQL it's needed.
James Antill
james at and.org
Mon Jan 10 22:03:31 UTC 2011
---
yum/pkgtag_db.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/yum/pkgtag_db.py b/yum/pkgtag_db.py
index 016dd41..afcc28d 100644
--- a/yum/pkgtag_db.py
+++ b/yum/pkgtag_db.py
@@ -53,8 +53,14 @@ class PackageTagDB(object):
# open it and leave a cursor in place for the db
self._conn = sqlite.connect(sqlite_file)
self.cur = self._conn.cursor()
- self.count = self._sql_exec("select count(*) from packagetags",)
-
+
+ def _getTagsCount(self):
+ ''' Unused, so no need to cache. '''
+ for n in self._sql_exec("select count(*) from packagetags",):
+ return n[0]
+
+ count = property(fget=lambda self: self._getTagsCount(),
+ doc="Number of entries in the pkgtag DB")
@catchSqliteException
def _sql_exec(self, sql, *args):
--
1.7.2.3
More information about the Yum-devel
mailing list