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>DbMultipleKeyDataBuilder</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="dbt.html" title="Chapter��4.�� The Dbt Handle" /> 11 <link rel="prev" href="dbmultipledatabuilder.html" title="DbMultipleDataBuilder" /> 12 <link rel="next" href="dbmultiplerecnodatabuilder.html" title="DbMultipleRecnoDataBuilder" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbMultipleKeyDataBuilder</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbmultipledatabuilder.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��4.�� 23 The Dbt Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="dbmultiplerecnodatabuilder.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="dbmultiplekeydatabuilder"></a>DbMultipleKeyDataBuilder</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40class DbMultipleKeyDataBuilder 41{ 42public: 43 DbMultipleKeyDataBuilder(Dbt &dbt); 44 45 bool append(void *kbuf, size_t klen, void *dbuf, size_t dlen); 46 bool reserve(void *&kdest, size_t klen, void *&ddest, size_t dlen); 47}; </pre> 48 <p> 49 This class builds a bulk buffer for use when the 50 <a class="link" href="dbput.html#put_DB_MULTIPLE_KEY">DB_MULTIPLE_KEY</a> 51 flag is specified to either the 52 <a class="xref" href="dbput.html" title="Db::put()">Db::put()</a> or 53 <a class="xref" href="dbdel.html" title="Db::del()">Db::del()</a> methods with the btree 54 or hash access methods. The buffer in the 55 <a class="link" href="dbt.html" title="Chapter��4.�� The Dbt Handle">Dbt</a> passed to the constructor is 56 filled by calls to 57 <a class="xref" href="dbmultiplekeydatabuilder.html#dbmultiplekeydatabuilder.append" title="DbMultipleKeyDataBuilder.append()">DbMultipleKeyDataBuilder.append()</a> 58 or 59 <a class="xref" href="dbmultiplekeydatabuilder.html#dbmultiplekeydatabuilder.reserve" title="DbMultipleKeyDataBuilder.reserve()">DbMultipleKeyDataBuilder.reserve()</a>. 60 </p> 61 <p> 62 The constructor takes a <a class="xref" href="dbt.html" title="Chapter��4.�� The Dbt Handle"> 63 The Dbt Handle 64 </a> 65 that must be configured to contain a buffer managed by the application, 66 with the <code class="literal">ulen</code> field set to the size of the buffer. 67 </p> 68 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 69 <h3 class="title">Note</h3> 70 <p> 71 All instances of the bulk retrieval classes may be used only once, 72 and to build the bulk buffer in the forward direction only. 73 </p> 74 </div> 75 <p> 76 Parameters are: 77 </p> 78 <div class="itemizedlist"> 79 <ul type="disc"> 80 <li> 81 <p> 82 <code class="literal">dbt</code> 83 </p> 84 <p> 85 The <span class="bold"><strong>dbt</strong></span> parameter is a <a class="xref" href="dbt.html" title="Chapter��4.�� The Dbt Handle"> 86 The Dbt Handle 87 </a> that must already be configured to contain a buffer managed by the application, with the <code class="literal">ulen</code> field set to the size of the buffer, which must be a multiple of 4. 88 </p> 89 </li> 90 </ul> 91 </div> 92 <div class="sect2" lang="en" xml:lang="en"> 93 <div class="titlepage"> 94 <div> 95 <div> 96 <h3 class="title"><a id="dbmultiplekeydatabuilder.append"></a>DbMultipleKeyDataBuilder.append()</h3> 97 </div> 98 </div> 99 </div> 100 <p> 101 The <code class="methodname">DbMultipleKeyDataBuilder.append()</code> 102 method copies a key/data pair to the end of the buffer. 103 </p> 104 <p> 105 The <code class="methodname">DbMultipleKeyDataBuilder.append()</code> 106 method returns <code class="literal">false</code> if the key/data 107 pair does not fit in the buffer and <code class="literal">true</code> 108 otherwise. 109 </p> 110 <p> 111 Parameters are: 112 </p> 113 <div class="itemizedlist"> 114 <ul type="disc"> 115 <li> 116 <p> 117 <code class="literal">kbuf</code> 118 </p> 119 <p> 120 A pointer to the key to be copied into the bulk buffer. 121 </p> 122 </li> 123 <li> 124 <p> 125 <code class="literal">klen</code> 126 </p> 127 <p> 128 The number of bytes of the key to be copied. 129 </p> 130 </li> 131 <li> 132 <p> 133 <code class="literal">dbuf</code> 134 </p> 135 <p> 136 A pointer to the data item to be copied into the bulk 137 buffer. 138 </p> 139 </li> 140 <li> 141 <p> 142 <code class="literal">dlen</code> 143 </p> 144 <p> 145 The number of bytes of the data item to be copied. 146 </p> 147 </li> 148 </ul> 149 </div> 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="dbmultiplekeydatabuilder.reserve"></a>DbMultipleKeyDataBuilder.reserve()</h3> 156 </div> 157 </div> 158 </div> 159 <p> 160 The <code class="methodname">DbMultipleKeyDataBuilder.reserve()</code> 161 method reserves space for the next key/data pair in the bulk 162 buffer. Unlike the <code class="methodname">append()</code>, no data is 163 actually copied into the bulk buffer by 164 <code class="methodname">reserve()</code>: copying the data is the 165 responsibility of the application. 166 </p> 167 <p> 168 The <code class="methodname">DbMultipleKeyDataBuilder.reserve()</code> 169 method returns <code class="literal">false</code> if the data does 170 not fit in the buffer and <code class="literal">true</code> otherwise. 171 </p> 172 <p> 173 Parameters are: 174 </p> 175 <div class="itemizedlist"> 176 <ul type="disc"> 177 <li> 178 <p> 179 <code class="literal">kdest</code> 180 </p> 181 <p> 182 Set to a pointer to the position in the bulk buffer reserved for the key, if enough space is available. 183 </p> 184 </li> 185 <li> 186 <p> 187 <code class="literal">klen</code> 188 </p> 189 <p> 190 The number of bytes to reserve for the key. 191 </p> 192 </li> 193 <li> 194 <p> 195 <code class="literal">ddest</code> 196 </p> 197 <p> 198 Set to a pointer to the position in the bulk buffer reserved for the data item, if enough space is available. 199 </p> 200 </li> 201 <li> 202 <p> 203 <code class="literal">dlen</code> 204 </p> 205 <p> 206 The number of bytes to reserve for the data item. 207 </p> 208 </li> 209 </ul> 210 </div> 211 </div> 212 <div class="sect2" lang="en" xml:lang="en"> 213 <div class="titlepage"> 214 <div> 215 <div> 216 <h3 class="title"><a id="id1662121"></a>Class</h3> 217 </div> 218 </div> 219 </div> 220 <p> 221 <a class="link" href="dbmultiplebuilder.html" title="DbMultipleBuilder">DbMultipleBuilder</a> 222 </p> 223 </div> 224 <div class="sect2" lang="en" xml:lang="en"> 225 <div class="titlepage"> 226 <div> 227 <div> 228 <h3 class="title"><a id="id1661664"></a>See Also</h3> 229 </div> 230 </div> 231 </div> 232 <p> 233 <a class="xref" href="dbt.html#dbtlist" title="DBT and Bulk Operations">DBT and Bulk Operations</a> 234 </p> 235 </div> 236 </div> 237 <div class="navfooter"> 238 <hr /> 239 <table width="100%" summary="Navigation footer"> 240 <tr> 241 <td width="40%" align="left"><a accesskey="p" href="dbmultipledatabuilder.html">Prev</a>��</td> 242 <td width="20%" align="center"> 243 <a accesskey="u" href="dbt.html">Up</a> 244 </td> 245 <td width="40%" align="right">��<a accesskey="n" href="dbmultiplerecnodatabuilder.html">Next</a></td> 246 </tr> 247 <tr> 248 <td width="40%" align="left" valign="top">DbMultipleDataBuilder��</td> 249 <td width="20%" align="center"> 250 <a accesskey="h" href="index.html">Home</a> 251 </td> 252 <td width="40%" align="right" valign="top">��DbMultipleRecnoDataBuilder</td> 253 </tr> 254 </table> 255 </div> 256 </body> 257</html> 258