| 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>DB_ENV->log_put()</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="lsn.html" title="Chapter 7. The DB_LSN Handle" /> |
| 11 | <link rel="prev" href="logprintf.html" title="DB_ENV->log_printf()" /> |
| 12 | <link rel="next" href="envlog_set_config.html" title="DB_ENV->log_set_config()" /> |
| 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">DB_ENV->log_put()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="logprintf.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 7. |
| 26 | The DB_LSN Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envlog_set_config.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="logput"></a>DB_ENV->log_put()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->log_put(DB_ENV *env, |
| 45 | DB_LSN *lsn, const DBT *data, u_int32_t flags); </pre> |
| 46 | <p> |
| 47 | The <code class="methodname">DB_ENV->log_put()</code> method appends records to the log. The |
| 48 | <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> of the put record is |
| 49 | returned in the <span class="bold"><strong>lsn</strong></span> parameter. |
| 50 | </p> |
| 51 | <p> |
| 52 | The <code class="methodname">DB_ENV->log_put()</code> <span> |
| 53 | <span> |
| 54 | method returns a non-zero error value on failure and 0 on success. |
| 55 | </span> |
| 56 | |
| 57 | </span> |
| 58 | </p> |
| 59 | <div class="sect2" lang="en" xml:lang="en"> |
| 60 | <div class="titlepage"> |
| 61 | <div> |
| 62 | <div> |
| 63 | <h3 class="title"><a id="idp52919024"></a>Parameters</h3> |
| 64 | </div> |
| 65 | </div> |
| 66 | </div> |
| 67 | <div class="sect3" lang="en" xml:lang="en"> |
| 68 | <div class="titlepage"> |
| 69 | <div> |
| 70 | <div> |
| 71 | <h4 class="title"><a id="idp52919288"></a>lsn</h4> |
| 72 | </div> |
| 73 | </div> |
| 74 | </div> |
| 75 | <p> |
| 76 | The <span class="bold"><strong>lsn</strong></span> parameter references memory |
| 77 | into which the <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> of |
| 78 | the put record is copied. |
| 79 | </p> |
| 80 | </div> |
| 81 | <div class="sect3" lang="en" xml:lang="en"> |
| 82 | <div class="titlepage"> |
| 83 | <div> |
| 84 | <div> |
| 85 | <h4 class="title"><a id="idp52912824"></a>data</h4> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | <p> |
| 90 | The <span class="bold"><strong>data</strong></span> parameter is the record to |
| 91 | write to the log. |
| 92 | </p> |
| 93 | <p> |
| 94 | The caller is responsible for providing any necessary structure to |
| 95 | <span class="bold"><strong>data</strong></span>. (For example, in a write-ahead |
| 96 | logging protocol, the application must understand what part of |
| 97 | <span class="bold"><strong>data</strong></span> is an operation code, what part |
| 98 | is redo information, and what part is undo information. In addition, |
| 99 | most transaction managers will store in <span class="bold"><strong>data</strong></span> the |
| 100 | <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> of the previous log |
| 101 | record for the same transaction, to support chaining back through the |
| 102 | transaction's log records during undo.) |
| 103 | </p> |
| 104 | </div> |
| 105 | <div class="sect3" lang="en" xml:lang="en"> |
| 106 | <div class="titlepage"> |
| 107 | <div> |
| 108 | <div> |
| 109 | <h4 class="title"><a id="idp52915216"></a>flags</h4> |
| 110 | </div> |
| 111 | </div> |
| 112 | </div> |
| 113 | <p> |
| 114 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 115 | or the following value: |
| 116 | </p> |
| 117 | <div class="itemizedlist"> |
| 118 | <ul type="disc"> |
| 119 | <li> |
| 120 | <p><a id="put_DB_FLUSH"></a> |
| 121 | <code class="literal">DB_FLUSH</code> |
| 122 | </p> |
| 123 | <p> |
| 124 | The log is forced to disk after this record is written, guaranteeing |
| 125 | that all records with <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> |
| 126 | values less than or equal to the one being "put" are on disk |
| 127 | before <code class="methodname">DB_ENV->log_put()</code> returns. |
| 128 | </p> |
| 129 | </li> |
| 130 | </ul> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | <div class="sect2" lang="en" xml:lang="en"> |
| 135 | <div class="titlepage"> |
| 136 | <div> |
| 137 | <div> |
| 138 | <h3 class="title"><a id="idp52928224"></a>Errors</h3> |
| 139 | </div> |
| 140 | </div> |
| 141 | </div> |
| 142 | <p> |
| 143 | The <code class="methodname">DB_ENV->log_put()</code> <span> |
| 144 | <span> |
| 145 | method may fail and return one of the following non-zero errors: |
| 146 | </span> |
| 147 | |
| 148 | </span> |
| 149 | </p> |
| 150 | <div class="sect3" lang="en" xml:lang="en"> |
| 151 | <div class="titlepage"> |
| 152 | <div> |
| 153 | <div> |
| 154 | <h4 class="title"><a id="idp52934576"></a>EINVAL</h4> |
| 155 | </div> |
| 156 | </div> |
| 157 | </div> |
| 158 | <p> |
| 159 | If the record to be logged is larger than the maximum log record; or |
| 160 | if an invalid flag value or parameter was specified. |
| 161 | </p> |
| 162 | </div> |
| 163 | </div> |
| 164 | <div class="sect2" lang="en" xml:lang="en"> |
| 165 | <div class="titlepage"> |
| 166 | <div> |
| 167 | <div> |
| 168 | <h3 class="title"><a id="idp52886160"></a>Class</h3> |
| 169 | </div> |
| 170 | </div> |
| 171 | </div> |
| 172 | <p> |
| 173 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, |
| 174 | <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, |
| 175 | <a class="link" href="lsn.html" title="Chapter 7. The DB_LSN Handle">DB_LSN</a> |
| 176 | </p> |
| 177 | </div> |
| 178 | <div class="sect2" lang="en" xml:lang="en"> |
| 179 | <div class="titlepage"> |
| 180 | <div> |
| 181 | <div> |
| 182 | <h3 class="title"><a id="idp52936304"></a>See Also</h3> |
| 183 | </div> |
| 184 | </div> |
| 185 | </div> |
| 186 | <p> |
| 187 | <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> |
| 188 | </p> |
| 189 | </div> |
| 190 | </div> |
| 191 | <div class="navfooter"> |
| 192 | <hr /> |
| 193 | <table width="100%" summary="Navigation footer"> |
| 194 | <tr> |
| 195 | <td width="40%" align="left"><a accesskey="p" href="logprintf.html">Prev</a> </td> |
| 196 | <td width="20%" align="center"> |
| 197 | <a accesskey="u" href="lsn.html">Up</a> |
| 198 | </td> |
| 199 | <td width="40%" align="right"> <a accesskey="n" href="envlog_set_config.html">Next</a></td> |
| 200 | </tr> |
| 201 | <tr> |
| 202 | <td width="40%" align="left" valign="top">DB_ENV->log_printf() </td> |
| 203 | <td width="20%" align="center"> |
| 204 | <a accesskey="h" href="index.html">Home</a> |
| 205 | </td> |
| 206 | <td width="40%" align="right" valign="top"> DB_ENV->log_set_config()</td> |
| 207 | </tr> |
| 208 | </table> |
| 209 | </div> |
| 210 | </body> |
| 211 | </html> |