Commit Graph

132 Commits

Author SHA1 Message Date
Tim Peters c169e9f19c Add missing svn:eol-style property to text files. 2006-06-05 20:49:27 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Tim Peters d6024d30c6 Whitespace normalization. 2006-06-05 18:36:12 +00:00
Gregory P. Smith 9d7a69caa9 forgot to add this file in previous commit 2006-06-05 18:20:07 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Gregory P. Smith db8a80735b * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] 2006-06-05 01:56:15 +00:00
Tim Peters 7140de01cf Whitespace normalization. 2006-06-05 01:47:24 +00:00
Gregory P. Smith 76a82e89ab * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] 2006-06-05 01:39:52 +00:00
Gregory P. Smith 3dd20022ac bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
char **log_list.

feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
2006-06-05 00:31:01 +00:00
Tim Peters 0ebf27aad9 BaseThreadedTestCase.setup(): stop special-casing WindowsError.
Rev 45964 fiddled with WindowsError, and broke test_bsddb3 on all
the Windows buildbot slaves as a result.  This should repair it.
2006-05-11 16:37:42 +00:00
Martin v. Löwis e93abb7ca6 Handle ERROR_ALREADY_EXISTS. 2006-05-06 20:04:08 +00:00
Gregory P. Smith 64029986bc Fixes bug #1117761
bsddb.*open() methods cachesize parameter wouldn't work (raised an
internal bsddb.db exception when it was given).  The set_cachesize
call needed to be moved from the DB object to the DBEnv since the env
was introduced to allow for threading.

(will backport to 2.4)
2006-04-12 20:35:02 +00:00
Gregory P. Smith 14c6b4626f Closes bug #1149413
Using None for a filename with the 'n' flag when calling bsddb.btopen
would cause an error while checking if the file None existed.  error
not likely to be seen as anyone using None for a filename would likely
use the 'c' flag in the first place.
2006-04-12 20:16:56 +00:00
Gregory P. Smith 7f5b6f4b33 Fix bsddb.db.DBError derived exceptions so they can be unpickled.
Also adds some backwards compatibility when compiling _bsddb.c on earlier
python versions (needed for pybsddb).
2006-04-08 07:10:51 +00:00
Thomas Wouters 318af47512 Plug the last 657 referenceleaks in test_bsddb3: a circular reference
between a TestCase instance, the database it opened (or a cursor to a
database) and a bound method as a registered database callback, and a lack
of GC-handling in bsddb caused the TestCases to linger. Fix the test, for
now, as backward compatibility makes adding GC to bsddb annoying.
2006-03-12 00:13:09 +00:00
Tim Peters 32cbc96150 Whitespace normalization. 2006-02-20 21:42:18 +00:00
Georg Brandl a223d2cb29 Bug #1210377: close bsddb cursor correctly after NotFoundError. 2006-02-20 20:29:52 +00:00
Georg Brandl 19e2203fff Add a unit test for bug fix #1396678. 2006-02-19 01:21:11 +00:00
Georg Brandl 26caeba35a Bug #1396678: a closed bsddb.DB raises AttributeError on repr().
It now returns "{}". Is that the correct solution?
2006-02-19 00:53:54 +00:00
Gregory P. Smith c26cf5a6f1 fix test import for use in standalone pybsddb project bsddb3 module as well
as python builtin bsddb.
2006-01-29 23:54:38 +00:00
Gregory P. Smith 3d344e8b07 Add wrapper for DBEnv.set_tx_timeout method to allow time based DB_RECOVER
(test cases and dbobj wrapping)
2006-01-27 07:06:15 +00:00
Neal Norwitz 62a21121b4 Fix bug #1413192, fix seg fault in bsddb if a txn was deleted before the env.
Will backport.
2006-01-25 05:21:55 +00:00
Neal Norwitz 40563eddf1 Get BSD DB working most for version 3.2 2005-10-20 04:36:08 +00:00
Gregory P. Smith 6564ca72ad fix import to work with either module name. 2005-06-09 07:11:42 +00:00
Anthony Baxter 95a2a4ea70 Tools/scripts/reindent.py _is_ your friend 2005-06-08 04:35:50 +00:00
Gregory P. Smith 7e87a8a0be fix more Errors (not Failures) when run using BerkeleyDB <= 4.0 2005-06-06 18:12:24 +00:00
Gregory P. Smith c9321ccdfc fix Errors (not Failures) in test cases when running with BerkeleyDB<4.2 2005-06-06 17:59:00 +00:00
Gregory P. Smith 889bca0df1 make the tests that expect uncatchable exceptions from a callback test
for them in a roundabout way (catching and parsing stderr)

keeps test output clean.
2005-06-06 17:30:22 +00:00
Gregory P. Smith 9e28205502 test case for pybsddb SF bug id 1215432 2005-06-06 10:26:25 +00:00
Gregory P. Smith 48796c3241 test DB.associate using transactions. somewhat related to SF pybsddb
bug #1215432
2005-06-06 09:52:10 +00:00
Gregory P. Smith e947706b10 pybsddb 4.3.2:
* the has_key() method was not raising a DBError when a database error
   had occurred. [SF patch id 1212590]
 * added a wrapper for the DBEnv.set_lg_regionmax method [SF patch id 1212590]
 * DBKeyEmptyError now derives from KeyError just like DBNotFoundError.
 * internally everywhere DB_NOTFOUND was checked for has been updated
   to also check for DB_KEYEMPTY.  This fixes the semantics of a couple
   operations on recno and queue databases to be more intuitive and results
   in less unexpected DBKeyEmptyError exceptions being raised.
2005-06-04 06:46:59 +00:00
Tim Peters 5d36a55eaa Whitespace normalization. 2005-06-03 22:40:27 +00:00
Gregory P. Smith e4ed2de260 pybsddb 4.3.1, adds support for DB.set_bt_compare database btree comparison
functions written in python.

contributed by <frederic.gobry@epfl.ch>
2005-06-03 07:03:07 +00:00
Martin v. Löwis e869eb1953 Patch #1112812: Make bsddb/__init__.py more friendly for modulefinder.
Backported to 2.4.
2005-03-03 09:46:07 +00:00
Steve Holden 69b8caa23a Simplify string comparison using startswith() 2005-02-02 18:47:18 +00:00
Tim Peters 95334a5d1e Purged Berkeley code of references to the long-obsolete whrandom. 2004-08-08 00:54:21 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Gregory P. Smith 19699a9351 Adds support for DB.pget and DBCursor.pget methods.
Based on a patch supplied by Ian Ward <ian@arevco.ca> on the pybsddb
mailing list 2004-03-26.
2004-06-28 04:06:49 +00:00
Gregory P. Smith dc5af70631 SF patch / bug #967763
Fix memory leaks revealed by valgrind and ensuing code inspection.

In the existing test suite valgrind revealed two memory leaks (DB_get
and DBC_set_range).  Code inspection revealed that there were many other
potential similar leaks (many on odd code error paths such as passing
something other than a DBTxn object for a txn= parameter or in the face
of an out of memory error).  The most common case that would cause a
leak was when using recno or queue format databases with integer keys,
sometimes only with an exception exit.
2004-06-27 23:32:34 +00:00
Gregory P. Smith a6b3caad41 Fix SF bug # 897820 - we can no longer use the DB_TRUNCATE flag when
opening the DB to implement legacy interface flag='n' support as
BerkeleyDB 4.2.52 no longer allows it in transaction protected
environments.  Do the os.unlink ourselves.
2004-06-27 22:56:42 +00:00
Gregory P. Smith 1281f76606 * supply a more useful error message when append() is called on the
wrong type of database in dbshelve.
* fix a typo in the exception name when checking args
2004-03-16 18:50:26 +00:00
Gregory P. Smith bce64ec086 bugfix for people executing test_all to run the test suite. (call the
correct function)
2004-03-16 07:07:06 +00:00
Gregory P. Smith a7befda8d8 Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method
   where it would not properly search to the next nearest key when
   used on BTree databases.  [SF bug id 788421]
 * Fixed a bug in the compatibility interface set_location() method
   where it could crash when looking up keys in a hash or recno
   format database due to an incorrect free().
2004-02-26 10:07:14 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Gregory P. Smith e33aef7b15 __init__.py: keep it compatible with older python (True and False == 1 and 0)
test_basics.py: updated for the set_get_returns_none() default of 2 change.
2004-01-13 19:59:57 +00:00
Gregory P. Smith a703a21b48 * Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
  destroyed before having iterated until they raised StopIteration.

* Simplify some code.

* Add new test cases to check for the memleak and ensure that mixing
  iteration with modification of the values for existing keys works.
2003-11-03 01:04:41 +00:00
Gregory P. Smith dc113a8a06 * Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
  bsddb _DBWithCursor interface.
2003-11-02 09:10:16 +00:00
Gregory P. Smith be0db8b125 bsddb3 4.2.2, adds DBCursor.get_current_size() method to return the length
of the current value without reading the value itself.
2003-10-01 06:48:51 +00:00
Gregory P. Smith 1eb41e22ab Use a threadsafe private DBEnv for each bsddb compatibility interface
db that is opened.  DB_THREAD and DB_INIT_LOCK allow for multithreaded
access.  DB_PRIVATE prevents the DBEnv from using the filesystem
(making it only usable by this process; and in this implementation
using one DBEnv per bsddb database)
2003-09-27 23:00:19 +00:00
Gregory P. Smith 41631e8f66 Adds basic support for BerkeleyDB 4.2.x. Compiles and passes tests; new
features in BerkeleyDB not exposed.  notably: the DB_MPOOLFILE interface
has not yet been wrapped in an object.

Adds support for building and installing bsddb3 in python2.3 that has
an older version of this module installed as bsddb without conflicts.
The pybsddb.sf.net build/packaged version of the module uses a
dynamicly loadable module called _pybsddb rather than _bsddb.
2003-09-21 00:08:14 +00:00
Gregory P. Smith cec1b3f6a7 Maintain backwards compatibility with python < 2.3 by dynamically
adding the iterator interface for python >= 2.3.
2003-09-20 23:51:34 +00:00
Raymond Hettinger 2e9da6020e The previous change works much faster (one lookup per key) when
iteritems() is defined.
2003-09-13 03:18:34 +00:00
Raymond Hettinger deadbf50e4 SF #662923
Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.
2003-09-12 06:33:37 +00:00
Gregory P. Smith 6676f6edc1 Support DBEnv.set_shm_key() to allow multi-threaded multi-process
database environments to use shared memory on systems supporting it.
2003-08-28 21:50:30 +00:00
Barry Warsaw e3ea281280 readerThread(): Add max_retries to both DeadlockWrap() calls. This
may cause some tests to fail but it prevents them from hanging.
2003-07-21 23:01:34 +00:00
Barry Warsaw e676c5ef3e test01_join(): Fix a test failure when run with "python -O". The
setting of sCursor happened in an assert.
2003-07-21 18:43:33 +00:00
Gregory P. Smith ad30fa03a4 fix to work on python <= 2.1 2003-07-09 05:33:14 +00:00
Gregory P. Smith df35beed40 bugfix: proper import bsddb exists below 2003-07-09 05:29:24 +00:00
Gregory P. Smith 455d46f0d9 bsddb 4.1.6:
* Extended DB & DBEnv set_get_returns_none functionality to take a
   "level" instead of a boolean flag.  The boolean 0 and 1 values still
   have the same effect.  A value of 2 extends the "return None instead
   of raising an exception" behaviour to the DBCursor set methods.
   This will become the default behaviour in pybsddb 4.2.
 * Fixed a typo in DBCursor.join_item method that made it crash instead
   of returning a value.  Obviously nobody uses it.  Wrote a test case
   for join and join_item.
2003-07-09 04:45:59 +00:00
Gregory P. Smith bc6e94a0fa Wrap the cursor functions with dbutils.DeadlockWrap to deal with the
expected DBLockDeadLockErrors.
2003-05-28 08:26:43 +00:00
Tim Peters 0eadaac7dc Whitespace normalization. 2003-04-24 16:02:54 +00:00
Gregory P. Smith fe11d3e0d4 Adds support for the DBEnv->set_timeout() method. 2003-03-27 17:23:29 +00:00
Barry Warsaw 9914227caa Fix compatibility for earlier versions of Python (than 2.3), which
doesn't have UserDict.DictMixin.
2003-02-08 03:18:58 +00:00
Raymond Hettinger 30a634e0a9 SF patch #674396: Apply UserDict.DictMixin to expand dbshelve and dbojb
to have a full dictionary interface.
2003-02-05 04:12:41 +00:00
Gregory P. Smith bc2adef898 fix for use on python 2.1 2003-02-03 04:19:40 +00:00
Barry Warsaw f71de3e9a0 Everything worked in both the distutils distro and in Python 2.3cvs,
so merge from the bsddb-bsddb3-schizo-branch back to the trunk.
2003-01-28 17:20:44 +00:00
Gregory P. Smith b6c9f78074 bugfix: do not double-close DB cursor during deallocation when the
underlying DB has already been closed (and thus all of its cursors).
        This fixes a potential segfault.
        SF pybsddb bug id 667343
bugfix: close the DB object when raising an exception due to an error
        during DB.open.  This prevents an exception when closing the
        environment about not all databases being closed.
        SF pybsddb bug id 667340
2003-01-17 08:42:50 +00:00
Gregory P. Smith c25fd3fb48 bugfix: disallow use of DB_TXN after commit() or abort(), prevents a
coredump or segmentation violation.

Sourceforge patch ID 664896:
http://sourceforge.net/tracker/index.php?func=detail&aid=664896&group_id=13900&atid=313900

The bug was reported on the pybsddb-users mailing list.
2003-01-17 07:52:59 +00:00
Barry Warsaw 9149aeb842 Python 2.1's string module doesn't have ascii_letters, so let's just
hard code it.  We want this module to work with Python 2.1 for now.
2003-01-10 19:28:15 +00:00
Barry Warsaw a21bdeae51 Cleanups, and conversion of assert to assertEqual() 2003-01-10 19:03:29 +00:00
Barry Warsaw b1dcbd223e Make two tests non-locale-dependent 2002-12-31 19:27:45 +00:00
Barry Warsaw bc38baffbd test01_close_dbenv_before_db(): Added an XXX comment that this test is
BerkeleyDB version dependent.
2002-12-31 18:21:43 +00:00
Barry Warsaw 9a0d779c7d Port BerkeleyDB 4.1 support from the pybsddb project. bsddb is now at
version 4.1.1 and works with up to BerkeleyDB 4.1.25.
2002-12-30 20:53:52 +00:00
Barry Warsaw 74859f3aa6 Template for future tests. 2002-12-30 20:44:16 +00:00
Guido van Rossum 7a98e8083c In class bsdTableDB, add class variables db and env (set to None) to
prevent close() called from __del__ from bombing out when __init__()
fails early.
2002-12-02 16:17:46 +00:00
Guido van Rossum 0d366b1418 Fix typo in except clause (_db should be _bsddb). 2002-12-02 16:08:54 +00:00
Martin v. Löwis 65730a4de8 Delete bsddb from sys.modules if _bsddb cannot be imported. 2002-11-24 08:26:01 +00:00
Tim Peters 77c06fbf94 Whitespace normalization. 2002-11-24 02:35:35 +00:00
Martin v. Löwis b2c7affbaa Merge with bsddb3 2002.11.23.10.42.36 2002-11-23 11:26:07 +00:00
Martin v. Löwis 7a3bae410d Replace bsddb3 and _db occurrences. 2002-11-19 17:48:49 +00:00
Martin v. Löwis 1c6b1a2b4e Importing test suite from bsddb3 3.4.0 (with modifications). 2002-11-19 17:47:07 +00:00
Martin v. Löwis 6aa4a1f29c Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185. 2002-11-19 08:09:52 +00:00