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>Chapter 1. Dbstl Global Public Functions</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++ Standard Template Library API Reference" /> 10 <link rel="up" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" /> 11 <link rel="prev" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" /> 12 <link rel="next" href="stldbstl_global_functionsclose_all_dbs.html" title="close_all_dbs" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Chapter 1. 19 Dbstl Global Public Functions </th> 20 </tr> 21 <tr> 22 <td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td> 23 <th width="60%" align="center"> </th> 24 <td width="20%" align="right"> <a accesskey="n" href="stldbstl_global_functionsclose_all_dbs.html">Next</a></td> 25 </tr> 26 </table> 27 <hr /> 28 </div> 29 <div class="chapter" lang="en" xml:lang="en"> 30 <div class="titlepage"> 31 <div> 32 <div> 33 <h2 class="title"><a id="dbstl_global_functions"></a>Chapter 1. 34 Dbstl Global Public Functions </h2> 35 </div> 36 </div> 37 </div> 38 <h4><a id="id1541052"></a> Public Members </h4> 39 <div class="informaltable"> 40 <table border="1" width="80%"> 41 <colgroup> 42 <col /> 43 <col /> 44 </colgroup> 45 <thead> 46 <tr> 47 <th>Member</th> 48 <th>Description</th> 49 </tr> 50 </thead> 51 <tbody> 52 <tr> 53 <td> 54<a class="xref" href="dbstl_global_functions.html#stldbstl_global_functionsclose_db" title="close_db"> 55close_db 56</a> 57</td> 58 <td> 59 <p>Close pdb regardless of reference count. </p> </td> 60 </tr> 61 <tr> 62 <td> 63<a class="xref" href="stldbstl_global_functionsclose_all_dbs.html" title="close_all_dbs"> 64close_all_dbs 65</a> 66</td> 67 <td> 68 <p>Close all open database handles regardless of reference count. </p> </td> 69 </tr> 70 <tr> 71 <td> 72<a class="xref" href="stldbstl_global_functionsclose_db_env.html" title="close_db_env"> 73close_db_env 74</a> 75</td> 76 <td> 77 <p>Close specified database environment handle regardless of reference count. </p> </td> 78 </tr> 79 <tr> 80 <td> 81<a class="xref" href="stldbstl_global_functionsclose_all_db_envs.html" title="close_all_db_envs"> 82close_all_db_envs 83</a> 84</td> 85 <td> 86 <p>Close all open database environment handles regardless of reference count. </p> </td> 87 </tr> 88 <tr> 89 <td> 90<a class="xref" href="stldbstl_global_functionsbegin_txn.html" title="begin_txn"> 91begin_txn 92</a> 93</td> 94 <td> 95 <p>Begin a new transaction from the specified environment "env". </p> </td> 96 </tr> 97 <tr> 98 <td> 99<a class="xref" href="stldbstl_global_functionscommit_txn.html" title="commit_txn"> 100commit_txn 101</a> 102</td> 103 <td> 104 <p>Commit current transaction opened in the environment "env". </p> </td> 105 </tr> 106 <tr> 107 <td> 108<a class="xref" href="stldbstl_global_functionsabort_txn.html" title="abort_txn"> 109abort_txn 110</a> 111</td> 112 <td> 113 <p>Abort current transaction of environment "env". </p> </td> 114 </tr> 115 <tr> 116 <td> 117<a class="xref" href="stldbstl_global_functionscurrent_txn.html" title="current_txn"> 118current_txn 119</a> 120</td> 121 <td> 122 <p>Get current transaction of environment "env". </p> </td> 123 </tr> 124 <tr> 125 <td> 126<a class="xref" href="stldbstl_global_functionsset_current_txn_handle.html" title="set_current_txn_handle"> 127set_current_txn_handle 128</a> 129</td> 130 <td> 131 <p>Set environment env's current transaction handle to be newtxn. </p> </td> 132 </tr> 133 <tr> 134 <td> 135<a class="xref" href="stldbstl_global_functionsregister_db.html" title="register_db"> 136register_db 137</a> 138</td> 139 <td> 140 <p>Register a Db handle "pdb1". </p> </td> 141 </tr> 142 <tr> 143 <td> 144<a class="xref" href="stldbstl_global_functionsregister_db_env.html" title="register_db_env"> 145register_db_env 146</a> 147</td> 148 <td> 149 <p>Register a DbEnv handle env1, this handle and handles opened in it will be closed by ResourceManager 150. </p> </td> 151 </tr> 152 <tr> 153 <td> 154<a class="xref" href="stldbstl_global_functionsopen_db.html" title="open_db"> 155open_db 156</a> 157</td> 158 <td> 159 <p>Helper function to open a database and register it into dbstl for the calling thread. </p> </td> 160 </tr> 161 <tr> 162 <td> 163<a class="xref" href="stldbstl_global_functionsopen_env.html" title="open_env"> 164open_env 165</a> 166</td> 167 <td> 168 <p>Helper function to open an environment and register it into dbstl for the calling thread. </p> </td> 169 </tr> 170 <tr> 171 <td> 172<a class="xref" href="stldbstl_global_functionsalloc_mutex.html" title="alloc_mutex"> 173alloc_mutex 174</a> 175</td> 176 <td> 177 <p>Allocate a Berkeley DB mutex. </p> </td> 178 </tr> 179 <tr> 180 <td> 181<a class="xref" href="stldbstl_global_functionslock_mutex.html" title="lock_mutex"> 182lock_mutex 183</a> 184</td> 185 <td> 186 <p>Lock a mutex, wait if it is held by another thread. </p> </td> 187 </tr> 188 <tr> 189 <td> 190<a class="xref" href="stldbstl_global_functionsunlock_mutex.html" title="unlock_mutex"> 191unlock_mutex 192</a> 193</td> 194 <td> 195 <p>Unlock a mutex, and return immediately. </p> </td> 196 </tr> 197 <tr> 198 <td> 199<a class="xref" href="stldbstl_global_functionsfree_mutex.html" title="free_mutex"> 200free_mutex 201</a> 202</td> 203 <td> 204 <p>Free a mutex, and return immediately. </p> </td> 205 </tr> 206 <tr> 207 <td> 208<a class="xref" href="stldbstl_global_functionsdbstl_startup.html" title="dbstl_startup"> 209dbstl_startup 210</a> 211</td> 212 <td> 213 <p>If there are multiple threads within a process that make use of dbstl, then this function should be called in a single thread mutual exclusively before any use of dbstl in a process; Otherwise, you don't need to call it, but are allowed to call it anyway. </p> </td> 214 </tr> 215 <tr> 216 <td> 217<a class="xref" href="stldbstl_global_functionsdbstl_exit.html" title="dbstl_exit"> 218dbstl_exit 219</a> 220</td> 221 <td> 222 <p>This function releases any memory allocated in the heap by code of dbstl. </p> </td> 223 </tr> 224 <tr> 225 <td> 226<a class="xref" href="stldbstl_global_functionsoperator_eq.html" title="operator=="> 227operator== 228</a> 229</td> 230 <td> 231 <p>Operators to compare two Dbt objects. </p> </td> 232 </tr> 233 <tr> 234 <td> 235<a class="xref" href="stldbstl_global_functionsset_global_dbfile_suffix_number.html" title="set_global_dbfile_suffix_number"> 236set_global_dbfile_suffix_number 237</a> 238</td> 239 <td> 240 <p>If exisiting random temporary database name generation mechanism is still causing name clashes, users can set this global suffix number which will be append to each temporary database file name and incremented after each append, and by default it is 0. </p> </td> 241 </tr> 242 <tr> 243 <td> 244<a class="xref" href="stldbstl_global_functionsclose_db_cursors.html" title="close_db_cursors"> 245close_db_cursors 246</a> 247</td> 248 <td> 249 <p>Close cursors opened in dbp1. </p> </td> 250 </tr> 251 </tbody> 252 </table> 253 </div> 254 <h4><a id="id1541615"></a> 255Group</h4> 256 <p> 257None</p> 258 <div class="sect1" lang="en" xml:lang="en"> 259 <div class="titlepage"> 260 <div> 261 <div> 262 <h2 class="title" style="clear: both"><a id="stldbstl_global_functionsclose_db"></a> 263close_db 264</h2> 265 </div> 266 </div> 267 </div> 268 <div class="sect2" lang="en" xml:lang="en"> 269 <div class="titlepage"> 270 <div> 271 <div> 272 <h3 class="title"><a id="func_details"></a> 273Function Details</h3> 274 </div> 275 </div> 276 </div> 277 <pre class="programlisting"> 278 void close_db(Db *pdb) 279 </pre> 280 <div class="sect3" lang="en" xml:lang="en"> 281 <div class="titlepage"></div> 282 <p>Close pdb regardless of reference count. </p> 283 <p>You must make sure pdb is not used by others before calling this method. You can close the underlying database of a container and assign another database with right configurations to it, if the configuration is not suitable for the container, there will be an <a class="link" href="InvalidArgumentException.html" title="Chapter 39. InvalidArgumentException">InvalidArgumentException</a> 284 type of exception thrown. You can't use the container after you called close_db and before setting another valid database handle to the container via <a class="link" href="stldb_containerset_db_handle.html" title="set_db_handle">db_container::set_db_handle()</a> 285 function. </p> 286 </div> 287 <div class="sect3" lang="en" xml:lang="en"> 288 <div class="titlepage"> 289 <div> 290 <div> 291 <h4 class="title"><a id="id1541500"></a> 292Parameters</h4> 293 </div> 294 </div> 295 </div> 296 <div class="sect4" lang="en" xml:lang="en"> 297 <div class="titlepage"> 298 <div> 299 <div> 300 <h5 class="title"><a id="id1541080"></a> 301 pdb </h5> 302 </div> 303 </div> 304 </div> 305 <p>The database handle to close. </p> 306 </div> 307 </div> 308 </div> 309 <div class="sect2" lang="en" xml:lang="en"> 310 <div class="titlepage"> 311 <div> 312 <div> 313 <h3 class="title"><a id="id1541055"></a> 314Group: Functions to close database/environments.</h3> 315 </div> 316 </div> 317 </div> 318 <p>Normally you don't have to close any database or environment handles, they will be closed automatically.</p> 319 <p>Though you still have the following API to close them. </p> 320 </div> 321 <div class="sect2" lang="en" xml:lang="en"> 322 <div class="titlepage"> 323 <div> 324 <div> 325 <h3 class="title"><a id="id1541607"></a> 326Class</h3> 327 </div> 328 </div> 329 </div> 330 <p> 331 <a class="link" href="dbstl_global_functions.html" title="Chapter 1. Dbstl Global Public Functions"> 332 dbstl_global_functions</a> 333 </p> 334 </div> 335 </div> 336 </div> 337 <div class="navfooter"> 338 <hr /> 339 <table width="100%" summary="Navigation footer"> 340 <tr> 341 <td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td> 342 <td width="20%" align="center"> </td> 343 <td width="40%" align="right"> <a accesskey="n" href="stldbstl_global_functionsclose_all_dbs.html">Next</a></td> 344 </tr> 345 <tr> 346 <td width="40%" align="left" valign="top">Berkeley DB C++ Standard Template Library API Reference </td> 347 <td width="20%" align="center"> 348 <a accesskey="h" href="index.html">Home</a> 349 </td> 350 <td width="40%" align="right" valign="top"> 351close_all_dbs 352</td> 353 </tr> 354 </table> 355 </div> 356 </body> 357</html> 358