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