1VILLA(3)                    Quick Database Manager                    VILLA(3)
2
3
4

NAME

6       Villa - the advanced API of QDBM
7
8

SYNOPSIS

10       #include <depot.h>
11       #include <cabin.h>
12       #include <villa.h>
13       #include <stdlib.h>
14
15       typedef int(*VLCFUNC)(const char *aptr, int asiz, const char *bptr, int
16       bsiz);
17
18       VILLA *vlopen(const char *name, int omode, VLCFUNC cmp);
19
20       int vlclose(VILLA *villa);
21
22       int vlput(VILLA *villa, const char *kbuf, int ksiz, const  char  *vbuf,
23       int vsiz, int dmode);
24
25       int vlout(VILLA *villa, const char *kbuf, int ksiz);
26
27       char *vlget(VILLA *villa, const char *kbuf, int ksiz, int *sp);
28
29       int vlvsiz(VILLA *villa, const char *kbuf, int ksiz);
30
31       int vlvnum(VILLA *villa, const char *kbuf, int ksiz);
32
33       int  vlputlist(VILLA  *villa,  const char *kbuf, int ksiz, const CBLIST
34       *vals);
35
36       int vloutlist(VILLA *villa, const char *kbuf, int ksiz);
37
38       CBLIST *vlgetlist(VILLA *villa, const char *kbuf, int ksiz);
39
40       char *vlgetcat(VILLA *villa, const char *kbuf, int ksiz, int *sp);
41
42       int vlcurfirst(VILLA *villa);
43
44       int vlcurlast(VILLA *villa);
45
46       int vlcurprev(VILLA *villa);
47
48       int vlcurnext(VILLA *villa);
49
50       int vlcurjump(VILLA *villa, const char *kbuf, int ksiz, int jmode);
51
52       char *vlcurkey(VILLA *villa, int *sp);
53
54       char *vlcurval(VILLA *villa, int *sp);
55
56       int vlcurput(VILLA *villa, const char *vbuf, int vsiz, int cpmode);
57
58       int vlcurout(VILLA *villa);
59
60       void vlsettuning(VILLA *villa, int lrecmax, int nidxmax, int lcnum, int
61       ncnum);
62
63       int vlsetfbpsiz(VILLA *villa, int size);
64
65       int vlsync(VILLA *villa);
66
67       int vloptimize(VILLA *villa);
68
69       char *vlname(VILLA *villa);
70
71       int vlfsiz(VILLA *villa);
72
73       int vllnum(VILLA *villa);
74
75       int vlnnum(VILLA *villa);
76
77       int vlrnum(VILLA *villa);
78
79       int vlwritable(VILLA *villa);
80
81       int vlfatalerror(VILLA *villa);
82
83       int vlinode(VILLA *villa);
84
85       time_t vlmtime(VILLA *villa);
86
87       int vltranbegin(VILLA *villa);
88
89       int vltrancommit(VILLA *villa);
90
91       int vltranabort(VILLA *villa);
92
93       int vlremove(const char *name);
94
95       int vlrepair(const char *name, VLCFUNC cmp);
96
97       int vlexportdb(VILLA *villa, const char *name);
98
99       int vlimportdb(VILLA *villa, const char *name);
100
101

DESCRIPTION

103       Villa is the advanced API of QDBM.  It provides routines for managing a
104       database file of B+ tree.  Each record is stored being sorted in  order
105       defined  by  a  user.  As for hash databases, retrieving method is pro‐
106       vided only as complete accord.  However, with Villa, it is possible  to
107       retrieve records specified by range.  Cursor is used in order to access
108       each record in order.  It is possible to store records duplicating keys
109       in  a  database.  Moreover, according to the transaction mechanism, you
110       can commit or abort operations of a database in a lump.
111
112       Villa is implemented, based on Depot and Cabin.   A  database  file  of
113       Villa  is actual one of Depot.  Although processing speed of retrieving
114       and storing is slower than Depot, the size of a database is smaller.
115
116       In order  to  use  Villa,  you  should  include  `depot.h',  `cabin.h',
117       `villa.h'  and  `stdlib.h' in the source files.  Usually, the following
118       description will be near the beginning of a source file.
119
120              #include <depot.h>
121              #include <cabin.h>
122              #include <villa.h>
123              #include <stdlib.h>
124
125       A pointer to `VILLA' is used as a database handle. It is like that some
126       file  I/O  routines  of  `stdio.h' use a pointer to `FILE'.  A database
127       handle is opened with the function `vlopen' and closed with  `vlclose'.
128       You  should not refer directly to any member of the handle.  If a fatal
129       error occurs in a database, any access method  via  the  handle  except
130       `vlclose' will not work and return error status.  Although a process is
131       allowed to use multiple database handles at the same time,  handles  of
132       the  same database file should not be used.  Before the cursor is used,
133       it should be initialized by one of `vlcurfirst', `vlcurlast' or `vlcur‐
134       jump'.   Also  after storing or deleting a record with functions except
135       for `vlcurput' and `vlcurout', the cursor should be initialized.
136
137       Villa also assign the external variable `dpecode' with the error  code.
138       The  function  `dperrmsg'  is  used  in order to get the message of the
139       error code.
140
141       You can define a comparing function to specify the  order  of  records.
142       The function should be the following type.
143
144       typedef int(*VLCFUNC)(const char *aptr, int asiz, const char *bptr, int
145       bsiz);
146              `aptr' specifies the pointer to the region of one  key.   `asiz'
147              specifies  the  size of the region of one key.  `bptr' specifies
148              the pointer to the region of the other  key.   `bsiz'  specifies
149              the  size  of  the region of the other key.  The return value is
150              positive if the former is big, negative if the latter is big,  0
151              if both are equivalent.
152
153       The function `vlopen' is used in order to get a database handle.
154
155       VILLA *vlopen(const char *name, int omode, VLCFUNC cmp);
156              `name' specifies the name of a database file.  `omode' specifies
157              the connection mode: `VL_OWRITER' as a writer, `VL_OREADER' as a
158              reader.  If the mode is `VL_OWRITER', the following may be added
159              by bitwise or: `VL_OCREAT', which means it creates a  new  data‐
160              base  if  not  exist,  `VL_OTRUNC', which means it creates a new
161              database regardless if  one  exists,  `VL_OZCOMP',  which  means
162              leaves  in the database are compressed, `VL_OYCOMP', which means
163              leaves in the database are  compressed  with  LZO,  `VL_OXCOMP',
164              which  means  leaves  in the database are compressed with BZIP2.
165              Both of `VL_OREADER' and `VL_OWRITER' can be added to by bitwise
166              or:  `VL_ONOLCK',  which  means it opens a database file without
167              file locking, or `VL_OLCKNB', which means locking  is  performed
168              without  blocking.   `cmp'  specifies  the  comparing  function:
169              `VL_CMPLEX' comparing keys in lexical order, `VL_CMPINT' compar‐
170              ing  keys  as objects of `int' in native byte order, `VL_CMPNUM'
171              comparing keys as numbers of big endian,  `VL_CMPDEC'  comparing
172              keys  as decimal strings.  Any function based on the declaration
173              of the type `VLCFUNC' can be assigned to the comparing function.
174              The  comparing  function  should  be  kept same in the life of a
175              database.  The return value is the database handle or `NULL'  if
176              it  is  not successful.  While connecting as a writer, an exclu‐
177              sive lock is invoked to the database file.  While connecting  as
178              a  reader,  a  shared lock is invoked to the database file.  The
179              thread  blocks  until  the  lock  is   achieved.    `VL_OZCOMP',
180              `VL_OYCOMP',  and  `VL_OXCOMP'  are  available  only if QDBM was
181              built each with ZLIB, LZO, and BZIP2 enabled.  If `VL_ONOLCK' is
182              used, the application is responsible for exclusion control.
183
184       The function `vlclose' is used in order to close a database handle.
185
186       int vlclose(VILLA *villa);
187              `villa'  specifies a database handle.  If successful, the return
188              value is true, else, it is  false.   Because  the  region  of  a
189              closed handle is released, it becomes impossible to use the han‐
190              dle.  Updating a database is assured to be written when the han‐
191              dle  is closed.  If a writer opens a database but does not close
192              it appropriately, the database will be broken.  If the  transac‐
193              tion is activated and not committed, it is aborted.
194
195       The function `vlput' is used in order to store a record.
196
197       int  vlput(VILLA  *villa, const char *kbuf, int ksiz, const char *vbuf,
198       int vsiz, int dmode);
199              `villa' specifies a  database  handle  connected  as  a  writer.
200              `kbuf'  specifies  the  pointer  to the region of a key.  `ksiz'
201              specifies the size of the region of the key.  If it is negative,
202              the  size is assigned with `strlen(kbuf)'.  `vbuf' specifies the
203              pointer to the region of a value.  `vsiz' specifies the size  of
204              the  region  of  the  value.   If  it  is  negative, the size is
205              assigned with `strlen(vbuf)'.  `dmode' specifies  behavior  when
206              the  key  overlaps,  by  the following values: `VL_DOVER', which
207              means  the  specified  value  overwrites   the   existing   one,
208              `VL_DKEEP',  which  means the existing value is kept, `VL_DCAT',
209              which means the specified value is concatenated at  the  end  of
210              the  existing  value, `VL_DDUP', which means duplication of keys
211              is allowed and the specified value is added  as  the  last  one,
212              `VL_DDUPR',  which  means duplication of keys is allowed and the
213              specified value is added as the first one.  If  successful,  the
214              return  value  is  true,  else, it is false.  The cursor becomes
215              unavailable due to updating database.
216
217       The function `vlout' is used in order to delete a record.
218
219       int vlout(VILLA *villa, const char *kbuf, int ksiz);
220              `villa' specifies a  database  handle  connected  as  a  writer.
221              `kbuf'  specifies  the  pointer  to the region of a key.  `ksiz'
222              specifies the size of the region of the key.  If it is negative,
223              the  size  is  assigned with `strlen(kbuf)'.  If successful, the
224              return value is true, else, it is false.  False is returned when
225              no  record  corresponds  to  the specified key.  When the key of
226              duplicated records is specified, the first record  of  the  same
227              key  is deleted.  The cursor becomes unavailable due to updating
228              database.
229
230       The function `vlget' is used in order to retrieve a record.
231
232       char *vlget(VILLA *villa, const char *kbuf, int ksiz, int *sp);
233              `villa' specifies  a  database  handle.   `kbuf'  specifies  the
234              pointer  to  the  region of a key.  `ksiz' specifies the size of
235              the region of the key.  If it is negative, the size is  assigned
236              with  `strlen(kbuf)'.   `sp' specifies the pointer to a variable
237              to which the size of the region of the return value is assigned.
238              If  it  is  `NULL',  it  is not used.  If successful, the return
239              value is the pointer to the region of the value  of  the  corre‐
240              sponding record, else, it is `NULL'.  `NULL' is returned when no
241              record corresponds to the specified key.  When the key of dupli‐
242              cated records is specified, the value of the first record of the
243              same key is  selected.   Because  an  additional  zero  code  is
244              appended  at  the  end  of  the  region of the return value, the
245              return value can be treated as a character string.  Because  the
246              region  of the return value is allocated with the `malloc' call,
247              it should be released with the `free' call if it is no longer in
248              use.
249
250       The  function `vlvsiz' is used in order to get the size of the value of
251       a record.
252
253       int vlvsiz(VILLA *villa, const char *kbuf, int ksiz);
254              `villa' specifies  a  database  handle.   `kbuf'  specifies  the
255              pointer  to  the  region of a key.  `ksiz' specifies the size of
256              the region of the key.  If it is negative, the size is  assigned
257              with  `strlen(kbuf)'.   If  successful,  the return value is the
258              size of the value of the corresponding record, else, it  is  -1.
259              If  multiple  records  correspond,  the  size  of  the  first is
260              returned.
261
262       The function `vlvnum' is used in order to get  the  number  of  records
263       corresponding a key.
264
265       int vlvnum(VILLA *villa, const char *kbuf, int ksiz);
266              `villa'  specifies  a  database  handle.   `kbuf'  specifies the
267              pointer to the region of a key.  `ksiz' specifies  the  size  of
268              the  region of the key.  If it is negative, the size is assigned
269              with `strlen(kbuf)'.  The return value is the number  of  corre‐
270              sponding records.  If no record corresponds, 0 is returned.
271
272       The  function `vlputlist' is used in order to store plural records cor‐
273       responding a key.
274
275       int vlputlist(VILLA *villa, const char *kbuf, int  ksiz,  const  CBLIST
276       *vals);
277              `villa'  specifies  a  database  handle  connected  as a writer.
278              `kbuf' specifies the pointer to the region  of  a  key.   `ksiz'
279              specifies the size of the region of the key.  If it is negative,
280              the size is assigned with `strlen(kbuf)'.   `vals'  specifies  a
281              list  handle  of values.  The list should not be empty.  If suc‐
282              cessful, the return value is true, else, it is false.  The  cur‐
283              sor becomes unavailable due to updating database.
284
285       The  function `vloutlist' is used in order to delete all records corre‐
286       sponding a key.
287
288       int vloutlist(VILLA *villa, const char *kbuf, int ksiz);
289              `villa' specifies a  database  handle  connected  as  a  writer.
290              `kbuf'  specifies  the  pointer  to the region of a key.  `ksiz'
291              specifies the size of the region of the key.  If it is negative,
292              the  size  is  assigned with `strlen(kbuf)'.  If successful, the
293              return value is true, else, it is false.  False is returned when
294              no  record corresponds to the specified key.  The cursor becomes
295              unavailable due to updating database.
296
297       The function `vlgetlist' is used in order to  retrieve  values  of  all
298       records corresponding a key.
299
300       CBLIST *vlgetlist(VILLA *villa, const char *kbuf, int ksiz);
301              `villa'  specifies  a  database  handle.   `kbuf'  specifies the
302              pointer to the region of a key.  `ksiz' specifies  the  size  of
303              the  region of the key.  If it is negative, the size is assigned
304              with `strlen(kbuf)'.  If successful, the return value is a  list
305              handle  of  the values of the corresponding records, else, it is
306              `NULL'.  `NULL' is returned when no record  corresponds  to  the
307              specified key.  Because the handle of the return value is opened
308              with the function `cblistopen', it should  be  closed  with  the
309              function `cblistclose' if it is no longer in use.
310
311       The  function `vlgetcat' is used in order to retrieve concatenated val‐
312       ues of all records corresponding a key.
313
314       char *vlgetcat(VILLA *villa, const char *kbuf, int ksiz, int *sp);
315              `villa' specifies  a  database  handle.   `kbuf'  specifies  the
316              pointer  to  the  region of a key.  `ksiz' specifies the size of
317              the region of the key.  If it is negative, the size is  assigned
318              with  `strlen(kbuf)'.   `sp' specifies the pointer to a variable
319              to which the size of the region of the return value is assigned.
320              If  it  is  `NULL',  it  is not used.  If successful, the return
321              value is the pointer to the region of the concatenated values of
322              the  corresponding  record,  else,  it  is  `NULL'.   `NULL'  is
323              returned when  no  record  corresponds  to  the  specified  key.
324              Because  an  additional  zero code is appended at the end of the
325              region of the return value, the return value can be treated as a
326              character  string.   Because  the  region of the return value is
327              allocated with the `malloc' call, it should be released with the
328              `free'  call if it is no longer in use.
329
330       The  function  `vlcurfirst'  is used in order to move the cursor to the
331       first record.
332
333       int vlcurfirst(VILLA *villa);
334              `villa' specifies a database handle.  If successful, the  return
335              value is true, else, it is false.  False is returned if there is
336              no record in the database.
337
338       The function `vlcurlast' is used in order to move  the  cursor  to  the
339       last record.
340
341       int vlcurlast(VILLA *villa);
342              `villa'  specifies a database handle.  If successful, the return
343              value is true, else, it is false.  False is returned if there is
344              no record in the database.
345
346       The  function  `vlcurprev'  is  used in order to move the cursor to the
347       previous record.
348
349       int vlcurprev(VILLA *villa);
350              `villa' specifies a database handle.  If successful, the  return
351              value is true, else, it is false.  False is returned if there is
352              no previous record.
353
354       The function `vlcurnext' is used in order to move  the  cursor  to  the
355       next record.
356
357       int vlcurnext(VILLA *villa);
358              `villa'  specifies a database handle.  If successful, the return
359              value is true, else, it is false.  False is returned if there is
360              no next record.
361
362       The function `vlcurjump' is used in order to move the cursor to a posi‐
363       tion around a record.
364
365       int vlcurjump(VILLA *villa, const char *kbuf, int ksiz, int jmode);
366              `villa' specifies  a  database  handle.   `kbuf'  specifies  the
367              pointer  to  the  region of a key.  `ksiz' specifies the size of
368              the region of the key.  If it is negative, the size is  assigned
369              with   `strlen(kbuf)'.   `jmode'  specifies  detail  adjustment:
370              `VL_JFORWARD', which means that the cursor is set to  the  first
371              record  of  the  same key and that the cursor is set to the next
372              substitute  if  completely  matching  record  does  not   exist,
373              `VL_JBACKWARD',  which  means that the cursor is set to the last
374              record of the same key and that the cursor is set to the  previ‐
375              ous substitute if completely matching record does not exist.  If
376              successful, the return value is true, else, it is false.   False
377              is returned if there is no record corresponding the condition.
378
379       The  function  `vlcurkey' is used in order to get the key of the record
380       where the cursor is.
381
382       char *vlcurkey(VILLA *villa, int *sp);
383              `villa' specifies a database handle.  `sp' specifies the pointer
384              to  a  variable  to  which  the size of the region of the return
385              value is assigned.  If it is `NULL', it is not  used.   If  suc‐
386              cessful,  the  return  value is the pointer to the region of the
387              key of the corresponding record, else, it is `NULL'.  `NULL'  is
388              returned  when  no record corresponds to the cursor.  Because an
389              additional zero code is appended at the end of the region of the
390              return  value,  the  return  value can be treated as a character
391              string.  Because the region of the  return  value  is  allocated
392              with  the  `malloc'  call, it should be released with the `free'
393              call if it is no longer in use.
394
395       The function `vlcurval' is used in order to get the value of the record
396       where the cursor is.
397
398       char *vlcurval(VILLA *villa, int *sp);
399              `villa' specifies a database handle.  `sp' specifies the pointer
400              to a variable to which the size of  the  region  of  the  return
401              value  assigned.   If it is `NULL', it is not used.  If success‐
402              ful, the return value is the pointer to the region of the  value
403              of  the  corresponding  record,  else,  it is `NULL'.  `NULL' is
404              returned when no record corresponds to the cursor.   Because  an
405              additional zero code is appended at the end of the region of the
406              return value, the return value can be  treated  as  a  character
407              string.   Because  the  region  of the return value is allocated
408              with the `malloc' call, it should be released  with  the  `free'
409              call if it is no longer in use.
410
411       The  function `vlcurput' is used in order to insert a record around the
412       cursor.
413
414       int vlcurput(VILLA *villa, const char *vbuf, int vsiz, int cpmode);
415              `villa' specifies a  database  handle  connected  as  a  writer.
416              `vbuf'  specifies  the pointer to the region of a value.  `vsiz'
417              specifies the size of the region of the value.  If it  is  nega‐
418              tive, the size is assigned with `strlen(vbuf)'.  `cpmode' speci‐
419              fies detail adjustment: `VL_CPCURRENT',  which  means  that  the
420              value of the current record is overwritten, `VL_CPBEFORE', which
421              means that a new record is inserted before the  current  record,
422              `VL_CPAFTER',  which  means  that a new record is inserted after
423              the current record.  If successful, the return  value  is  true,
424              else, it is false.  False is returned when no record corresponds
425              to the cursor.  After insertion, the  cursor  is  moved  to  the
426              inserted record.
427
428       The function `vlcurout' is used in order to delete the record where the
429       cursor is.
430
431       int vlcurout(VILLA *villa);
432              `villa' specifies a database handle connected as a  writer.   If
433              successful,  the return value is true, else, it is false.  False
434              is returned when no record corresponds  to  the  cursor.   After
435              deletion, the cursor is moved to the next record if possible.
436
437       The  function  `vlsettuning' is used in order to set the tuning parame‐
438       ters for performance.
439
440       void vlsettuning(VILLA *villa, int lrecmax, int nidxmax, int lcnum, int
441       ncnum);
442              `villa'  specifies  a  database handle.  `lrecmax' specifies the
443              max number of records in a leaf node of B+ tree.  If it  is  not
444              more  than  0, the default value is specified.  `nidxmax' speci‐
445              fies the max number of indexes in a non-leaf node  of  B+  tree.
446              If  it  is  not  more  than  0,  the default value is specified.
447              `lcnum' specifies the max number of caching leaf nodes.   If  it
448              is  not  more  than  0, the default value is specified.  `ncnum'
449              specifies the max number of caching non-leaf nodes.   If  it  is
450              not  more  than  0, the default value is specified.  The default
451              setting is equivalent  to  `vlsettuning(49,  192,  1024,  512)'.
452              Because  tuning  parameters  are  not  saved  in a database, you
453              should specify them every opening a database.
454
455       The function `vlsetfbpsiz' is used in order to set the size of the free
456       block pool of a database handle.
457
458       int vlsetfbpsiz(VILLA *villa, int size);
459              `villa'  specifies  a  database  handle  connected  as a writer.
460              `size' specifies the size of the free block pool of a  database.
461              If successful, the return value is true, else, it is false.  The
462              default size of the free block pool is  256.   If  the  size  is
463              greater,  the space efficiency of overwriting values is improved
464              with the time efficiency sacrificed.
465
466       The function `vlsync' is used in order to synchronize updating contents
467       with the file and the device.
468
469       int vlsync(VILLA *villa);
470              `villa'  specifies  a database handle connected as a writer.  If
471              successful, the return value is true, else, it is  false.   This
472              function is useful when another process uses the connected data‐
473              base file.  This function should not be used while the  transac‐
474              tion is activated.
475
476       The function `vloptimize' is used in order to optimize a database.
477
478       int vloptimize(VILLA *villa);
479              `villa'  specifies  a database handle connected as a writer.  If
480              successful, the return value is true, else, it is false.  In  an
481              alternating succession of deleting and storing with overwrite or
482              concatenate, dispensable regions accumulate.  This  function  is
483              useful  to  do away with them.  This function should not be used
484              while the transaction is activated.
485
486       The function `vlname' is used in order to get the name of a database.
487
488       char *vlname(VILLA *villa);
489              `villa' specifies a database handle.  If successful, the  return
490              value  is the pointer to the region of the name of the database,
491              else, it is `NULL'.  Because the region of the return  value  is
492              allocated with the `malloc' call, it should be released with the
493              `free' call if it is no longer in use.
494
495       The function `vlfsiz' is used in order to get the size  of  a  database
496       file.
497
498       int vlfsiz(VILLA *villa);
499              `villa'  specifies a database handle.  If successful, the return
500              value is the size of the database file, else, it is -1.  Because
501              of  the  I/O  buffer, the return value may be less than the hard
502              size.
503
504       The function `vllnum' is used in order to get the number  of  the  leaf
505       nodes of B+ tree.
506
507       int vllnum(VILLA *villa);
508              `villa'  specifies a database handle.  If successful, the return
509              value is the number of the leaf nodes, else, it is -1.
510
511       The function `vlnnum' is used  in  order  to  get  the  number  of  the
512       non-leaf nodes of B+ tree.
513
514       int vlnnum(VILLA *villa);
515              `villa'  specifies a database handle.  If successful, the return
516              value is the number of the non-leaf nodes, else, it is -1.
517
518       The function `vlrnum' is used in order to get the number of the records
519       stored in a database.
520
521       int vlrnum(VILLA *villa);
522              `villa'  specifies a database handle.  If successful, the return
523              value is the number of the records stored in the database, else,
524              it is -1.
525
526       The  function `vlwritable' is used in order to check whether a database
527       handle is a writer or not.
528
529       int vlwritable(VILLA *villa);
530              `villa' specifies a database handle.  The return value  is  true
531              if the handle is a writer, false if not.
532
533       The  function  `vlfatalerror' is used in order to check whether a data‐
534       base has a fatal error or not.
535
536       int vlfatalerror(VILLA *villa);
537              `villa' specifies a database handle.  The return value  is  true
538              if the database has a fatal error, false if not.
539
540       The  function  `vlinode'  is used in order to get the inode number of a
541       database file.
542
543       int vlinode(VILLA *villa);
544              `villa' specifies a database handle.  The return  value  is  the
545              inode number of the database file.
546
547       The  function  `vlmtime' is used in order to get the last modified time
548       of a database.
549
550       time_t vlmtime(VILLA *villa);
551              `villa' specifies a database handle.  The return  value  is  the
552              last modified time of the database.
553
554       The function `vltranbegin' is used in order to begin the transaction.
555
556       int vltranbegin(VILLA *villa);
557              `villa'  specifies  a database handle connected as a writer.  If
558              successful, the  return  value  is  true,  else,  it  is  false.
559              Because  this function does not perform mutual exclusion control
560              in multi-thread, the application is responsible  for  it.   Only
561              one  transaction  can be activated with a database handle at the
562              same time.
563
564       The function `vltrancommit' is used in order to commit the transaction.
565
566       int vltrancommit(VILLA *villa);
567              `villa' specifies a database handle connected as a  writer.   If
568              successful, the return value is true, else, it is false.  Updat‐
569              ing a database in the transaction is fixed when it is  committed
570              successfully.
571
572       The function `vltranabort' is used in order to abort the transaction.
573
574       int vltranabort(VILLA *villa);
575              `villa'  specifies  a database handle connected as a writer.  If
576              successful, the return value is true, else, it is false.  Updat‐
577              ing  a  database  in  the  transaction  is  discarded when it is
578              aborted.  The state of the  database  is  rollbacked  to  before
579              transaction.
580
581       The function `vlremove' is used in order to remove a database file.
582
583       int vlremove(const char *name);
584              `name'  specifies  the  name of a database file.  If successful,
585              the return value is true, else, it is false.
586
587       The function `vlrepair' is used in order to repair  a  broken  database
588       file.
589
590       int vlrepair(const char *name, VLCFUNC cmp);
591              `name'  specifies  the name of a database file.  `cmp' specifies
592              the comparing function of the database file.  If successful, the
593              return  value is true, else, it is false.  There is no guarantee
594              that all records in a repaired database file correspond  to  the
595              original or expected state.
596
597       The  function  `vlexportdb'  is  used  in  order to dump all records as
598       endian independent data.
599
600       int vlexportdb(VILLA *villa, const char *name);
601              `villa' specifies a database handle.  `name' specifies the  name
602              of  an  output  file.   If successful, the return value is true,
603              else, it is false.
604
605       The function `vlimportdb' is used in order to  load  all  records  from
606       endian independent data.
607
608       int vlimportdb(VILLA *villa, const char *name);
609              `villa'  specifies a database handle connected as a writer.  The
610              database of the handle must be empty.  `name' specifies the name
611              of  an  input  file.   If  successful, the return value is true,
612              else, it is false.
613
614       If QDBM was built  with  POSIX  thread  enabled,  the  global  variable
615       `dpecode'  is  treated  as thread specific data, and functions of Villa
616       are reentrant.  In that case, they are thread-safe as long as a  handle
617       is  not  accessed  by  threads at the same time, on the assumption that
618       `errno', `malloc', and so on are thread-safe.
619
620       Vista is the extended API of Villa.  To compensate for the defect  that
621       Villa can not handle a file whose size is more than 2GB, Vista does not
622       use Depot but Curia for handling its internal  database.   While  Vista
623       provides  data  structure  and operations of B+ tree as with Villa, its
624       database is realized as a directory.
625
626       In order  to  use  Vista,  you  should  include  `vista.h'  instead  of
627       `villa.h'.   Because  Vista  is  implemented  by  overriding symbols of
628       Villa, it can be used as with Villa.  That is, Signatures of Villa  and
629       Vista  is  all the same.  However, as its adverse effect, modules using
630       Vista can not use Depot nor Villa.
631
632

SEE ALSO

634       qdbm(3), depot(3), curia(3), relic(3),  hovel(3),  cabin(3),  odeum(3),
635       ndbm(3), gdbm(3)
636
637
638
639Man Page                          2004-04-22                          VILLA(3)
Impressum