summaryrefslogtreecommitdiff
path: root/Lib/bsddb/dbtables.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-11-23 11:26:07 +0000
committerMartin v. Löwis <martin@v.loewis.de>2002-11-23 11:26:07 +0000
commitb2c7affbaab984915b9401105334afffeedf706d (patch)
tree0ba16241339e317dd0dc2ecbd65abaa6a9f8f40e /Lib/bsddb/dbtables.py
parenta797d8150dd6fd8336653d8e91db3c088f2c53ff (diff)
downloadcpython-git-b2c7affbaab984915b9401105334afffeedf706d.tar.gz
Merge with bsddb3 2002.11.23.10.42.36
Diffstat (limited to 'Lib/bsddb/dbtables.py')
-rw-r--r--Lib/bsddb/dbtables.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py
index f1e88f2383..2c65198b99 100644
--- a/Lib/bsddb/dbtables.py
+++ b/Lib/bsddb/dbtables.py
@@ -1,6 +1,7 @@
#-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
+# Copyright (C) 2002 Gregory P. Smith
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
@@ -54,6 +55,13 @@ class PrefixCond(Cond):
def __call__(self, s):
return s[:len(self.prefix)] == self.prefix
+class PostfixCond(Cond):
+ """Acts as a condition function for matching a string postfix"""
+ def __init__(self, postfix):
+ self.postfix = postfix
+ def __call__(self, s):
+ return s[-len(self.postfix):] == self.postfix
+
class LikeCond(Cond):
"""
Acts as a function that will match using an SQL 'LIKE' style
@@ -523,17 +531,10 @@ class bsdTableDB :
# if no condition was specified or the condition
# succeeds, add row to our match list.
if not condition or condition(data) :
- # only create new entries in matcing_rowids on
- # the first pass, otherwise reject the
- # rowid as it must not have matched
- # the previous passes
- if column_num == 0 :
- if not matching_rowids.has_key(rowid) :
- matching_rowids[rowid] = {}
- if savethiscolumndata :
- matching_rowids[rowid][column] = data
- else :
- rejected_rowids[rowid] = rowid
+ if not matching_rowids.has_key(rowid) :
+ matching_rowids[rowid] = {}
+ if savethiscolumndata :
+ matching_rowids[rowid][column] = data
else :
if matching_rowids.has_key(rowid) :
del matching_rowids[rowid]