From 780b92ada9afcf1d58085a83a0b9e6bc982203d1 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 17 Feb 2015 17:25:57 +0000 Subject: Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz. --- docs/programmer_reference/transapp_env_open.html | 84 ++++++++++++------------ 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'docs/programmer_reference/transapp_env_open.html') diff --git a/docs/programmer_reference/transapp_env_open.html b/docs/programmer_reference/transapp_env_open.html index 414a013d..6630d687 100644 --- a/docs/programmer_reference/transapp_env_open.html +++ b/docs/programmer_reference/transapp_env_open.html @@ -14,7 +14,7 @@ +

+ Creating transaction-protected applications using the + Berkeley DB library is quite easy. Applications first use + DB_ENV->open() to initialize the database environment. + Transaction-protected applications normally require all four + Berkeley DB subsystems, so the DB_INIT_MPOOL, + DB_INIT_LOCK, DB_INIT_LOG, and DB_INIT_TXN flags should + be specified. +

+

+ Once the application has called DB_ENV->open(), it opens its + databases within the environment. Once the databases are + opened, the application makes changes to the databases inside + of transactions. Each set of changes that entails a unit of + work should be surrounded by the appropriate DB_ENV->txn_begin(), + DB_TXN->commit() and DB_TXN->abort() calls. The Berkeley DB access + methods will make the appropriate calls into the Lock, Log and + Memory Pool subsystems in order to guarantee transaction + semantics. When the application is ready to exit, all + outstanding transactions should have been committed or + aborted. +

- Creating transaction-protected applications using the Berkeley DB - library is quite easy. Applications first use DB_ENV->open() to initialize - the database environment. Transaction-protected applications normally - require all four Berkeley DB subsystems, so the DB_INIT_MPOOL, - DB_INIT_LOCK, DB_INIT_LOG, and DB_INIT_TXN flags should be - specified. -

+ Databases accessed by a transaction must not be closed + during the transaction. Once all outstanding transactions are + finished, all open Berkeley DB files should be closed. When + the Berkeley DB database files have been closed, the + environment should be closed by calling DB_ENV->close(). +

- Once the application has called DB_ENV->open(), it opens its databases - within the environment. Once the databases are opened, the application - makes changes to the databases inside of transactions. Each set of - changes that entails a unit of work should be surrounded by the - appropriate DB_ENV->txn_begin(), DB_TXN->commit() and DB_TXN->abort() calls. The Berkeley - DB access methods will make the appropriate calls into the Lock, Log - and Memory Pool subsystems in order to guarantee transaction semantics. - When the application is ready to exit, all outstanding transactions - should have been committed or aborted. -

-

- Databases accessed by a transaction must not be closed during the - transaction. Once all outstanding transactions are finished, all open - Berkeley DB files should be closed. When the Berkeley DB database - files have been closed, the environment should be closed by calling - DB_ENV->close(). -

-

- The following code fragment creates the database environment directory - then opens the environment, running recovery. Our DB_ENV database - environment handle is declared to be free-threaded using the - DB_THREAD flag, and so may be used by any number of threads that we - may subsequently create. -

+ The following code fragment creates the database + environment directory then opens the environment, running + recovery. Our DB_ENV database environment handle is declared to + be free-threaded using the DB_THREAD flag, and so may be + used by any number of threads that we may subsequently create. +

#include <sys/types.h>
 #include <sys/stat.h>
@@ -172,9 +173,10 @@ env_open(DB_ENV **dbenvp)
     *dbenvp = dbenv;
 }

- After running this initial program, we can use the db_stat utility to display - the contents of the environment directory: -

+ After running this initial program, we can use the + db_stat utility to display the contents of the environment + directory: +

prompt> db_stat -e -h TXNAPP
 3.2.1   Environment version.
 120897  Magic number.
@@ -205,8 +207,7 @@ Txn Region: 5.
 8KB     Size (8192 bytes).
 -1      Segment ID.
 1       Locks granted without waiting.
-0       Locks granted after waiting.
-
+0 Locks granted after waiting.