1<!--$Id: db_set_h_nelem.so,v 10.36 2004/09/28 15:04:19 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: Db::set_h_nelem</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>Db::set_h_nelem</b> 14</td> 15<td align=right> 16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a> 17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db_cxx.h> 23<p> 24int 25Db::set_h_nelem(u_int32_t h_nelem); 26<p> 27int 28Db::get_h_nelem(u_int32_t *h_nelemp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: Db::set_h_nelem</b> 32<p>Set an estimate of the final size of the hash table.</p> 33<p>In order for the estimate to be used when creating the database, the 34<a href="/api_cxx/db_set_h_ffactor.html">Db::set_h_ffactor</a> method must also be called. If the estimate 35or fill factor are not set or are set too low, hash tables will still 36expand gracefully as keys are entered, although a slight performance 37degradation may be noticed.</p> 38<p>The Db::set_h_nelem method configures a database, not only operations performed 39using the specified <a href="/api_cxx/db_class.html">Db</a> handle.</p> 40<p>The Db::set_h_nelem method may not be called after the <a href="/api_cxx/db_open.html">Db::open</a> method is called. 41If the database already exists when 42<a href="/api_cxx/db_open.html">Db::open</a> is called, the information specified to Db::set_h_nelem will 43be ignored. 44</p> 45<p>The Db::set_h_nelem method 46either returns a non-zero error value 47or throws an exception that encapsulates a non-zero error value on 48failure, and returns 0 on success. 49</p> 50<b>Parameters</b> <br> 51 <b>h_nelem</b><ul compact><li>The <b>h_nelem</b> parameter is an estimate of the final size of the 52hash table.</ul> 53<br> 54<br><b>Errors</b> 55<p>The Db::set_h_nelem method 56may fail and throw 57<a href="/api_cxx/except_class.html">DbException</a>, 58encapsulating one of the following non-zero errors, or return one of 59the following non-zero errors:</p> 60<br> 61<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_cxx/db_open.html">Db::open</a> was called; or if an 62invalid flag value or parameter was specified.</ul> 63<br> 64<hr size=1 noshade> 65<b>Description: Db::get_h_nelem</b> 66<p>The Db::get_h_nelem method returns the estimate of the final size of the hash table.</p> 67<p>The Db::get_h_nelem method may be called at any time during the life of the 68application.</p> 69<p>The Db::get_h_nelem method 70either returns a non-zero error value 71or throws an exception that encapsulates a non-zero error value on 72failure, and returns 0 on success. 73</p> 74<b>Parameters</b> <br> 75 <b>h_nelemp</b><ul compact><li>The Db::get_h_nelem method returns the 76estimate of the final size of the hash table in <b>h_nelemp</b>.</ul> 77<br> 78<hr size=1 noshade> 79<br><b>Class</b> 80<a href="/api_cxx/db_class.html">Db</a> 81<br><b>See Also</b> 82<a href="/api_cxx/db_list.html">Databases and Related Methods</a> 83</tt> 84<table width="100%"><tr><td><br></td><td align=right> 85<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 86</td></tr></table> 87<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 88</body> 89</html> 90