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#repconfiginfo_cxx"> 56 <span>Class: RepConfigInfo</span> 57 58 </a> 59 </span> 60 </dt> 61 <dt> 62 <span class="sect2"> 63 <a href="simpleprogramlisting.html#repmgr_cxx">Class: excxx_repquote_gsg_simple</a> 64 </span> 65 </dt> 66 <dt> 67 <span class="sect2"> 68 <a href="simpleprogramlisting.html#usage_cxx">Function: usage()</a> 69 </span> 70 </dt> 71 <dt> 72 <span class="sect2"> 73 <a href="simpleprogramlisting.html#main_cxx">Function: main()</a> 74 </span> 75 </dt> 76 <dt> 77 <span class="sect2"> 78 <a href="simpleprogramlisting.html#repmgr_init_cxx">Method: SimpleTxn::init()</a> 79 </span> 80 </dt> 81 <dt> 82 <span class="sect2"> 83 <a href="simpleprogramlisting.html#doloop_cxx">Method: SimpleTxn::doloop()</a> 84 </span> 85 </dt> 86 <dt> 87 <span class="sect2"> 88 <a href="simpleprogramlisting.html#printstocks_c"> 89 90 <span>Method: SimpleTxn::print_stocks()</span> 91 92 </a> 93 </span> 94 </dt> 95 </dl> 96 </dd> 97 </dl> 98 </div> 99 <p> 100 In this chapter, we build a simple transaction-protected DB 101 application. Throughout the remainder of this book, we will add 102 replication to this example. We do this to underscore the concepts 103 that we are presenting in this book; the first being that you 104 should start with a working transactional program and then add 105 replication to it. 106 </p> 107 <p> 108 Note that this book assumes you already know how to write a 109 transaction-protected DB application, so we will not be 110 covering those concepts in this book. To learn how to write a 111 transaction-protected application, see the 112 <em class="citetitle">Berkeley DB Getting Started with Transaction Processing</em> guide. 113 </p> 114 <div class="sect1" lang="en" xml:lang="en"> 115 <div class="titlepage"> 116 <div> 117 <div> 118 <h2 class="title" style="clear: both"><a id="appoverview"></a>Application Overview</h2> 119 </div> 120 </div> 121 </div> 122 <p> 123 Our application maintains a stock market quotes database. 124 This database contains records whose key is the stock 125 market symbol and whose data is the stock's price. 126 </p> 127 <p> 128 The application operates by presenting you with a command 129 line prompt. You then enter the stock symbol and its value, 130 separated by a space. The application takes this 131 information and writes it to the database. 132 </p> 133 <p> 134 To see the contents of the database, simply press 135 <code class="literal">return</code> at the command prompt. 136 </p> 137 <p> 138 To quit the application, type 'quit' or 'exit' at the 139 command prompt. 140 </p> 141 <p> 142 For example, the following illustrates the application's 143 usage. In it, we use entirely fictitious stock market 144 symbols and price values. 145 </p> 146 <pre class="programlisting">> ./excxx_repquote_gsg_simple -h env_home_dir 147QUOTESERVER> stock1 88 148QUOTESERVER> stock2 .08 149QUOTESERVER> 150 Symbol Price 151 ====== ===== 152 stock1 88 153 154QUOTESERVER> stock1 88.9 155QUOTESERVER> 156 Symbol Price 157 ====== ===== 158 stock1 88.9 159 stock2 .08 160 161QUOTESERVER> quit 162></pre> 163 </div> 164 </div> 165 <div class="navfooter"> 166 <hr /> 167 <table width="100%" summary="Navigation footer"> 168 <tr> 169 <td width="40%" align="left"><a accesskey="p" href="permmessages.html">Prev</a>��</td> 170 <td width="20%" align="center">��</td> 171 <td width="40%" align="right">��<a accesskey="n" href="simpleprogramlisting.html">Next</a></td> 172 </tr> 173 <tr> 174 <td width="40%" align="left" valign="top">Permanent Message Handling��</td> 175 <td width="20%" align="center"> 176 <a accesskey="h" href="index.html">Home</a> 177 </td> 178 <td width="40%" align="right" valign="top">��Program Listing</td> 179 </tr> 180 </table> 181 </div> 182 </body> 183</html> 184