This file is indexed.

/usr/share/qdbm/plus/xspex.html is in libxqdbm3c2 1.8.78-5+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="author" content="Mikio Hirabayashi" />
<meta name="keywords" content="QDBM, C++, Depot, Curia, Villa" />
<meta name="description" content="specifications of C++ API of QDBM" />
<link rel="contents" href="./" />
<link rel="alternate" href="xspex-ja.html" hreflang="ja" title="the Japanese version" />
<link rev="made" href="mailto:mikio@fallabs.com" />
<title>Specifications of QDBM for C++</title>
<style type="text/css">html { margin: 0em 0em; padding: 0em 0em; background: #eeeeee none; }
body { margin: 2em 2em; padding: 0em 0em;
  background: #eeeeee none; color: #111111;
  font-style: normal; font-weight: normal; }
h1 { margin-top: 1.8em; margin-bottom: 1.3em; font-weight: bold; }
h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold;
  border-left: solid 0.6em #445555; border-bottom: solid 1pt #bbbbbb;
  padding: 0.5em 0.5em; width: 60%; }
h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; }
hr { margin-top: 2.5em; margin-bottom: 1.5em; height: 1pt;
  color: #999999; background-color: #999999; border: none; }
div.note,div.navi { text-align: right; }
div.logo { text-align: center; margin: 3em 0em; }
div.logo img { border: inset 2pt #ccccdd; }
p { margin: 0.8em 0em; line-height: 140%; }
p,dd { text-indent: 0.8em; }
div,pre { margin-left: 1.7em; margin-right: 1.7em; }
pre { background-color: #ddddee; padding: 0.2em; border: 1pt solid #bbbbcc; font-size: smaller; }
kbd { color: #111111; font-style: normal; font-weight: bold; }
a { color: #0022aa; text-decoration: none; }
a:hover,a:focus { color: #0033ee; text-decoration: underline; }
a.head { color: #111111; text-decoration: none; }
table { padding: 1pt 2pt 1pt 2pt; border: none; margin-left: 1.7em; border-collapse: collapse; }
th { padding: 1pt 4pt 1pt 4pt; border-style: none;
  text-align: left; vertical-align: bottom; }
td { padding: 1pt 4pt 1pt 4pt; border: 1pt solid #333333;
  text-align: left; vertical-align: top; }
ul,ol,dl { line-height: 140%; }
dt { margin-left: 1.2em; }
dd { margin-left: 2.0em; }
ul.lines { list-style-type: none; }
@media print {
  html,body { margin: 0em 0em; background-color: #ffffff; color: #000000; }
  h1 { padding: 8em 0em 0.5em 0em; text-align: center; }
  h2 { page-break-before: always; }
  div.navi,div.logo { display: none }
  div.navi { display: none }
  hr { display: none; }
  pre { margin: 0.8em 0.8em; background-color: #ffffff;
    border: 1pt solid #aaaaaa; font-size: smaller; }
  a,kbd { color: #000000; text-decoration: none; }
  h1,h2,h3 { font-family: sans-serif; }
  p,div,li,dt,dd { font-family: serif; }
  pre,kbd { font-family: monospace; }
  dd { font-size: smaller; }
}
</style>
</head>

<body>

<h1>Specifications of QDBM for C++</h1>

<div class="note">Copyright (C) 2000-2006 Mikio Hirabayashi</div>
<div class="note">Last Update: Thu, 26 Oct 2006 15:00:20 +0900</div>
<div class="navi">[<a href="xapidoc/index.html">API</a>] [<a href="xspex-ja.html" hreflang="ja">Japanese</a>]</div>

<hr />

<h2>Table of Contents</h2>

<ol>
<li><a href="#overview">Overview</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#bugs">Bugs</a></li>
</ol>

<hr />

<h2><a name="overview" id="overview" class="head">Overview</a></h2>

<p>QDBM provides API for C++.  This encapsulates the basic API, the extended API and the advanced API of QDBM, and make them thread-safe.</p>

<p>The basic API for C++ realizes a hash database with a file.  Constructors of the class `Depot' open a database file.  The member function `close' is used in order to close the database.  If the instance is destroyed without closing the database explicitly, the destructor closes the database.  The member function `put' is used in order to store a record.  The member function `out' is used in order to delete a record.  The member function `get' is used in order to retrieve a record.  Besides, most operations like ones of the basic API for C are available.  Each member functions throws an instance of the class `Depot_error' if an error occurs.</p>

<p>The extended API for C++ realizes a hash database with a directory and multiple files.  Constructors of the class `Curia' open a database directory.  The member function `close' is used in order to close the database.  If the instance is destroyed without closing the database explicitly, the destructor closes the database.  The member function `put' is used in order to store a record.  The member function `out' is used in order to delete a record.  The member function `get' is used in order to retrieve a record.  Operations for managing large objects are also provided.  Besides, most operations like ones of the extended API for C are available.  Each member functions throws an instance of the class `Curia_error' if an error occurs.</p>

<p>The advanced API for C++ realizes a B+ tree database with a file.  Constructors of the class `Villa' open a database file.  The member function `close' is used in order to close the database.  If the instance is destroyed without closing the database explicitly, the destructor closes the database.  The member function `put' is used in order to store a record.  The member function `out' is used in order to delete a record.  The member function `get' is used in order to retrieve a record.  Besides, most operations like ones of the advanced API for C are available.  Each member functions throws an instance of the class `Villa_error' if an error occurs.</p>

<p>`Depot', `Curia', and `Villa' are derived classes of the class `ADBM'.  This class is an interface for abstraction of database managers compatible with DBM of UNIX standard.  This class does only declare pure virtual functions.  Each member functions throws an instance of the class `DBM_error'.  In this framework, a key and a value of each record are expressed by the class `Datum'.  An instance of `Datum' has the pointer to the region of data and its size.  When you choose the one of four APIs, `Depot' is suggested if performance is weighted, `Curia' is suggested if scalability is weighted, `Villa' is suggested if ordering access is required, `ADBM' is suggested if elegance and maintenance are weighted.  Besides, a database file is not compatible with each API.</p>

<p>You should include the following header files in source files of applications: `xdepot.h' for `Depot', `xcuria.h' for `Curia', `xvilla.h' for `Villa', and `xadbm.h' for `ADBM'.  Besides, each class is packaged in the name space `qdbm'.</p>

<p>While APIs for C are thread-safe unless plural threads do not share a database handle, APIs for C++ are thread-safe even if plural threads share a handle.  This API is implemented depending on the POSIX thread package.  If you use another thread package, you should write your own C++ wrapper.</p>

<p>When `put' overwriting an existing record is cancelled or `get' retrieving a missing record, failure of the operation is noticed by exception.  If you dislike such behavior, set the `silent' flag to be true.  Then, failure of the operation is noticed by the return value.</p>

<p>For more information about the APIs, read documents in the sub directory `<a href="xapidoc/">xapidoc</a>' and each header file.</p>

<hr />

<h2><a name="installation" id="installation" class="head">Installation</a></h2>

<h3>Preparation</h3>

<p>Make sure that GCC 3.3 or later version is installed. And make sure that QDBM is installed under `/usr/local'.</p>

<p>Change the current working directory to the sub directory named `plus'.</p>

<pre>cd plus
</pre>

<h3>Usual Steps</h3>

<p>Run the configuration script.</p>

<pre>./configure
</pre>

<p>Build programs.</p>

<pre>make
</pre>

<p>Perform self-diagnostic test.</p>

<pre>make check
</pre>

<p>Install programs.  This operation must be carried out by the root user.</p>

<pre>make install
</pre>

<p>When a series of work finishes, header files, `xdepot.h', `xcuria.h', `xvilla.h', and `xadbm.h' will be installed in `/usr/local/include', a library `libxqdbm.so' and so on will be installed in `/usr/local/lib', executable commands `xdptest', `xcrtest', and `xvltest' will be installed in `/usr/local/bin'.</p>

<p>To uninstall them, execute the following command after `./configure'.  This operation must be carried out by the root user.</p>

<pre>make uninstall
</pre>

<h3>For Windows</h3>

<p>On Windows (Cygwin), you should follow the procedures below for installation.</p>

<p>Run the configuration script.</p>

<pre>./configure
</pre>

<p>Build programs.</p>

<pre>make win
</pre>

<p>Perform self-diagnostic test.</p>

<pre>make check-win
</pre>

<p>Install programs.  As well, perform `make uninstall-win' to uninstall them.</p>

<pre>make install-win
</pre>

<p>On Windows, an import library `libxqdbm.dll.a' is created, and a dynamic linking library `jqdbm.dll' is created.  `xqdbm.dll' is installed into `/usr/local/bin'.</p>

<p>Build of the C++ API using MinGW is not supported.</p>

<h3>For Mac OS X</h3>

<p>On Mac OS X (Darwin), you should follow the procedures below for installation.</p>

<p>Run the configuration script.</p>

<pre>./configure
</pre>

<p>Build programs.</p>

<pre>make mac
</pre>

<p>Perform self-diagnostic test.</p>

<pre>make check-mac
</pre>

<p>Install programs.  As well, perform `make uninstall-mac' to uninstall them.</p>

<pre>make install-mac
</pre>

<p>On Mac OS X, `libxqdbm.dylib' and so on are created instead of `libxqdbm.so' and so on.</p>

<h3>For HP-UX</h3>

<p>On HP-UX, you should follow the procedures below for installation.</p>

<p>Run the configuration script.</p>

<pre>./configure
</pre>

<p>Build programs.</p>

<pre>make hpux
</pre>

<p>Perform self-diagnostic test.</p>

<pre>make check-hpux
</pre>

<p>Install programs.  As well, perform `make uninstall-hpux' to uninstall them.</p>

<pre>make install-hpux
</pre>

<p>On HP-UX, `libxqdbm.sl' is created instead of `libxqdbm.so' and so on.</p>

<hr />

<h2><a name="examples" id="examples" class="head">Examples</a></h2>

<p>The following example stores and retrieves a phone number, using the name as the key.</p>

<pre>#include &lt;xdepot.h&gt;
#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;
using namespace qdbm;

const char* NAME = "mikio";
const char* NUMBER = "000-1234-5678";
const char* DBNAME = "book";

int main(int argc, char** argv){
  try {

    // open the database
    Depot depot(DBNAME, Depot::OWRITER | Depot::OCREAT);

    // store the record
    depot.put(NAME, -1, NUMBER, -1);

    // retrieve the record
    char* val = depot.get(NAME, -1);
    cout &lt;&lt; "Name: " &lt;&lt; NAME &lt;&lt; endl;
    cout &lt;&lt; "Number: " &lt;&lt; val &lt;&lt; endl;
    free(val);

    // close the database
    depot.close();

  } catch(Depot_error&amp; e){
    cerr &lt;&lt; e &lt;&lt; endl;
    return 1;
  }
  return 0;
}
</pre>

<p>The following example is a transcription of the one above, using the class `ADBM'.</p>

<pre>#include &lt;xadbm.h&gt;
#include &lt;xdepot.h&gt;
#include &lt;iostream&gt;

using namespace std;
using namespace qdbm;

const char* NAME = "mikio";
const char* NUMBER = "000-1234-5678";
const char* DBNAME = "book";

int main(int argc, char** argv){
  try {

    // open the database
    Depot depot(DBNAME, Depot::OWRITER | Depot::OCREAT);
    ADBM&amp; dbm = depot;

    // prepare the record
    Datum key(NAME);
    Datum val(NUMBER);

    // store the record
    dbm.storerec(key, val);

    // retrieve the record
    const Datum&amp; res = dbm.fetchrec(key);
    cout &lt;&lt; "Name: " &lt;&lt; NAME &lt;&lt; endl;
    cout &lt;&lt; "Number: " &lt;&lt; res &lt;&lt; endl;

    // close the database
    dbm.close();

  } catch(DBM_error&amp; e){
    cerr &lt;&lt; e &lt;&lt; endl;
    return 1;
  }
  return 0;
}
</pre>

<p>The following example performs forward matching search for strings, using the class `Villa'.</p>

<pre>#include &lt;xvilla.h&gt;
#include &lt;cstdlib&gt;
#include &lt;cstring&gt;
#include &lt;iostream&gt;

using namespace std;
using namespace qdbm;

const char* DBNAME = "words";
const char* PREFIX = "apple";

int main(int argc, char** argv){
  try {

    // open the database
    Villa villa(DBNAME, Villa::OWRITER | Villa::OCREAT);

    // store records
    villa.put("applet", -1, "little application", -1, Villa::DDUP);
    villa.put("aurora", -1, "polar wonderwork", -1, Villa::DDUP);
    villa.put("apple", -1, "delicious fruit", -1, Villa::DDUP);
    villa.put("amigo", -1, "good friend", -1, Villa::DDUP);
    villa.put("apple", -1, "big city", -1, Villa::DDUP);

    try {

      // set the cursor at the top of candidates
      villa.curjump(PREFIX, -1);

      // scan with the cursor
      for(;;){
        char* key = villa.curkey();
        if(strstr(key, PREFIX) != key){
          free(key);
          break;
        }
        char* val = villa.curval();
        cout &lt;&lt; key &lt;&lt; ": " &lt;&lt; val &lt;&lt; endl;
        free(key);
        free(val);
        villa.curnext();
      }

    } catch(Villa_error&amp; e){
      if(e.code() != Villa::ENOITEM) throw e;
    }

    // close the database
    villa.close();

  } catch(Villa_error&amp; e){
    cerr &lt;&lt; e &lt;&lt; endl;
    return 1;
  }
  return 0;
}
</pre>

<p>For building a program using C++ API of QDBM, the program should be linked with the libraries: `xqdbm' and `qdbm'.  For example, the following command is executed to build `sample' from `sample.cc'.</p>

<pre>g++ -I/usr/local/include -o sample sample.cc -L/usr/local/lib -lxqdbm -lqdbm
</pre>

<hr />

<h2><a name="bugs" id="bugs" class="head">Bugs</a></h2>

<p>QDBM has restrictions that two or more handles of the same database file should not be used by a process at the same time.  So, when a database is used by two or more threads, open the database in the main thread and pass the handle to each thread.</p>

<p>Because QDBM does not provide mechanism that serialize generic objects and store them into a database, if you want it, you should extend the class `ADBM'.  Besides, if the comparing function of `Villa' compares deserialized objects, the database can be used as an object-oriented database.</p>

<hr />

</body>

</html>

<!-- END OF FILE -->