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_feedback()</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_errpfx.html" title="DB->set_errpfx()" /> 12 <link rel="next" href="dbset_flags.html" title="DB->set_flags()" /> 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_feedback()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbset_errpfx.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_flags.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_feedback"></a>DB->set_feedback()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB->set_feedback(DB *, 42 void (*db_feedback_fcn)(DB *dbp, int opcode, int percent)); </pre> 43 <p> 44 Some operations performed by the Berkeley DB library can take non-trivial amounts of time. 45 The <code class="methodname">DB->set_feedback()</code> method can be used by applications to 46 monitor progress within these operations. When an operation is likely to take a long time, 47 Berkeley DB will call the specified callback function with progress information. 48 </p> 49 <p> 50 It is up to the callback function to display this information in an 51 appropriate manner. 52 </p> 53 <p> 54 The <code class="methodname">DB->set_feedback()</code> method may be called at any time during the 55 life of the application. 56 </p> 57 <p> 58 The <code class="methodname">DB->set_feedback()</code> method returns a non-zero error value on 59 failure and 0 on success. 60 </p> 61 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 62 <h3 class="title">Note</h3> 63 <p> 64 Berkeley DB is not re-entrant. Callback functions should not attempt to make 65 library calls (for example, to release locks or close open handles). Re-entering 66 Berkeley DB is not guaranteed to work correctly, and the results are undefined. 67 </p> 68 </div> 69 <div class="sect2" lang="en" xml:lang="en"> 70 <div class="titlepage"> 71 <div> 72 <div> 73 <h3 class="title"><a id="id1646099"></a>Parameters</h3> 74 </div> 75 </div> 76 </div> 77 <div class="sect3" lang="en" xml:lang="en"> 78 <div class="titlepage"> 79 <div> 80 <div> 81 <h4 class="title"><a id="id1646073"></a>db_feedback_fcn</h4> 82 </div> 83 </div> 84 </div> 85 <p> 86 The <span class="bold"><strong>db_feedback_fcn</strong></span> parameter is the 87 application-specified feedback function called to report Berkeley DB 88 operation progress. The callback function must take three parameters: 89 </p> 90 <div class="itemizedlist"> 91 <ul type="disc"> 92 <li> 93 <p> 94 <code class="literal">dbp</code> 95 </p> 96 <p> 97 The <span class="bold"><strong>dbp</strong></span> parameter is a reference to 98 the enclosing database. 99 </p> 100 </li> 101 <li> 102 <p> 103 <code class="literal">opcode</code> 104 </p> 105 <p> 106 The <span class="bold"><strong>opcode</strong></span> parameter is an operation 107 code. The <span class="bold"><strong>opcode</strong></span> parameter may take 108 on any of the following values: 109 </p> 110 <div class="itemizedlist"> 111 <ul type="circle"> 112 <li> 113 <p><a id="set_feedback_DB_UPGRADE"></a> 114 <code class="literal">DB_UPGRADE</code> 115 </p> 116 <p> 117 The underlying database is being upgraded. 118 </p> 119 </li> 120 <li> 121 <p><a id="set_feedback_DB_VERIFY"></a> 122 <code class="literal">DB_VERIFY</code> 123 </p> 124 <p> 125 The underlying database is being verified. 126 </p> 127 </li> 128 </ul> 129 </div> 130 </li> 131 <li> 132 <p> 133 <code class="literal">percent</code> 134 </p> 135 <p> 136 The <span class="bold"><strong>percent</strong></span> parameter is the percent 137 of the operation that has been completed, specified as an integer 138 value between 0 and 100. 139 </p> 140 </li> 141 </ul> 142 </div> 143 </div> 144 </div> 145 <div class="sect2" lang="en" xml:lang="en"> 146 <div class="titlepage"> 147 <div> 148 <div> 149 <h3 class="title"><a id="id1646294"></a>Class</h3> 150 </div> 151 </div> 152 </div> 153 <p> 154 <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> 155 </p> 156 </div> 157 <div class="sect2" lang="en" xml:lang="en"> 158 <div class="titlepage"> 159 <div> 160 <div> 161 <h3 class="title"><a id="id1646100"></a>See Also</h3> 162 </div> 163 </div> 164 </div> 165 <p> 166 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 167 </p> 168 </div> 169 </div> 170 <div class="navfooter"> 171 <hr /> 172 <table width="100%" summary="Navigation footer"> 173 <tr> 174 <td width="40%" align="left"><a accesskey="p" href="dbset_errpfx.html">Prev</a> </td> 175 <td width="20%" align="center"> 176 <a accesskey="u" href="db.html">Up</a> 177 </td> 178 <td width="40%" align="right"> <a accesskey="n" href="dbset_flags.html">Next</a></td> 179 </tr> 180 <tr> 181 <td width="40%" align="left" valign="top">DB->set_errpfx() </td> 182 <td width="20%" align="center"> 183 <a accesskey="h" href="index.html">Home</a> 184 </td> 185 <td width="40%" align="right" valign="top"> DB->set_flags()</td> 186 </tr> 187 </table> 188 </div> 189 </body> 190</html> 191