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::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::set_pagesize</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_pagesize(u_int32_t pagesize); 26<p> 27int 28Db::get_pagesize(u_int32_t *pagesizep); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: Db::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::set_pagesize method configures a database, not only operations performed 41using the specified <a href="/api_cxx/db_class.html">Db</a> handle.</p> 42<p>The Db::set_pagesize method may not be called after the <a href="/api_cxx/db_open.html">Db::open</a> method is called. 43If the database already exists when 44<a href="/api_cxx/db_open.html">Db::open</a> is called, the information specified to Db::set_pagesize will 45be ignored. 46</p> 47If creating additional databases in a single physical file, information 48specified to Db::set_pagesize will be ignored and the page size 49of the existing databases will be used. 50<p>The Db::set_pagesize method 51either returns a non-zero error value 52or throws an exception that encapsulates a non-zero error value on 53failure, and returns 0 on success. 54</p> 55<b>Parameters</b> <br> 56 <b>pagesize</b><ul compact><li>The <b>pagesize</b> parameter sets the database page size.</ul> 57<br> 58<br><b>Errors</b> 59<p>The Db::set_pagesize method 60may fail and throw 61<a href="/api_cxx/except_class.html">DbException</a>, 62encapsulating one of the following non-zero errors, or return one of 63the following non-zero errors:</p> 64<br> 65<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 66invalid flag value or parameter was specified.</ul> 67<br> 68<hr size=1 noshade> 69<b>Description: Db::get_pagesize</b> 70<p>The Db::get_pagesize method returns the page size.</p> 71<p>The Db::get_pagesize method may be called at any time during the life of the 72application.</p> 73<p>The Db::get_pagesize method 74either returns a non-zero error value 75or throws an exception that encapsulates a non-zero error value on 76failure, and returns 0 on success. 77</p> 78<b>Parameters</b> <br> 79 <b>pagesizep</b><ul compact><li>The Db::get_pagesize method returns the 80page size in <b>pagesizep</b>.</ul> 81<br> 82<hr size=1 noshade> 83<br><b>Class</b> 84<a href="/api_cxx/db_class.html">Db</a> 85<br><b>See Also</b> 86<a href="/api_cxx/db_list.html">Databases and Related Methods</a> 87</tt> 88<table width="100%"><tr><td><br></td><td align=right> 89<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> 90</td></tr></table> 91<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 92</body> 93</html> 94