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->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="db.html" title="Chapter��2.�� The DB Handle" /> 11 <link rel="prev" href="dbset_lorder.html" title="DB->set_lorder()" /> 12 <link rel="next" href="dbset_msgfile.html" title="DB->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->set_msgcall()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbset_lorder.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��2.�� 23 The DB Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="dbset_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="dbset_msgcall"></a>DB->set_msgcall()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40void 41DB->set_msgcall(DB *, 42 void (*db_msgcall_fcn)(const DB_ENV *dbenv, 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 <a class="xref" href="envset_msgcall.html" title="DB_ENV->set_msgcall()">DB_ENV->set_msgcall()</a> and 52 <code class="methodname">DB->set_msgcall()</code> methods are used to 53 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 For <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a> handles opened 72 inside of Berkeley DB environments, calling the <code class="methodname">DB->set_msgcall()</code> 73 method affects the entire environment and is equivalent to calling the 74 <code class="methodname">DB_ENV->set_msgcall()</code> method. 75 </p> 76 <p> 77 The <code class="methodname">DB->set_msgcall()</code> method configures operations performed using 78 the specified <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a> handle, 79 not all operations performed on the underlying database. 80 </p> 81 <p> 82 The <code class="methodname">DB->set_msgcall()</code> method may be called at any time during the 83 life of the application. 84 </p> 85 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 86 <h3 class="title">Note</h3> 87 <p> 88 Berkeley DB is not re-entrant. Callback functions should not attempt to make 89 library calls (for example, to release locks or close open handles). Re-entering 90 Berkeley DB is not guaranteed to work correctly, and the results are undefined. 91 </p> 92 </div> 93 <div class="sect2" lang="en" xml:lang="en"> 94 <div class="titlepage"> 95 <div> 96 <div> 97 <h3 class="title"><a id="id1648371"></a>Parameters</h3> 98 </div> 99 </div> 100 </div> 101 <div class="sect3" lang="en" xml:lang="en"> 102 <div class="titlepage"> 103 <div> 104 <div> 105 <h4 class="title"><a id="id1648492"></a>db_msgcall_fcn</h4> 106 </div> 107 </div> 108 </div> 109 <p> 110 The <span class="bold"><strong>db_msgcall_fcn</strong></span> parameter is the 111 application-specified message reporting function. The function takes 112 two parameters: 113 </p> 114 <div class="itemizedlist"> 115 <ul type="disc"> 116 <li> 117 <p> 118 <code class="literal">dbenv</code> 119 </p> 120 <p> 121 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing 122 database environment. 123 </p> 124 </li> 125 <li> 126 <p> 127 <code class="literal">msg</code> 128 </p> 129 <p> 130 The <span class="bold"><strong>msg</strong></span> parameter is the message 131 string. 132 </p> 133 </li> 134 </ul> 135 </div> 136 </div> 137 </div> 138 <div class="sect2" lang="en" xml:lang="en"> 139 <div class="titlepage"> 140 <div> 141 <div> 142 <h3 class="title"><a id="id1648619"></a>Class</h3> 143 </div> 144 </div> 145 </div> 146 <p> 147 <a class="link" href="db.html" title="Chapter��2.�� The DB Handle">DB</a> 148 </p> 149 </div> 150 <div class="sect2" lang="en" xml:lang="en"> 151 <div class="titlepage"> 152 <div> 153 <div> 154 <h3 class="title"><a id="id1648503"></a>See Also</h3> 155 </div> 156 </div> 157 </div> 158 <p> 159 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 160 </p> 161 </div> 162 </div> 163 <div class="navfooter"> 164 <hr /> 165 <table width="100%" summary="Navigation footer"> 166 <tr> 167 <td width="40%" align="left"><a accesskey="p" href="dbset_lorder.html">Prev</a>��</td> 168 <td width="20%" align="center"> 169 <a accesskey="u" href="db.html">Up</a> 170 </td> 171 <td width="40%" align="right">��<a accesskey="n" href="dbset_msgfile.html">Next</a></td> 172 </tr> 173 <tr> 174 <td width="40%" align="left" valign="top">DB->set_lorder()��</td> 175 <td width="20%" align="center"> 176 <a accesskey="h" href="index.html">Home</a> 177 </td> 178 <td width="40%" align="right" valign="top">��DB->set_msgfile()</td> 179 </tr> 180 </table> 181 </div> 182 </body> 183</html> 184