summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f141e7d)
raw | patch | inline | side by side (parent: f141e7d)
author | stefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 12 Feb 2009 05:07:00 +0000 (05:07 +0000) | ||
committer | stefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 12 Feb 2009 05:07:00 +0000 (05:07 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4122 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/rdbms_common.py | patch | blob | history |
index 5168367c96d9762da080b75aed9784580b65a4f5..f4c0a82850b4fcb4569831f149ea7123c0b79a13 100644 (file)
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])
# 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: