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_re_len()</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_re_delim.html" title="Db::set_re_delim()" /> 12 <link rel="next" href="dbset_re_pad.html" title="Db::set_re_pad()" /> 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_re_len()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbset_re_delim.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_re_pad.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_re_len"></a>Db::set_re_len()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41Db::set_re_len(u_int32_t re_len); </pre> 42 <p> 43 For the Queue access method, specify that the records are of length 44 <span class="bold"><strong>re_len</strong></span>. For the Queue access method, 45 the record length must be enough smaller than the database's page size 46 that at least one record plus the database page's metadata information 47 can fit on each database page. 48 </p> 49 <p> 50 For the Recno access method, specify that the records are 51 fixed-length, not byte-delimited, and are of length <span class="bold"><strong>re_len</strong></span>. 52 </p> 53 <p> 54 Any records added to the database that are less than <span class="bold"><strong>re_len</strong></span> bytes long are automatically padded (see 55 <a class="xref" href="dbset_re_pad.html" title="Db::set_re_pad()">Db::set_re_pad()</a> for 56 more information). 57 </p> 58 <p> 59 Any attempt to insert records into the database that are greater than 60 <span class="bold"><strong>re_len</strong></span> bytes long will cause the call 61 to fail immediately and return an error. 62 </p> 63 <p> 64 The <code class="methodname">Db::set_re_len()</code> method configures a database, not only 65 operations performed using the specified 66 <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> handle. 67 </p> 68 <p> 69 The <code class="methodname">Db::set_re_len()</code> method may not be called after the 70 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> method is called. If 71 the database already exists when 72 <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> is called, the 73 information specified to <code class="methodname">Db::set_re_len()</code> will be ignored. 74 </p> 75 <p> 76 The <code class="methodname">Db::set_re_len()</code> <span> 77 78 <span> 79 method either returns a non-zero error value or throws an 80 exception that encapsulates a non-zero error value on 81 failure, and returns 0 on success. 82 </span> 83 </span> 84 </p> 85 <div class="sect2" lang="en" xml:lang="en"> 86 <div class="titlepage"> 87 <div> 88 <div> 89 <h3 class="title"><a id="id1651001"></a>Parameters</h3> 90 </div> 91 </div> 92 </div> 93 <div class="sect3" lang="en" xml:lang="en"> 94 <div class="titlepage"> 95 <div> 96 <div> 97 <h4 class="title"><a id="id1651067"></a>re_len</h4> 98 </div> 99 </div> 100 </div> 101 <p> 102 The <span class="bold"><strong>re_len</strong></span> parameter is the length of 103 a Queue or Recno database record, in bytes. 104 </p> 105 </div> 106 </div> 107 <div class="sect2" lang="en" xml:lang="en"> 108 <div class="titlepage"> 109 <div> 110 <div> 111 <h3 class="title"><a id="id1651224"></a>Errors</h3> 112 </div> 113 </div> 114 </div> 115 <p> 116 The <code class="methodname">Db::set_re_len()</code> <span> 117 118 <span> 119 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 120 exception, encapsulating one of the following non-zero errors, or return one 121 of the following non-zero errors: 122 </span> 123 </span> 124 </p> 125 <div class="sect3" lang="en" xml:lang="en"> 126 <div class="titlepage"> 127 <div> 128 <div> 129 <h4 class="title"><a id="id1651156"></a>EINVAL</h4> 130 </div> 131 </div> 132 </div> 133 <p> 134 If the method was called after <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a> 135 was called; or if an invalid flag value or parameter was specified. 136 </p> 137 </div> 138 </div> 139 <div class="sect2" lang="en" xml:lang="en"> 140 <div class="titlepage"> 141 <div> 142 <div> 143 <h3 class="title"><a id="id1651065"></a>Class</h3> 144 </div> 145 </div> 146 </div> 147 <p> 148 <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> 149 </p> 150 </div> 151 <div class="sect2" lang="en" xml:lang="en"> 152 <div class="titlepage"> 153 <div> 154 <div> 155 <h3 class="title"><a id="id1651005"></a>See Also</h3> 156 </div> 157 </div> 158 </div> 159 <p> 160 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 161 </p> 162 </div> 163 </div> 164 <div class="navfooter"> 165 <hr /> 166 <table width="100%" summary="Navigation footer"> 167 <tr> 168 <td width="40%" align="left"><a accesskey="p" href="dbset_re_delim.html">Prev</a> </td> 169 <td width="20%" align="center"> 170 <a accesskey="u" href="db.html">Up</a> 171 </td> 172 <td width="40%" align="right"> <a accesskey="n" href="dbset_re_pad.html">Next</a></td> 173 </tr> 174 <tr> 175 <td width="40%" align="left" valign="top">Db::set_re_delim() </td> 176 <td width="20%" align="center"> 177 <a accesskey="h" href="index.html">Home</a> 178 </td> 179 <td width="40%" align="right" valign="top"> Db::set_re_pad()</td> 180 </tr> 181 </table> 182 </div> 183 </body> 184</html> 185