# Ruby-bdb transactions

**URL:** <https://www.ruby-forum.com/t/ruby-bdb-transactions/68166>\
**Category:** Ruby\
**Created:** [September 9, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/ruby-bdb-transactions/68166 "2006-09-09T22:51:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 9, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/ruby-bdb-transactions/68166/1 "2006-09-09T22:51:21Z")

</div>

I want to make sure I’m not missing something here. The following  
statement from docs/transactions.rb seems to state that BDB::INIT\_TXN  
and BDB::INIT\_TRANSACTION are the same, and do not enable locking.

# The transaction subsystem is created, initialized, and opened by calls

# to _BDB::Env#open_ with the _BDB::INIT\_TXN_

# flag (or _BDB::INIT\_TRANSACTION_) specified.

# Note that enabling transactions automatically enables

# logging, but does not enable locking, as a single thread of control

# that needed atomicity and recoverability would not require it.

However, in the source it shows this:

bdb.h:  
#define BDB\_INIT\_TRANSACTION (DB\_INIT\_LOCK | DB\_INIT\_MPOOL |  
DB\_INIT\_TXN | DB\_INIT\_LOG)

bdb.c:  
rb\_define\_const(bdb\_mDb, “INIT\_TXN”, INT2FIX(DB\_INIT\_TXN));

Which would seem to me that BDB::INIT\_TRANSACTION would give you the  
standard bdb environment for transactions with locking, while  
BDB::INIT\_TXN is exactly the same as the bdb DB\_INIT\_TXN flag.

The test suite seems to back this up, but I just wanted to make sure  
I’m not missing something.

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 10, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/ruby-bdb-transactions/68166/2 "2006-09-10T12:16:33Z")

</div>

> > > > > “s” == snacktime [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

s\> # The transaction subsystem is created, initialized, and opened by  
calls  
s\> # to _BDB::Env#open_ with the _BDB::INIT\_TXN_  
s\> # flag (or _BDB::INIT\_TRANSACTION_) specified.

Well in my language, which is not english nor french, this just mean  
that  
you can open a transaction with the flag BDB::INIT\_TXN or  
BDB::INIT\_TRANSACTION. This does not means that these 2 flags are the  
same.

s\> Which would seem to me that BDB::INIT\_TRANSACTION would give you the  
s\> standard bdb environment for transactions with locking, while  
s\> BDB::INIT\_TXN is exactly the same as the bdb DB\_INIT\_TXN flag.

yes, this is just that I find easier to write

BDB::INIT\_TRANSACTION

rather than

BDB::INIT\_LOCK | BDB::INIT\_MPOOL | BDB::INIT\_TXN | BDB::INIT\_LOG

–

Guy Decoux
