• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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>Db::set_h_ffactor()</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10    <link rel="up" href="db.html" title="Chapter 2.  The Db Handle" />
11    <link rel="prev" href="dbset_h_compare.html" title="Db::set_h_compare()" />
12    <link rel="next" href="dbset_h_hash.html" title="Db::set_h_hash()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Db::set_h_ffactor()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="dbset_h_compare.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 2. 
23                The Db Handle
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="dbset_h_hash.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="dbset_h_ffactor"></a>Db::set_h_ffactor()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39
40int
41Db::set_h_ffactor(u_int32_t h_ffactor); </pre>
42      <p>
43         Set the desired density within the hash table.  If no value is
44         specified, the fill factor will be selected dynamically as pages
45         are filled.
46    </p>
47      <p>
48        The density is an approximation of the number of keys allowed to
49        accumulate in any one bucket, determining when the hash table grows or
50        shrinks. If you know the average sizes of the keys and data in your
51        data set, setting the fill factor can enhance performance. A reasonable
52        rule computing fill factor is to set it to the following:
53    </p>
54      <pre class="programlisting">             (pagesize - 32) / (average_key_size + average_data_size + 8) </pre>
55      <p>
56         The <code class="methodname">Db::set_h_ffactor()</code> method configures a database, not only
57         operations performed using the specified 
58         <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  handle.
59    </p>
60      <p>
61         The <code class="methodname">Db::set_h_ffactor()</code> method may not be called after the 
62         <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a>  method is called. If
63         the database already exists when <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a>  
64         is called, the information specified to <code class="methodname">Db::set_h_ffactor()</code> will be ignored.
65    </p>
66      <p>
67         The <code class="methodname">Db::set_h_ffactor()</code> <span>
68            
69            <span>
70                method either returns a non-zero error value or throws an
71                exception that encapsulates a non-zero error value on
72                failure, and returns 0 on success.
73            </span>
74        </span>
75    </p>
76      <div class="sect2" lang="en" xml:lang="en">
77        <div class="titlepage">
78          <div>
79            <div>
80              <h3 class="title"><a id="id1647041"></a>Parameters</h3>
81            </div>
82          </div>
83        </div>
84        <div class="sect3" lang="en" xml:lang="en">
85          <div class="titlepage">
86            <div>
87              <div>
88                <h4 class="title"><a id="id1648325"></a>h_ffactor</h4>
89              </div>
90            </div>
91          </div>
92          <p>
93                          The <span class="bold"><strong>h_ffactor</strong></span> parameter is the
94                          desired density within the hash table.
95                     </p>
96        </div>
97      </div>
98      <div class="sect2" lang="en" xml:lang="en">
99        <div class="titlepage">
100          <div>
101            <div>
102              <h3 class="title"><a id="id1648542"></a>Errors</h3>
103            </div>
104          </div>
105        </div>
106        <p>
107                         The <code class="methodname">Db::set_h_ffactor()</code> <span>
108            
109            <span>
110                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
111                exception, encapsulating one of the following non-zero errors, or return one
112                of the following non-zero errors:
113            </span>
114        </span>
115                    </p>
116        <div class="sect3" lang="en" xml:lang="en">
117          <div class="titlepage">
118            <div>
119              <div>
120                <h4 class="title"><a id="id1648402"></a>EINVAL</h4>
121              </div>
122            </div>
123          </div>
124          <p>
125                If the method was called after <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> 
126                was called; or if an invalid flag value or parameter was specified.
127            </p>
128        </div>
129      </div>
130      <div class="sect2" lang="en" xml:lang="en">
131        <div class="titlepage">
132          <div>
133            <div>
134              <h3 class="title"><a id="id1648566"></a>Class</h3>
135            </div>
136          </div>
137        </div>
138        <p>
139                <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  
140            </p>
141      </div>
142      <div class="sect2" lang="en" xml:lang="en">
143        <div class="titlepage">
144          <div>
145            <div>
146              <h3 class="title"><a id="id1648493"></a>See Also</h3>
147            </div>
148          </div>
149        </div>
150        <p>
151                     <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
152                </p>
153      </div>
154    </div>
155    <div class="navfooter">
156      <hr />
157      <table width="100%" summary="Navigation footer">
158        <tr>
159          <td width="40%" align="left"><a accesskey="p" href="dbset_h_compare.html">Prev</a> </td>
160          <td width="20%" align="center">
161            <a accesskey="u" href="db.html">Up</a>
162          </td>
163          <td width="40%" align="right"> <a accesskey="n" href="dbset_h_hash.html">Next</a></td>
164        </tr>
165        <tr>
166          <td width="40%" align="left" valign="top">Db::set_h_compare() </td>
167          <td width="20%" align="center">
168            <a accesskey="h" href="index.html">Home</a>
169          </td>
170          <td width="40%" align="right" valign="top"> Db::set_h_hash()</td>
171        </tr>
172      </table>
173    </div>
174  </body>
175</html>
176