| 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>DbEnv::set_msgcall()</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="env.html" title="Chapter 5. The DbEnv Handle" /> |
| 11 | <link rel="prev" href="envset_message_stream.html" title="DbEnv::set_message_stream()" /> |
| 12 | <link rel="next" href="envset_msgfile.html" title="DbEnv::set_msgfile()" /> |
| 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">DbEnv::set_msgcall()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_message_stream.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 5. |
| 26 | The DbEnv Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_msgfile.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="envset_msgcall"></a>DbEnv::set_msgcall()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | void DbEnv::set_msgcall(void (*db_msgcall_fcn)(const DbEnv *dbenv, |
| 44 | const char *msg));</pre> |
| 45 | <p> |
| 46 | There are interfaces in the Berkeley DB library which either directly |
| 47 | output informational messages or statistical information, or configure |
| 48 | the library to output such messages when performing other operations, |
| 49 | for example, <a class="xref" href="envset_verbose.html" title="DbEnv::set_verbose()">DbEnv::set_verbose()</a> and |
| 50 | <a class="xref" href="envstat.html" title="DbEnv::stat_print()">DbEnv::stat_print()</a>. |
| 51 | </p> |
| 52 | <p> |
| 53 | The <code class="methodname">DbEnv::set_msgcall()</code> and |
| 54 | <a class="xref" href="dbset_msgcall.html" title="Db::set_msgcall()">Db::set_msgcall()</a> |
| 55 | methods are used to pass these messages to the application, and Berkeley DB will call |
| 56 | <span class="bold"><strong>db_msgcall_fcn</strong></span> with each message. It |
| 57 | is up to the <span class="bold"><strong>db_msgcall_fcn</strong></span> function |
| 58 | to display the message in an appropriate manner. |
| 59 | </p> |
| 60 | <p> |
| 61 | Setting <span class="bold"><strong>db_msgcall_fcn</strong></span> to NULL |
| 62 | unconfigures the callback interface. |
| 63 | </p> |
| 64 | <p> |
| 65 | Alternatively, you can use the |
| 66 | <span> |
| 67 | <a class="xref" href="envset_error_stream.html" title="DbEnv::set_error_stream()">DbEnv::set_error_stream()</a> |
| 68 | and |
| 69 | <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a> |
| 70 | methods to display the messages via an output stream, or the |
| 71 | </span> |
| 72 | <a class="xref" href="dbset_msgfile.html" title="Db::set_msgfile()">Db::set_msgfile()</a> or |
| 73 | <a class="xref" href="envset_msgfile.html" title="DbEnv::set_msgfile()">Db::set_msgfile()</a> |
| 74 | methods to display the messages via a C library FILE *. |
| 75 | <span>You should not mix these approaches.</span> |
| 76 | </p> |
| 77 | <p> |
| 78 | The <code class="methodname">DbEnv::set_msgcall()</code> method configures operations performed |
| 79 | using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle, not all |
| 80 | operations performed on the underlying database environment. |
| 81 | </p> |
| 82 | <p> |
| 83 | The <code class="methodname">DbEnv::set_msgcall()</code> method may be called at any time during the |
| 84 | life of the application. |
| 85 | </p> |
| 86 | <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| 87 | <h3 class="title">Note</h3> |
| 88 | <p> |
| 89 | Berkeley DB is not re-entrant. Callback functions should not attempt to make library calls (for |
| 90 | example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work |
| 91 | correctly, and the results are undefined. |
| 92 | </p> |
| 93 | </div> |
| 94 | <div class="sect2" lang="en" xml:lang="en"> |
| 95 | <div class="titlepage"> |
| 96 | <div> |
| 97 | <div> |
| 98 | <h3 class="title"><a id="idp7569320"></a>Parameters</h3> |
| 99 | </div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <div class="sect3" lang="en" xml:lang="en"> |
| 103 | <div class="titlepage"> |
| 104 | <div> |
| 105 | <div> |
| 106 | <h4 class="title"><a id="idp7569512"></a>db_msgcall_fcn</h4> |
| 107 | </div> |
| 108 | </div> |
| 109 | </div> |
| 110 | <p> |
| 111 | The <span class="bold"><strong>db_msgcall_fcn</strong></span> parameter is the |
| 112 | application-specified message reporting function. The function takes |
| 113 | two parameters: |
| 114 | </p> |
| 115 | <div class="itemizedlist"> |
| 116 | <ul type="disc"> |
| 117 | <li> |
| 118 | <p> |
| 119 | <code class="literal">dbenv</code> |
| 120 | </p> |
| 121 | <p> |
| 122 | The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing |
| 123 | database environment. |
| 124 | </p> |
| 125 | </li> |
| 126 | <li> |
| 127 | <p> |
| 128 | <code class="literal">msg</code> |
| 129 | </p> |
| 130 | <p> |
| 131 | The <span class="bold"><strong>msg</strong></span> parameter is the message |
| 132 | string. |
| 133 | </p> |
| 134 | </li> |
| 135 | </ul> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |
| 139 | <div class="sect2" lang="en" xml:lang="en"> |
| 140 | <div class="titlepage"> |
| 141 | <div> |
| 142 | <div> |
| 143 | <h3 class="title"><a id="idp7573112"></a>Class</h3> |
| 144 | </div> |
| 145 | </div> |
| 146 | </div> |
| 147 | <p> |
| 148 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 149 | </p> |
| 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="idp7565376"></a>See Also</h3> |
| 156 | </div> |
| 157 | </div> |
| 158 | </div> |
| 159 | <p> |
| 160 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 161 | </p> |
| 162 | </div> |
| 163 | </div> |
| 164 | <div class="navfooter"> |
| 165 | <hr /> |
| 166 | <table width="100%" summary="Navigation footer"> |
| 167 | <tr> |
| 168 | <td width="40%" align="left"><a accesskey="p" href="envset_message_stream.html">Prev</a> </td> |
| 169 | <td width="20%" align="center"> |
| 170 | <a accesskey="u" href="env.html">Up</a> |
| 171 | </td> |
| 172 | <td width="40%" align="right"> <a accesskey="n" href="envset_msgfile.html">Next</a></td> |
| 173 | </tr> |
| 174 | <tr> |
| 175 | <td width="40%" align="left" valign="top">DbEnv::set_message_stream() </td> |
| 176 | <td width="20%" align="center"> |
| 177 | <a accesskey="h" href="index.html">Home</a> |
| 178 | </td> |
| 179 | <td width="40%" align="right" valign="top"> DbEnv::set_msgfile()</td> |
| 180 | </tr> |
| 181 | </table> |
| 182 | </div> |
| 183 | </body> |
| 184 | </html> |