1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>Chapter��2.��Transactional Application</title>
7    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" />
9    <link rel="home" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
10    <link rel="up" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
11    <link rel="previous" href="permmessages.html" title="Permanent Message Handling" />
12    <link rel="next" href="simpleprogramlisting.html" title="Program Listing" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Chapter��2.��Transactional Application</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="permmessages.html">Prev</a>��</td>
22          <th width="60%" align="center">��</th>
23          <td width="20%" align="right">��<a accesskey="n" href="simpleprogramlisting.html">Next</a></td>
24        </tr>
25      </table>
26      <hr />
27    </div>
28    <div class="chapter" lang="en" xml:lang="en">
29      <div class="titlepage">
30        <div>
31          <div>
32            <h2 class="title"><a id="txnapp"></a>Chapter��2.��Transactional Application</h2>
33          </div>
34        </div>
35        <div></div>
36      </div>
37      <div class="toc">
38        <p>
39          <b>Table of Contents</b>
40        </p>
41        <dl>
42          <dt>
43            <span class="sect1">
44              <a href="txnapp.html#appoverview">Application Overview</a>
45            </span>
46          </dt>
47          <dt>
48            <span class="sect1">
49              <a href="simpleprogramlisting.html">Program Listing</a>
50            </span>
51          </dt>
52          <dd>
53            <dl>
54              <dt>
55                <span class="sect2">
56                  <a href="simpleprogramlisting.html#repconfiginfo_cxx">
57                            Class: RepConfigInfo
58                            
59                    </a>
60                </span>
61              </dt>
62              <dt>
63                <span class="sect2">
64                  <a href="simpleprogramlisting.html#repmgr_cxx">Class: RepMgr</a>
65                </span>
66              </dt>
67              <dt>
68                <span class="sect2">
69                  <a href="simpleprogramlisting.html#usage_cxx">Function: usage()</a>
70                </span>
71              </dt>
72              <dt>
73                <span class="sect2">
74                  <a href="simpleprogramlisting.html#main_cxx">Function: main()</a>
75                </span>
76              </dt>
77              <dt>
78                <span class="sect2">
79                  <a href="simpleprogramlisting.html#repmgr_init_cxx">Method: RepMgr::init()</a>
80                </span>
81              </dt>
82              <dt>
83                <span class="sect2">
84                  <a href="simpleprogramlisting.html#doloop_cxx">Method: RepMgr::doloop()</a>
85                </span>
86              </dt>
87              <dt>
88                <span class="sect2">
89                  <a href="simpleprogramlisting.html#printstocks_c">
90                            
91                            Method: RepMgr::print_stocks()
92                            
93                    </a>
94                </span>
95              </dt>
96            </dl>
97          </dd>
98        </dl>
99      </div>
100      <p>
101        In this chapter, we build a simple transaction-protected DB
102        application. Throughout the remainder of this book, we will add
103        replication to this example. We do this to underscore the concepts
104        that we are presenting in this book; the first being that you
105        should start with a working transactional program and then add
106        replication to it.
107    </p>
108      <p>
109        Note that this book assumes you already know how to write a
110        transaction-protected DB application, so we will not be
111        covering those concepts in this book. To learn how to write a
112        transaction-protected application, see the 
113        <i class="citetitle">Berkeley DB Getting Started with Transaction Processing</i> guide.
114    </p>
115      <div class="sect1" lang="en" xml:lang="en">
116        <div class="titlepage">
117          <div>
118            <div>
119              <h2 class="title" style="clear: both"><a id="appoverview"></a>Application Overview</h2>
120            </div>
121          </div>
122          <div></div>
123        </div>
124        <p>
125                Our application maintains a stock market quotes database.
126                This database contains records whose key is the stock
127                market symbol and whose data is the stock's price.
128            </p>
129        <p>
130                The application operates by presenting you with a command
131                line prompt. You then enter the stock symbol and its value,
132                separated by a space. The application takes this
133                information, writes it to the database. 
134            </p>
135        <p>
136                    To see the contents of the database, simply press
137                    <tt class="literal">return</tt> at the command prompt.
138            </p>
139        <p>
140                To quit the application, type 'quit' or 'exit' at the
141                command prompt.
142            </p>
143        <p>
144                For example, the following illustrates the application's
145                usage. In it, we use entirely fictitious stock market
146                symbols and price values.
147            </p>
148        <pre class="programlisting">&gt; ./SimpleTxn -h env_home_dir
149QUOTESERVER&gt; stock1 88
150QUOTESERVER&gt; stock2 .08
151QUOTESERVER&gt; 
152        Symbol  Price
153        ======  =====
154        stock1  88
155
156QUOTESERVER&gt; stock1 88.9
157QUOTESERVER&gt; 
158        Symbol  Price
159        ======  =====
160        stock1  88.9
161        stock2  .08
162
163QUOTESERVER&gt; quit 
164&gt;</pre>
165      </div>
166    </div>
167    <div class="navfooter">
168      <hr />
169      <table width="100%" summary="Navigation footer">
170        <tr>
171          <td width="40%" align="left"><a accesskey="p" href="permmessages.html">Prev</a>��</td>
172          <td width="20%" align="center">
173            <a accesskey="u" href="index.html">Up</a>
174          </td>
175          <td width="40%" align="right">��<a accesskey="n" href="simpleprogramlisting.html">Next</a></td>
176        </tr>
177        <tr>
178          <td width="40%" align="left" valign="top">Permanent Message Handling��</td>
179          <td width="20%" align="center">
180            <a accesskey="h" href="index.html">Home</a>
181          </td>
182          <td width="40%" align="right" valign="top">��Program Listing</td>
183        </tr>
184      </table>
185    </div>
186  </body>
187</html>
188