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_pagesize()</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_msgfile.html" title="Db::set_msgfile()" /> 12 <link rel="next" href="dbset_partition.html" title="Db::set_partition()" /> 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_pagesize()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbset_msgfile.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_partition.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_pagesize"></a>Db::set_pagesize()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41Db::set_pagesize(u_int32_t pagesize); </pre> 42 <p> 43 Set the size of the pages used to hold items in the database, in 44 bytes. The minimum page size is 512 bytes, the maximum page size is 45 64K bytes, and the page size must be a power-of-two. If the page size 46 is not explicitly set, one is selected based on the underlying 47 filesystem I/O block size. The automatically selected size has a 48 lower limit of 512 bytes and an upper limit of 16K bytes. 49 </p> 50 <p> 51 For information on tuning the Berkeley DB page size, see <a href="../../programmer_reference/general_am_conf.html#am_conf_pagesize" class="olink">Selecting a page size</a>. 52 </p> 53 <p> 54 The <code class="methodname">Db::set_pagesize()</code> method configures a database, not only 55 operations performed using the specified 56 <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> handle. 57 </p> 58 <p> 59 The <code class="methodname">Db::set_pagesize()</code> method may not be called after the 60 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> method is called. If 61 the database already exists when 62 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> is called, the 63 information specified to <code class="methodname">Db::set_pagesize()</code> will be ignored. 64 </p> 65 <p> 66 If creating additional databases in a single physical file, 67 information specified to <code class="methodname">Db::set_pagesize()</code> will be ignored and the 68 page size of the existing databases will be used. 69 </p> 70 <p> 71 The <code class="methodname">Db::set_pagesize()</code> <span> 72 73 <span> 74 method either returns a non-zero error value or throws an 75 exception that encapsulates a non-zero error value on 76 failure, and returns 0 on success. 77 </span> 78 </span> 79 </p> 80 <p> 81 The <code class="methodname">Db::set_pagesize()</code> <span> 82 83 <span> 84 method either returns a non-zero error value or throws an 85 exception that encapsulates a non-zero error value on 86 failure, and returns 0 on success. 87 </span> 88 </span> 89 </p> 90 <div class="sect2" lang="en" xml:lang="en"> 91 <div class="titlepage"> 92 <div> 93 <div> 94 <h3 class="title"><a id="id1649928"></a>Parameters</h3> 95 </div> 96 </div> 97 </div> 98 <div class="sect3" lang="en" xml:lang="en"> 99 <div class="titlepage"> 100 <div> 101 <div> 102 <h4 class="title"><a id="id1649699"></a>pagesize</h4> 103 </div> 104 </div> 105 </div> 106 <p> 107 The <span class="bold"><strong>pagesize</strong></span> parameter sets the 108 database page size. 109 </p> 110 </div> 111 </div> 112 <div class="sect2" lang="en" xml:lang="en"> 113 <div class="titlepage"> 114 <div> 115 <div> 116 <h3 class="title"><a id="id1650035"></a>Errors</h3> 117 </div> 118 </div> 119 </div> 120 <p> 121 The <code class="methodname">Db::set_pagesize()</code> <span> 122 123 <span> 124 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 125 exception, encapsulating one of the following non-zero errors, or return one 126 of the following non-zero errors: 127 </span> 128 </span> 129 </p> 130 <div class="sect3" lang="en" xml:lang="en"> 131 <div class="titlepage"> 132 <div> 133 <div> 134 <h4 class="title"><a id="id1649694"></a>EINVAL</h4> 135 </div> 136 </div> 137 </div> 138 <p> 139 If the method was called after <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> 140 was called; or if an invalid flag value or parameter was specified. 141 </p> 142 </div> 143 </div> 144 <div class="sect2" lang="en" xml:lang="en"> 145 <div class="titlepage"> 146 <div> 147 <div> 148 <h3 class="title"><a id="id1649487"></a>Class</h3> 149 </div> 150 </div> 151 </div> 152 <p> 153 <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> 154 </p> 155 </div> 156 <div class="sect2" lang="en" xml:lang="en"> 157 <div class="titlepage"> 158 <div> 159 <div> 160 <h3 class="title"><a id="id1649983"></a>See Also</h3> 161 </div> 162 </div> 163 </div> 164 <p> 165 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 166 </p> 167 </div> 168 </div> 169 <div class="navfooter"> 170 <hr /> 171 <table width="100%" summary="Navigation footer"> 172 <tr> 173 <td width="40%" align="left"><a accesskey="p" href="dbset_msgfile.html">Prev</a> </td> 174 <td width="20%" align="center"> 175 <a accesskey="u" href="db.html">Up</a> 176 </td> 177 <td width="40%" align="right"> <a accesskey="n" href="dbset_partition.html">Next</a></td> 178 </tr> 179 <tr> 180 <td width="40%" align="left" valign="top">Db::set_msgfile() </td> 181 <td width="20%" align="center"> 182 <a accesskey="h" href="index.html">Home</a> 183 </td> 184 <td width="40%" align="right" valign="top"> Db::set_partition()</td> 185 </tr> 186 </table> 187 </div> 188 </body> 189</html> 190