From c321dda452b10b9ba467c7ae427bd78e2bc7feba Mon Sep 17 00:00:00 2001 From: stefan Date: Thu, 12 Feb 2009 05:07:00 +0000 Subject: [PATCH] Fix issue2550501 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4122 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/backends/rdbms_common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roundup/backends/rdbms_common.py b/roundup/backends/rdbms_common.py index 5168367..f4c0a82 100644 --- a/roundup/backends/rdbms_common.py +++ b/roundup/backends/rdbms_common.py @@ -1073,6 +1073,12 @@ class Database(FileStorage, hyperdb.Database, roundupdb.Database): def hasnode(self, classname, nodeid): """ Determine if the database has a given node. """ + # If this node is in the cache, then we do not need to go to + # the database. (We don't consider this an LRU hit, though.) + if self.cache.has_key((classname, nodeid)): + # Return 1, not True, to match the type of the result of + # the SQL operation below. + return 1 sql = 'select count(*) from _%s where id=%s'%(classname, self.arg) self.sql(sql, (nodeid,)) return int(self.cursor.fetchone()[0]) @@ -1705,6 +1711,12 @@ class Class(hyperdb.Class): # handle additions for id in value: + # If this node is in the cache, then we do not need to go to + # the database. (We don't consider this an LRU hit, though.) + if self.cache.has_key((classname, nodeid)): + # Return 1, not True, to match the type of the result of + # the SQL operation below. + return 1 if not self.db.getclass(link_class).hasnode(id): raise IndexError, '%s has no node %s'%(link_class, id) if id in l: -- 2.30.2