1<!--$Id: db_set_re_len.so,v 10.40 2004/09/28 15:04:19 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::set_re_len</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::set_re_len</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25Db::set_re_len(u_int32_t re_len); 26<p> 27int 28Db::get_re_len(u_int32_t *re_lenp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: Db::set_re_len</b> 32<p>For the Queue access method, specify that the records are of length 33<b>re_len</b>. For the Queue access method, the record length must be 34enough smaller than the database's page size that at least one record 35plus the database page's metadata information can fit on each database 36page.</p> 37<p>For the Recno access method, specify that the records are fixed-length, 38not byte-delimited, and are of length <b>re_len</b>.</p> 39<p>Any records added to the database that are less than <b>re_len</b> bytes 40long are automatically padded (see <a href="../api_cxx/db_set_re_pad.html">Db::set_re_pad</a> for more 41information).</p> 42<p>Any attempt to insert records into the database that are greater than 43<b>re_len</b> bytes long will cause the call to fail immediately and 44return an error.</p> 45<p>The Db::set_re_len method configures a database, not only operations performed 46using the specified <a href="../api_cxx/db_class.html">Db</a> handle.</p> 47<p>The Db::set_re_len method may not be called after the <a href="../api_cxx/db_open.html">Db::open</a> method is called. 48If the database already exists when 49<a href="../api_cxx/db_open.html">Db::open</a> is called, the information specified to Db::set_re_len will 50be ignored. 51</p> 52<p>The Db::set_re_len method 53either returns a non-zero error value 54or throws an exception that encapsulates a non-zero error value on 55failure, and returns 0 on success. 56</p> 57<b>Parameters</b> <br> 58 <b>re_len</b><ul compact><li>The <b>re_len</b> parameter is the length of a Queue or Recno database 59record, in bytes.</ul> 60<br> 61<br><b>Errors</b> 62<p>The Db::set_re_len method 63may fail and throw 64<a href="../api_cxx/except_class.html">DbException</a>, 65encapsulating one of the following non-zero errors, or return one of 66the following non-zero errors:</p> 67<br> 68<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/db_open.html">Db::open</a> was called; or if an 69invalid flag value or parameter was specified.</ul> 70<br> 71<hr size=1 noshade> 72<b>Description: Db::get_re_len</b> 73<p>The Db::get_re_len method returns the record length.</p> 74<p>The Db::get_re_len method may be called at any time during the life of the 75application.</p> 76<p>The Db::get_re_len method 77either returns a non-zero error value 78or throws an exception that encapsulates a non-zero error value on 79failure, and returns 0 on success. 80</p> 81<b>Parameters</b> <br> 82 <b>re_lenp</b><ul compact><li>The Db::get_re_len method returns the 83record length in <b>re_lenp</b>.</ul> 84<br> 85<hr size=1 noshade> 86<br><b>Class</b> 87<a href="../api_cxx/db_class.html">Db</a> 88<br><b>See Also</b> 89<a href="../api_cxx/db_list.html">Databases and Related Methods</a> 90</tt> 91<table width="100%"><tr><td><br></td><td align=right> 92<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 93</td></tr></table> 94<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 95</body> 96</html> 97