• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/docs/gsg_db_rep/C/
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.73.2" />
9    <link rel="start" 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="prev" 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>
36      <div class="toc">
37        <p>
38          <b>Table of Contents</b>
39        </p>
40        <dl>
41          <dt>
42            <span class="sect1">
43              <a href="txnapp.html#appoverview">Application Overview</a>
44            </span>
45          </dt>
46          <dt>
47            <span class="sect1">
48              <a href="simpleprogramlisting.html">Program Listing</a>
49            </span>
50          </dt>
51          <dd>
52            <dl>
53              <dt>
54                <span class="sect2">
55                  <a href="simpleprogramlisting.html#main_c">Function: main()</a>
56                </span>
57              </dt>
58              <dt>
59                <span class="sect2">
60                  <a href="simpleprogramlisting.html#create_env_c">Function: create_env()</a>
61                </span>
62              </dt>
63              <dt>
64                <span class="sect2">
65                  <a href="simpleprogramlisting.html#env_init_c">Function: env_init()</a>
66                </span>
67              </dt>
68              <dt>
69                <span class="sect2">
70                  <a href="simpleprogramlisting.html#doloop_c">Function: doloop()</a>
71                </span>
72              </dt>
73              <dt>
74                <span class="sect2">
75                  <a href="simpleprogramlisting.html#printstocks_c">
76                            <span>Function: print_stocks()</span>
77                            
78                            
79                    </a>
80                </span>
81              </dt>
82            </dl>
83          </dd>
84        </dl>
85      </div>
86      <p>
87        In this chapter, we build a simple transaction-protected DB
88        application. Throughout the remainder of this book, we will add
89        replication to this example. We do this to underscore the concepts
90        that we are presenting in this book; the first being that you
91        should start with a working transactional program and then add
92        replication to it.
93    </p>
94      <p>
95        Note that this book assumes you already know how to write a
96        transaction-protected DB application, so we will not be
97        covering those concepts in this book. To learn how to write a
98        transaction-protected application, see the 
99        <em class="citetitle">Berkeley DB Getting Started with Transaction Processing</em> guide.
100    </p>
101      <div class="sect1" lang="en" xml:lang="en">
102        <div class="titlepage">
103          <div>
104            <div>
105              <h2 class="title" style="clear: both"><a id="appoverview"></a>Application Overview</h2>
106            </div>
107          </div>
108        </div>
109        <p>
110                Our application maintains a stock market quotes database.
111                This database contains records whose key is the stock
112                market symbol and whose data is the stock's price.
113            </p>
114        <p>
115                The application operates by presenting you with a command
116                line prompt. You then enter the stock symbol and its value,
117                separated by a space. The application takes this
118                information and writes it to the database. 
119            </p>
120        <p>
121                    To see the contents of the database, simply press
122                    <code class="literal">return</code> at the command prompt.
123            </p>
124        <p>
125                To quit the application, type 'quit' or 'exit' at the
126                command prompt.
127            </p>
128        <p>
129                For example, the following illustrates the application's
130                usage. In it, we use entirely fictitious stock market
131                symbols and price values.
132            </p>
133        <pre class="programlisting">&gt; ./ex_rep_gsg_simple -h env_home_dir
134QUOTESERVER&gt; stock1 88
135QUOTESERVER&gt; stock2 .08
136QUOTESERVER&gt; 
137        Symbol  Price
138        ======  =====
139        stock1  88
140        stock2 .08
141
142QUOTESERVER&gt; stock1 88.9
143QUOTESERVER&gt; 
144        Symbol  Price
145        ======  =====
146        stock1  88.9
147        stock2  .08
148
149QUOTESERVER&gt; quit 
150&gt;</pre>
151      </div>
152    </div>
153    <div class="navfooter">
154      <hr />
155      <table width="100%" summary="Navigation footer">
156        <tr>
157          <td width="40%" align="left"><a accesskey="p" href="permmessages.html">Prev</a>��</td>
158          <td width="20%" align="center">��</td>
159          <td width="40%" align="right">��<a accesskey="n" href="simpleprogramlisting.html">Next</a></td>
160        </tr>
161        <tr>
162          <td width="40%" align="left" valign="top">Permanent Message Handling��</td>
163          <td width="20%" align="center">
164            <a accesskey="h" href="index.html">Home</a>
165          </td>
166          <td width="40%" align="right" valign="top">��Program Listing</td>
167        </tr>
168      </table>
169    </div>
170  </body>
171</html>
172