| 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>Retrieving records</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.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 Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="am.html" title="Chapter 3. Access Method Operations" /> |
| 11 | <link rel="prev" href="am_partition.html" title="Partitioning databases" /> |
| 12 | <link rel="next" href="am_put.html" title="Storing records" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Retrieving records</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="am_partition.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 3. |
| 26 | Access Method Operations |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="am_put.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="am_get"></a>Retrieving records</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <p>The <a href="../api_reference/C/dbget.html" class="olink">DB->get()</a> method retrieves records from the database. In general, |
| 42 | <a href="../api_reference/C/dbget.html" class="olink">DB->get()</a> takes a key and returns the associated data from the |
| 43 | database.</p> |
| 44 | <p>There are a few flags that you can set to customize retrieval:</p> |
| 45 | <div class="variablelist"> |
| 46 | <dl> |
| 47 | <dt> |
| 48 | <span class="term"> |
| 49 | <a href="../api_reference/C/dbget.html#get_DB_GET_BOTH" class="olink">DB_GET_BOTH</a> |
| 50 | </span> |
| 51 | </dt> |
| 52 | <dd>Search for a matching key and data item, that is, only return success |
| 53 | if both the key and the data items match those stored in the database.</dd> |
| 54 | <dt> |
| 55 | <span class="term"> |
| 56 | <a href="../api_reference/C/dbcget.html#dbcget_DB_RMW" class="olink">DB_RMW</a> |
| 57 | </span> |
| 58 | </dt> |
| 59 | <dd>Read-modify-write: acquire write locks instead of read locks during |
| 60 | retrieval. This can enhance performance in threaded applications by |
| 61 | reducing the chance of deadlock.</dd> |
| 62 | <dt> |
| 63 | <span class="term"> |
| 64 | <a href="../api_reference/C/dbget.html#dbget_DB_SET_RECNO" class="olink">DB_SET_RECNO</a> |
| 65 | </span> |
| 66 | </dt> |
| 67 | <dd>If the underlying database is a Btree, and was configured so that it |
| 68 | is possible to search it by logical record number, retrieve a specific |
| 69 | record.</dd> |
| 70 | </dl> |
| 71 | </div> |
| 72 | <p>If the database has been configured to support duplicate records, |
| 73 | <a href="../api_reference/C/dbget.html" class="olink">DB->get()</a> will always return the first data item in the duplicate |
| 74 | set.</p> |
| 75 | </div> |
| 76 | <div class="navfooter"> |
| 77 | <hr /> |
| 78 | <table width="100%" summary="Navigation footer"> |
| 79 | <tr> |
| 80 | <td width="40%" align="left"><a accesskey="p" href="am_partition.html">Prev</a> </td> |
| 81 | <td width="20%" align="center"> |
| 82 | <a accesskey="u" href="am.html">Up</a> |
| 83 | </td> |
| 84 | <td width="40%" align="right"> <a accesskey="n" href="am_put.html">Next</a></td> |
| 85 | </tr> |
| 86 | <tr> |
| 87 | <td width="40%" align="left" valign="top">Partitioning databases </td> |
| 88 | <td width="20%" align="center"> |
| 89 | <a accesskey="h" href="index.html">Home</a> |
| 90 | </td> |
| 91 | <td width="40%" align="right" valign="top"> Storing records</td> |
| 92 | </tr> |
| 93 | </table> |
| 94 | </div> |
| 95 | </body> |
| 96 | </html> |