1<!--$Id: dbinfo.so,v 11.10 2001/04/03 19:39:02 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 Reference Guide: Release 3.0: the DBINFO structure</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><b><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></b></td>
13<td align=right><a href="/upgrade.3.0/db.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.3.0/join.html"><img src="/images/next.gif" alt="Next"></a>
14</td></tr></table>
15<p align=center><b>Release 3.0: the DBINFO structure</b></p>
16<p>The DB_INFO structure has been removed from the Berkeley DB 3.0 release.
17Accesses to any fields within that structure by the application should be
18replaced with method calls on the <a href="/api_c/db_class.html">DB</a> handle.  The following
19example illustrates this using the historic db_cachesize structure field.
20In the Berkeley DB 2.X releases, applications could set the size of an
21underlying database cache using code similar to the following:</p>
22<blockquote><pre>DB_INFO dbinfo;
23<p>
24	memset(dbinfo, 0, sizeof(dbinfo));
25	dbinfo.db_cachesize = 1024 * 1024;</pre></blockquote>
26<p>in the Berkeley DB 3.X releases, this should be done using the
27<a href="/api_c/db_set_cachesize.html">DB-&gt;set_cachesize</a> method, as follows:</p>
28<blockquote><pre>DB *db;
29int ret;
30<p>
31	ret = db-&gt;set_cachesize(db, 0, 1024 * 1024, 0);</pre></blockquote>
32<p>The DB_INFO structure is no longer used in any way by the Berkeley DB 3.0
33release, and should be removed from the application.</p>
34<p>The following table lists the DB_INFO fields previously used by
35applications and the methods that should now be used to set
36them.  Because these calls provide configuration for the
37database open, they must precede the call to <a href="/api_c/db_open.html">DB-&gt;open</a>.
38Calling them after the call to <a href="/api_c/db_open.html">DB-&gt;open</a> will return an
39error.</p>
40<table border=1 align=center>
41<tr><th>DB_INFO field</th><th>Berkeley DB 3.X method</th></tr>
42<tr><td>bt_compare</td><td><a href="/api_c/db_set_bt_compare.html">DB-&gt;set_bt_compare</a></td></tr>
43<tr><td>bt_minkey</td><td><a href="/api_c/db_set_bt_minkey.html">DB-&gt;set_bt_minkey</a></td></tr>
44<tr><td>bt_prefix</td><td><a href="/api_c/db_set_bt_prefix.html">DB-&gt;set_bt_prefix</a></td></tr>
45<tr><td>db_cachesize</td><td><a href="/api_c/db_set_cachesize.html">DB-&gt;set_cachesize</a>
46<p>Note: the <a href="/api_c/db_set_cachesize.html">DB-&gt;set_cachesize</a> function takes additional arguments.
47Setting both the second argument (the number of GB in the pool) and the
48last argument (the number of memory pools to create) to 0 will result in
49behavior that is backward-compatible with previous Berkeley DB releases.</p></td></tr>
50<tr><td>db_lorder</td><td><a href="/api_c/db_set_lorder.html">DB-&gt;set_lorder</a></td></tr>
51<tr><td>db_malloc</td><td>DB-&gt;set_malloc</td></tr>
52<tr><td>db_pagesize</td><td><a href="/api_c/db_set_pagesize.html">DB-&gt;set_pagesize</a></td></tr>
53<tr><td>dup_compare</td><td><a href="/api_c/db_set_dup_compare.html">DB-&gt;set_dup_compare</a></td></tr>
54<tr><td>flags</td><td><a href="/api_c/db_set_flags.html">DB-&gt;set_flags</a>
55<p>Note: the DB_DELIMITER, DB_FIXEDLEN and DB_PAD flags no longer need to be
56set as there are specific methods off the <a href="/api_c/db_class.html">DB</a> handle that set the
57file delimiter, the length of fixed-length records and the fixed-length
58record pad character.  They should simply be discarded from the application.</p></td></tr>
59<tr><td>h_ffactor</td><td><a href="/api_c/db_set_h_ffactor.html">DB-&gt;set_h_ffactor</a></td></tr>
60<tr><td>h_hash</td><td><a href="/api_c/db_set_h_hash.html">DB-&gt;set_h_hash</a></td></tr>
61<tr><td>h_nelem</td><td><a href="/api_c/db_set_h_nelem.html">DB-&gt;set_h_nelem</a></td></tr>
62<tr><td>re_delim</td><td><a href="/api_c/db_set_re_delim.html">DB-&gt;set_re_delim</a></td></tr>
63<tr><td>re_len</td><td><a href="/api_c/db_set_re_len.html">DB-&gt;set_re_len</a></td></tr>
64<tr><td>re_pad</td><td><a href="/api_c/db_set_re_pad.html">DB-&gt;set_re_pad</a></td></tr>
65<tr><td>re_source</td><td><a href="/api_c/db_set_re_source.html">DB-&gt;set_re_source</a></td></tr>
66</table>
67<table width="100%"><tr><td><br></td><td align=right><a href="/upgrade.3.0/db.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/upgrade.3.0/join.html"><img src="/images/next.gif" alt="Next"></a>
68</td></tr></table>
69<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
70</body>
71</html>
72