1<!--$Id: db_set_pagesize.so,v 10.40 2005/12/16 01:19:35 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-&gt;set_pagesize</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-&gt;set_pagesize</b>
14</td>
15<td align=right>
16<a href="/api_c/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 &lt;db.h&gt;
23<p>
24int
25DB-&gt;set_pagesize(DB *db, u_int32_t pagesize);
26<p>
27int
28DB-&gt;get_pagesize(DB *db, u_int32_t *pagesizep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB-&gt;set_pagesize</b>
32<p>Set the size of the pages used to hold items in the database, in bytes.
33The minimum page size is 512 bytes, the maximum page size is 64K bytes,
34and the page size must be a power-of-two.  If the page size is not
35explicitly set, one is selected based on the underlying filesystem I/O
36block size.  The automatically selected size has a lower limit of 512
37bytes and an upper limit of 16K bytes.</p>
38<p>For information on tuning the Berkeley DB page size, see
39<a href="/ref/am_conf/pagesize.html">Selecting a page size</a>.</p>
40<p>The DB-&gt;set_pagesize method configures a database, not only operations performed
41using the specified <a href="/api_c/db_class.html">DB</a> handle.</p>
42<p>The DB-&gt;set_pagesize method may not be called after the <a href="/api_c/db_open.html">DB-&gt;open</a> method is called.
43If the database already exists when
44<a href="/api_c/db_open.html">DB-&gt;open</a> is called, the information specified to DB-&gt;set_pagesize will
45be ignored.
46</p>
47If creating additional databases in a single physical file, information
48specified to DB-&gt;set_pagesize will be ignored and the page size
49of the existing databases will be used.
50<p>The DB-&gt;set_pagesize method
51returns a non-zero error value on failure
52and 0 on success.
53</p>
54<b>Parameters</b> <br>
55 <b>pagesize</b><ul compact><li>The <b>pagesize</b> parameter sets the database page size.</ul>
56<br>
57<br><b>Errors</b>
58<p>The DB-&gt;set_pagesize method
59may fail and return one of the following non-zero errors:</p>
60<br>
61<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_c/db_open.html">DB-&gt;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-&gt;get_pagesize</b>
66<p>The DB-&gt;get_pagesize method returns the page size.</p>
67<p>The DB-&gt;get_pagesize method may be called at any time during the life of the
68application.</p>
69<p>The DB-&gt;get_pagesize method
70returns a non-zero error value on failure
71and 0 on success.
72</p>
73<b>Parameters</b> <br>
74 <b>pagesizep</b><ul compact><li>The DB-&gt;get_pagesize method returns  the
75page size in <b>pagesizep</b>.</ul>
76<br>
77<hr size=1 noshade>
78<br><b>Class</b>
79<a href="/api_c/db_class.html">DB</a>
80<br><b>See Also</b>
81<a href="/api_c/db_list.html">Databases and Related Methods</a>
82</tt>
83<table width="100%"><tr><td><br></td><td align=right>
84<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
85</td></tr></table>
86<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
87</body>
88</html>
89