Home | History | Annotate | Download | only in bsddb

Lines Matching refs:DB

10 #               forces the use of cPickle, and DB.
36 exec("from . import db")
38 import db
81 def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH,
89 db = dbshelve.open(filename)
91 db[key] = data
93 db.close()
98 flags = db.DB_RDONLY
102 flags = db.DB_CREATE
104 flags = db.DB_CREATE
106 flags = db.DB_TRUNCATE | db.DB_CREATE
108 raise db.DBError, "flags should be one of 'r', 'w', 'c' or 'n' or use the bsddb.db.DB_* flags"
116 class DBShelveError(db.DBError): pass
120 """A shelf to hold pickled objects, built upon a bsddb DB object. It
121 automatically pickles/unpickles data objects going to/from the DB.
124 self.db = db.DB(dbenv)
137 """Many methods we can just pass through to the DB object.
140 return getattr(self.db, name)
147 return len(self.db)
151 data = self.db[key]
157 self.db[key] = data
161 del self.db[key]
166 return self.db.keys(txn)
168 return self.db.keys()
172 for k in self.db.keys() :
175 # Do this when "DB" support iteration
179 # return self.db.__iter__()
183 self.db.open(*args, **kwargs)
188 self.db.close(*args, **kwargs)
201 items = self.db.items(txn)
203 items = self.db.items()
212 values = self.db.values(txn)
214 values = self.db.values()
223 return self.db.append(data, txn)
226 if self.get_type() == db.DB_RECNO:
228 raise DBShelveError, "append() only supported when dbshelve opened with filetype=dbshelve.db.DB_RECNO"
240 return self.db.associate(secondaryDB, _shelf_callback, flags)
249 data = self.db.get(*args, **kw)
258 data = self.db.get(key, data, txn, flags)
263 c = DBShelfCursor(self.db.cursor(txn, flags))
270 return self.db.put(key, data, txn, flags)
278 # Methods allowed to pass-through to self.db
334 def current(self, flags=0): return self.get_1(flags|db.DB_CURRENT)
335 def first(self, flags=0): return self.get_1(flags|db.DB_FIRST)
336 def last(self, flags=0): return self.get_1(flags|db.DB_LAST)
337 def next(self, flags=0): return self.get_1(flags|db.DB_NEXT)
338 def prev(self, flags=0): return self.get_1(flags|db.DB_PREV)
339 def consume(self, flags=0): return self.get_1(flags|db.DB_CONSUME)
340 def next_dup(self, flags=0): return self.get_1(flags|db.DB_NEXT_DUP)
341 def next_nodup(self, flags=0): return self.get_1(flags|db.DB_NEXT_NODUP)
342 def prev_nodup(self, flags=0): return self.get_1(flags|db.DB_PREV_NODUP)