~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to db/docs/api_c/txn_begin.html

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--$Id: txn_begin.so,v 10.48 2001/07/02 01:03:12 bostic Exp $-->
 
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
 
3
<!--All rights reserved.-->
 
4
<html>
 
5
<head>
 
6
<title>Berkeley DB: txn_begin</title>
 
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
 
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
 
9
</head>
 
10
<body bgcolor=white>
 
11
<a name="2"><!--meow--></a>
 
12
<table width="100%"><tr valign=top>
 
13
<td>
 
14
<h1>txn_begin</h1>
 
15
</td>
 
16
<td align=right>
 
17
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
 
18
</td></tr></table>
 
19
<hr size=1 noshade>
 
20
<tt>
 
21
<h3><pre>
 
22
#include &lt;db.h&gt;
 
23
<p>
 
24
int
 
25
txn_begin(DB_ENV *env,
 
26
        DB_TXN *parent, DB_TXN **tid, u_int32_t flags);
 
27
</pre></h3>
 
28
<h1>Description</h1>
 
29
<p>The txn_begin method creates a new transaction in the environment
 
30
and copies a pointer to a DB_TXN that uniquely identifies it into
 
31
the memory to which <b>tid</b> refers.
 
32
<p>If the <b>parent</b> argument is non-NULL, the new transaction will
 
33
be a nested transaction, with the transaction indicated by
 
34
<b>parent</b> as its parent.  Transactions may be
 
35
nested to any level.
 
36
In the presence of distributed transactions and two-phase commit,
 
37
only the parental transaction, that is a transaction without
 
38
a <b>parent</b> specified, should be passed as an argument to
 
39
<a href="../api_c/txn_prepare.html">txn_prepare</a>.
 
40
<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or
 
41
more of the following values:
 
42
<p><dl compact>
 
43
<p><dt><a name="DB_DIRTY_READ">DB_DIRTY_READ</a><dd>All read operations performed by the transaction will read modified but
 
44
not yet committed data.  Silently ignored if the <a href="../api_c/db_open.html#DB_DIRTY_READ">DB_DIRTY_READ</a>
 
45
flag was not specified when the underlying database was opened.
 
46
<p><dt><a name="DB_TXN_NOSYNC">DB_TXN_NOSYNC</a><dd>Do not synchronously flush the log when this transaction commits or
 
47
prepares. This means the transaction will exhibit the ACI (atomicity,
 
48
consistency, and isolation) properties, but not D (durability); that is,
 
49
database integrity will be maintained but it is possible that this
 
50
transaction may be undone during recovery.
 
51
<p>This behavior may be set for a Berkeley DB environment using the
 
52
<a href="../api_c/env_set_flags.html">DB_ENV-&gt;set_flags</a> interface.  Any value specified in this
 
53
interface overrides that setting.
 
54
<p><dt><a name="DB_TXN_NOWAIT">DB_TXN_NOWAIT</a><dd>If a lock is unavailable for any Berkeley DB operation performed in the context
 
55
of this transaction, return immediately instead of blocking on the lock.
 
56
The error return in the case will be <a href="../ref/program/errorret.html#DB_LOCK_NOTGRANTED">DB_LOCK_NOTGRANTED</a>.
 
57
<p><dt><a name="DB_TXN_SYNC">DB_TXN_SYNC</a><dd>Synchronously flush the log when this transaction commits or prepares.
 
58
This means the transaction will exhibit all of the ACID (atomicity,
 
59
consistency, isolation, and durability) properties.
 
60
<p>This behavior is the default for Berkeley DB environments unless the
 
61
<a href="../api_c/env_open.html#DB_TXN_NOSYNC">DB_TXN_NOSYNC</a> flag was specified to the <a href="../api_c/env_set_flags.html">DB_ENV-&gt;set_flags</a>
 
62
interface.  Any value specified in this interface overrides that
 
63
setting.
 
64
</dl>
 
65
<p><b>Note: A transaction may not span threads; that is, each transaction must
 
66
begin and end in the same thread, and each transaction may be used only
 
67
by a single thread.</b>
 
68
<p><b>Note: Cursors may not span transactions; that is, each cursor must be
 
69
opened and closed within a single transaction.</b>
 
70
<p><b>Note: A parent transaction may not issue any Berkeley DB operations -- except for
 
71
txn_begin, <a href="../api_c/txn_abort.html">txn_abort</a> and <a href="../api_c/txn_commit.html">txn_commit</a> -- while it has
 
72
active child transactions (child transactions that have not yet been
 
73
committed or aborted).</b>
 
74
<p>The txn_begin function returns a non-zero error value on failure and 0 on success.
 
75
<h1>Errors</h1>
 
76
<p>The txn_begin function may fail and return a non-zero error for the following conditions:
 
77
<p><dl compact>
 
78
<p><dt>ENOMEM<dd>The maximum number of concurrent transactions has been reached.
 
79
</dl>
 
80
<p>The txn_begin function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
 
81
If a catastrophic error has occurred, the txn_begin function may fail and return
 
82
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, in which case all subsequent Berkeley DB calls will fail
 
83
in the same way.
 
84
<h1>See Also</h1>
 
85
<a href="../api_c/env_set_tx_max.html">DB_ENV-&gt;set_tx_max</a>,
 
86
<a href="../api_c/env_set_tx_recover.html">DB_ENV-&gt;set_tx_recover</a>,
 
87
<a href="../api_c/env_set_tx_timestamp.html">DB_ENV-&gt;set_tx_timestamp</a>,
 
88
<a href="../api_c/txn_abort.html">txn_abort</a>,
 
89
<a href="../api_c/txn_begin.html">txn_begin</a>,
 
90
<a href="../api_c/txn_checkpoint.html">txn_checkpoint</a>,
 
91
<a href="../api_c/txn_commit.html">txn_commit</a>,
 
92
<a href="../api_c/txn_discard.html">txn_discard</a>,
 
93
<a href="../api_c/txn_id.html">txn_id</a>,
 
94
<a href="../api_c/txn_prepare.html">txn_prepare</a>,
 
95
<a href="../api_c/txn_recover.html">txn_recover</a>,
 
96
and
 
97
<a href="../api_c/txn_stat.html">txn_stat</a>.
 
98
</tt>
 
99
<table width="100%"><tr><td><br></td><td align=right>
 
100
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
 
101
</td></tr></table>
 
102
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
 
103
</body>
 
104
</html>