[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - BerkeleyBase.py:1.29
Barry Warsaw
barry@wooz.org
Tue, 3 Dec 2002 14:13:43 -0500
Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv30253
Modified Files:
BerkeleyBase.py
Log Message:
_setupDB(): Port to BerkeleyDB 4.1, and pybsddb 4.1 (experimental):
# DB 4.1.24 requires that operations happening in a transaction must
# be performed on a database that was opened in a transaction. Since
# we do the former, we must do the latter. However, earlier DB
# versions don't transactionally protect database open, so this is the
# most portable way to write the code.
i.e. we use the DB_AUTO_COMMIT flag for the open, if it's defined.
=== ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py 1.28 => 1.29 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py:1.28 Mon Nov 25 10:37:41 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/BerkeleyBase.py Tue Dec 3 14:13:42 2002
@@ -218,7 +218,17 @@
# Our storage is based on the underlying BSDDB btree database type.
if reclen is not None:
d.set_re_len(reclen)
- d.open(self._prefix + name, dbtype, db.DB_CREATE)
+ openflags = db.DB_CREATE
+ # DB 4.1.24 requires that operations happening in a transaction must
+ # be performed on a database that was opened in a transaction. Since
+ # we do the former, we must do the latter. However, earlier DB
+ # versions don't transactionally protect database open, so this is the
+ # most portable way to write the code.
+ try:
+ openflags |= db.DB_AUTO_COMMIT
+ except AttributeError:
+ pass
+ d.open(self._prefix + name, dbtype, openflags)
self._tables.append(d)
return d