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