[pybsddb] Checking put() transaction results: what is the proper way in bsddb3?
Denis Papathanasiou
denis.papathanasiou at gmail.com
Tue Oct 20 16:38:55 CEST 2009
In the Oracle documentation, when a put() method is called with a
transaction (DBTxn) object, the integer return value is used to
determine the state of the transaction.
I.e., if put() returns 0, it's ok to commit, whereas other values mean
about or retry:
http://www.oracle.com/technology/documentation/berkeley-db/db/gsg_txn/C/txnexample_c.html
Under bsddb3, it seems that put() does not return a value, even when
passed a DBTxn object.
I noticed in the test_basics.py file, which came with the latest version
(4.8.0), that the decision to abort a transaction happens by immediately
following the put() with a get(), as lines 732-735 show:
d.put('new rec', 'this is a new record', self.txn)
self.assertEqual(d.get('new rec', txn=self.txn),
'this is a new record')
self.txn.abort()
Is this the only way to decide commit/aboirt after a transactional put?
More information about the pybsddb
mailing list