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