| 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_heapsize()</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_nelem.html" title="DB->set_h_nelem()" /> |
| 12 | <link rel="next" href="dbset_heap_regionsize.html" title="DB->set_heap_regionsize()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">DB->set_heapsize()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbset_h_nelem.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 2. |
| 26 | The DB Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbset_heap_regionsize.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="dbset_heapsize"></a>DB->set_heapsize()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB->set_heapsize(DB *db, |
| 45 | u_int32_t gbytes, u_int32_t bytes, u_int32_t flags); </pre> |
| 46 | <p> |
| 47 | Sets the maximum on-disk database file size used by a database |
| 48 | configured to use the Heap access method. If this method is never |
| 49 | called, the database's file size can grow without bound. If this |
| 50 | method is called, then the heap file can never grow larger than the |
| 51 | limit defined by this method. In that case, attempts to update or |
| 52 | create records in a Heap database that has reached its maximum size |
| 53 | will result in a <code class="literal">DB_HEAP_FULL</code> error return. |
| 54 | </p> |
| 55 | <p> |
| 56 | The size specified to this method must be at least three times the |
| 57 | database page size. That is, a Heap database must contain at least |
| 58 | three database pages. You can set the database page size using the |
| 59 | <a class="xref" href="dbset_pagesize.html" title="DB->set_pagesize()">DB->set_pagesize()</a> |
| 60 | method. |
| 61 | </p> |
| 62 | <p> |
| 63 | The <code class="methodname">DB->set_heapsize()</code> method may not be |
| 64 | called after the <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> |
| 65 | method is called. Further, if this method is called on an existing |
| 66 | Heap database, the size specified here must match the size used to |
| 67 | create the database. Note, however, that specifying an incorrect |
| 68 | size to this method will not result in an error return |
| 69 | (<code class="literal">EINVAL</code>) until the database is opened. |
| 70 | </p> |
| 71 | <p> |
| 72 | The <code class="methodname">DB->set_heapsize()</code> <span> |
| 73 | <span> |
| 74 | method returns a non-zero error value on failure and 0 on success. |
| 75 | </span> |
| 76 | |
| 77 | </span> |
| 78 | </p> |
| 79 | <div class="sect2" lang="en" xml:lang="en"> |
| 80 | <div class="titlepage"> |
| 81 | <div> |
| 82 | <div> |
| 83 | <h3 class="title"><a id="idp50399888"></a>Parameters</h3> |
| 84 | </div> |
| 85 | </div> |
| 86 | </div> |
| 87 | <div class="sect3" lang="en" xml:lang="en"> |
| 88 | <div class="titlepage"> |
| 89 | <div> |
| 90 | <div> |
| 91 | <h4 class="title"><a id="idp50409248"></a>gbytes</h4> |
| 92 | </div> |
| 93 | </div> |
| 94 | </div> |
| 95 | <p> |
| 96 | The size of the heap is set to <span class="bold"><strong>gbytes</strong></span> gigabytes plus <span class="bold"><strong>bytes</strong></span>. |
| 97 | </p> |
| 98 | </div> |
| 99 | <div class="sect3" lang="en" xml:lang="en"> |
| 100 | <div class="titlepage"> |
| 101 | <div> |
| 102 | <div> |
| 103 | <h4 class="title"><a id="idp50398312"></a>bytes</h4> |
| 104 | </div> |
| 105 | </div> |
| 106 | </div> |
| 107 | <p> |
| 108 | The size of the heap is set to <span class="bold"><strong>gbytes</strong></span> gigabytes plus <span class="bold"><strong>bytes</strong></span>. |
| 109 | </p> |
| 110 | </div> |
| 111 | <div class="sect3" lang="en" xml:lang="en"> |
| 112 | <div class="titlepage"> |
| 113 | <div> |
| 114 | <div> |
| 115 | <h4 class="title"><a id="idp50402672"></a>flags</h4> |
| 116 | </div> |
| 117 | </div> |
| 118 | </div> |
| 119 | <p> |
| 120 | The <span class="bold"><strong>flags</strong></span> parameter is currently |
| 121 | unused, and must be set to 0. |
| 122 | </p> |
| 123 | </div> |
| 124 | </div> |
| 125 | <div class="sect2" lang="en" xml:lang="en"> |
| 126 | <div class="titlepage"> |
| 127 | <div> |
| 128 | <div> |
| 129 | <h3 class="title"><a id="idp50412408"></a>Errors</h3> |
| 130 | </div> |
| 131 | </div> |
| 132 | </div> |
| 133 | <p> |
| 134 | The <code class="methodname">DB->set_heapsize()</code> <span> |
| 135 | <span> |
| 136 | method may fail and return one of the following non-zero errors: |
| 137 | </span> |
| 138 | |
| 139 | </span> |
| 140 | </p> |
| 141 | <div class="sect3" lang="en" xml:lang="en"> |
| 142 | <div class="titlepage"> |
| 143 | <div> |
| 144 | <div> |
| 145 | <h4 class="title"><a id="idp50417216"></a>EINVAL</h4> |
| 146 | </div> |
| 147 | </div> |
| 148 | </div> |
| 149 | <p> |
| 150 | If the specified heap size was too small; the method was |
| 151 | called after <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> |
| 152 | was called; or if an invalid flag value or parameter was specified. |
| 153 | </p> |
| 154 | </div> |
| 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="idp50418552"></a>Class</h3> |
| 161 | </div> |
| 162 | </div> |
| 163 | </div> |
| 164 | <p> |
| 165 | <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> |
| 166 | </p> |
| 167 | </div> |
| 168 | <div class="sect2" lang="en" xml:lang="en"> |
| 169 | <div class="titlepage"> |
| 170 | <div> |
| 171 | <div> |
| 172 | <h3 class="title"><a id="idp50413088"></a>See Also</h3> |
| 173 | </div> |
| 174 | </div> |
| 175 | </div> |
| 176 | <p> |
| 177 | <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> |
| 178 | </p> |
| 179 | </div> |
| 180 | </div> |
| 181 | <div class="navfooter"> |
| 182 | <hr /> |
| 183 | <table width="100%" summary="Navigation footer"> |
| 184 | <tr> |
| 185 | <td width="40%" align="left"><a accesskey="p" href="dbset_h_nelem.html">Prev</a> </td> |
| 186 | <td width="20%" align="center"> |
| 187 | <a accesskey="u" href="db.html">Up</a> |
| 188 | </td> |
| 189 | <td width="40%" align="right"> <a accesskey="n" href="dbset_heap_regionsize.html">Next</a></td> |
| 190 | </tr> |
| 191 | <tr> |
| 192 | <td width="40%" align="left" valign="top">DB->set_h_nelem() </td> |
| 193 | <td width="20%" align="center"> |
| 194 | <a accesskey="h" href="index.html">Home</a> |
| 195 | </td> |
| 196 | <td width="40%" align="right" valign="top"> DB->set_heap_regionsize()</td> |
| 197 | </tr> |
| 198 | </table> |
| 199 | </div> |
| 200 | </body> |
| 201 | </html> |