/usr/share/qdbm/perl/plapidoc/Villa.pm.html is in libqdbm-perl 1.8.78-6.1.
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 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | <?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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="contents" href="./" />
<link rev="made" href="mailto:mikio@fallabs.com" />
<title>Villa (QDBM for Perl)</title>
<style type="text/css">html { margin: 0em 0em; padding 0em 0em; background: #eeeeee none; }
body { background-color: #eeeeee; color: #111111; padding: 1.5em 2em; margin: 0em 0em;
border-left: double 3.0em #ddeedd; border-right: solid 1.0em #ddeedd;
font-style: normal; font-weight: normal; font-family: serif; }
h1 { margin-top: 0.8em; margin-bottom: 1.3em; font-weight: bold; font-family: sans-serif; }
h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold; font-family: sans-serif; }
h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; font-family: sans-serif; }
p,ul,ol,dl { line-height: 140%; }
em { color: #111111; font-style: italic; font-weight: normal; font-family: serif; }
kbd { color: #111111; font-style: normal; font-weight: bold; font-family: monospace; }
a { color: #0022aa; text-decoration: none; }
a:hover { color: #0033ee; text-decoration: underline; }
a.head { color: #111111; text-decoration: none; }
.note { text-align: right; }
</style>
</head>
<body>
<div class="note">[<a href="index.html">Back</a>]</div>
<h1>API of Villa</h1>
<hr />
<dl>
<dt><kbd>use Villa;</kbd></dt>
<dd>
Module `Villa' should be loaded in application codes.
An instance of the class `Villa' is used as a database handle.
</dd>
</dl>
<dl>
<dt><kbd>$Villa::errmsg;</kbd></dt>
<dd>
Global Variable: The message of the last happened error.
</dd>
</dl>
<dl>
<dt><kbd>$villa = new Villa($name, $omode, $cmode);</kbd></dt>
<dd>
Constructor: Get the database handle.
`$name' specifies the name of a database file.
`$omode' specifies the connection mode: `Villa::OWRITER' as a writer, `Villa::OREADER' as a
reader. If the mode is `Villa::OWRITER', the following may be added by bitwise or:
`Villa::OCREAT', which means it creates a new database if not exist, `Villa::OTRUNC', which
means it creates a new database regardless if one exists, `Villa::OZCOMP', which means leaves
in the database are compressed with ZLIB, `Villa::OYCOMP', which means leaves in the database
are compressed with LZO, `Villa::OXCOMP', which means leaves in the database are compressed
with BZIP2. Both of `Villa::OREADER' and `Villa::OWRITER' can be added to by bitwise or:
`Villa::ONOLCK', which means it opens a database file without file locking, or `Villa::OLCKNB',
which means locking is performed without blocking. If it is undef, `Villa::OREADER' is
specified.
`$cmode' specifies the comparing function: `Villa::CMPLEX' comparing keys in lexical order,
`Villa::CMPDEC' comparing keys as decimal strings. The comparing function should be kept
same in the life of a database.
The return value is the database handle or undef if it is not successful.
While connecting as a writer, an exclusive lock is invoked to the database file.
While connecting as a reader, a shared lock is invoked to the database file. The thread
blocks until the lock is achieved. `Villa::OZCOMP', `Villa::OYCOMP', and `Villa::OXCOMP' are
available only if QDBM was built each with ZLIB, LZO, and BZIP2 enabled. If `Villa::ONOLCK'
is used, the application is responsible for exclusion control.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->close();</kbd></dt>
<dd>
Method: Close the database handle.
If successful, the return value is true, else, it is false.
Because the region of a closed handle is released, it becomes impossible to use the handle.
Updating a database is assured to be written when the handle is closed. If a writer opens
a database but does not close it appropriately, the database will be broken. If the
transaction is activated and not committed, it is aborted.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->put($key, $val, $dmode);</kbd></dt>
<dd>
Method: Store a record.
`$key' specifies a key. If it is undef, this method has no effect.
`$val' specifies a value. If it is undef, this method has no effect.
`$dmode' specifies behavior when the key overlaps, by the following values: `Villa::DOVER',
which means the specified value overwrites the existing one, `Villa::DKEEP', which means the
existing value is kept, `Villa::DCAT', which means the specified value is concatenated at the
end of the existing value, `Villa::DDUP', which means duplication of keys is allowed and the
specified value is added as the last one, `Villa::DDUPR', which means duplication of keys is
allowed and the specified value is added as the first one. If it is undef, `Villa::DOVER' is
specified.
If successful, the return value is true, else, it is false.
The cursor becomes unavailable due to updating database.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->out($key);</kbd></dt>
<dd>
Method: Delete a record.
`$key' specifies a key. If it is undef, this method has no effect.
If successful, the return value is true, else, it is false. False is returned when no
record corresponds to the specified key.
When the key of duplicated records is specified, the first record of the same key is deleted.
The cursor becomes unavailable due to updating database.
</dd>
</dl>
<dl>
<dt><kbd>$str = $villa->get($key);</kbd></dt>
<dd>
Method: Retrieve a record.
`$key' specifies a key. If it is undef, this method has no effect.
If successful, the return value is a scalar of the value of the corresponding record, else, it
is undef. undef is returned when no record corresponds to the specified key.
When the key of duplicated records is specified, the value of the first record of the same key
is selected.
</dd>
</dl>
<dl>
<dt><kbd>$num = $villa->vsiz($key);</kbd></dt>
<dd>
Method: Get the size of the value of a record.
`$key' specifies a key. If it is undef, this method has no effect.
The return value is the size of the value of the corresponding record. If no record
corresponds, -1 is returned. If multiple records correspond, the size of the first is
returned.
</dd>
</dl>
<dl>
<dt><kbd>$num = $villa->vnum($key);</kbd></dt>
<dd>
Method: Get the number of records corresponding a key.
`$key' specifies a key. If it is undef, this method has no effect.
If successful, the return value is the size of the value of the corresponding record, else,
it is 0.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curfirst();</kbd></dt>
<dd>
Method: Move the cursor to the first record.
If successful, the return value is true, else, it is false. False is returned if there is
no record in the database.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curlast();</kbd></dt>
<dd>
Method: Move the cursor to the last record.
If successful, the return value is true, else, it is false. False is returned if there is
no record in the database.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curprev();</kbd></dt>
<dd>
Method: Move the cursor to the previous record.
If successful, the return value is true, else, it is false. False is returned if there is
no previous record.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curnext();</kbd></dt>
<dd>
Method: Move the cursor to the next record.
If successful, the return value is true, else, it is false. False is returned if there is
no next record.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curjump($key, $jmode);</kbd></dt>
<dd>
Method: Move the cursor to a position around a record.
`$key' specifies a key. If it is undef, this method has no effect.
`$jmode' specifies detail adjustment: `Villa::JFORWARD', which means that the cursor is set
to the first record of the same key and that the cursor is set to the next substitute if
completely matching record does not exist, `Villa::JBACKWARD', which means that the cursor
is set to the last record of the same key and that the cursor is set to the previous
substitute if completely matching record does not exist. If it is undef, `Villa::JFORWARD'
is specified.
If successful, the return value is true, else, it is false. False is returned if there is
no record corresponding the condition.
</dd>
</dl>
<dl>
<dt><kbd>$str = $villa->curkey();</kbd></dt>
<dd>
Method: Get the key of the record where the cursor is.
If successful, the return value is a scalar of the key of the corresponding record, else, it
is undef. undef is returned when no record corresponds to the cursor.
</dd>
</dl>
<dl>
<dt><kbd>$str = $villa->curval();</kbd></dt>
<dd>
Method: Get the value of the record where the cursor is.
If successful, the return value is a scalar of the value of the corresponding record, else, it
is undef. undef is returned when no record corresponds to the cursor.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curput($val, $cpmode);</kbd></dt>
<dd>
Method: Insert a record around the cursor.
`$val' specifies a value. If it is undef, this method has no effect.
`$cpmode' specifies detail adjustment: `Villa::CPCURRENT', which means that the value of the
current record is overwritten, `Villa::CPBEFORE', which means that a new record is inserted
before the current record, `Villa::CPAFTER', which means that a new record is inserted after
the current record. If it is undef, `Villa::CPCURRENT' is specified.
If successful, the return value is true, else, it is false. False is returned when no record
corresponds to the cursor.
After insertion, the cursor is moved to the inserted record.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->curout();</kbd></dt>
<dd>
Method: Delete the record where the cursor is.
If successful, the return value is true, else, it is false. False is returned when no record
corresponds to the cursor.
After deletion, the cursor is moved to the next record if possible.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->settuning($lrecmax, $nidxmax, $lcnum, $ncnum);</kbd></dt>
<dd>
Method: Set alignment of the database handle.
`$lrecmax' specifies the max number of records in a leaf node of B+ tree. If it is undef or
not more than 0, the default value is specified.
`$nidxmax' specifies the max number of indexes in a non-leaf node of B+ tree. If it is undef
or not more than 0, the default value is specified.
`$lcnum' specifies the max number of caching leaf nodes. If it is undef or not more than 0,
the default value is specified.
`$ncnum' specifies the max number of caching non-leaf nodes. If it is undef or not more than
0, the default value is specified.
If successful, the return value is true, else, it is false.
The default setting is equivalent to `vlsettuning(49, 192, 1024, 512)'. Because tuning
parameters are not saved in a database, you should specify them every opening a database.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->sync();</kbd></dt>
<dd>
Method: Synchronize updating contents with the file and the device.
If successful, the return value is true, else, it is false.
This method is useful when another process uses the connected database file. This method
should not be used while the transaction is activated.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->optimize();</kbd></dt>
<dd>
Method: Optimize the database.
If successful, the return value is true, else, it is false.
In an alternating succession of deleting and storing with overwrite or concatenate,
dispensable regions accumulate. This method is useful to do away with them. This method
should not be used while the transaction is activated.
</dd>
</dl>
<dl>
<dt><kbd>$num = $villa->fsiz();</kbd></dt>
<dd>
Method: Get the size of the database file.
If successful, the return value is the size of the database file, else, it is -1.
Because of the I/O buffer, the return value may be less than the real size.
</dd>
</dl>
<dl>
<dt><kbd>$num = $villa->rnum();</kbd></dt>
<dd>
Method: Get the number of the records stored in the database.
If successful, the return value is the number of the records stored in the database, else,
it is -1.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->writable();</kbd></dt>
<dd>
Method: Check whether the database handle is a writer or not.
The return value is true if the handle is a writer, false if not.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->fatalerror();</kbd></dt>
<dd>
Method: Check whether the database has a fatal error or not.
The return value is true if the database has a fatal error, false if not.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->tranbegin();</kbd></dt>
<dd>
Method: Begin the transaction.
If successful, the return value is true, else, it is false.
Only one transaction can be activated with a database handle at the same time.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->trancommit();</kbd></dt>
<dd>
Method: Commit the transaction.
If successful, the return value is true, else, it is false.
Updating a database in the transaction is fixed when it is committed successfully.
</dd>
</dl>
<dl>
<dt><kbd>$bool = $villa->tranabort();</kbd></dt>
<dd>
Method: Abort the transaction.
If successful, the return value is true, else, it is false.
Updating a database in the transaction is discarded when it is aborted. The state of the
database is rollbacked to before transaction.
</dd>
</dl>
<dl>
<dt><em>Called automatically by the garbage collector.</em></dt>
<dd>
Destructor: DESTROY: Release the resources.
If the database handle is not closed yet, it is closed.
</dd>
</dl>
<dl>
<dt><kbd>$villa = tie(%hash, "Villa", $name, $omode, $cmp);</kbd></dt>
<dd>
Tying Function: TIEHASH: Get the database handle.
</dd>
</dl>
<dl>
<dt><kbd>$bool = ($hash{$key} = $val);</kbd></dt>
<dd>
Tying Function: STORE: Store a record with overwrite.
</dd>
</dl>
<dl>
<dt><kbd>$bool = delete($hash{$key});</kbd></dt>
<dd>
Tying Function: DELETE: Delete a record.
</dd>
</dl>
<dl>
<dt><kbd>$bool = (%hash = ());</kbd></dt>
<dd>
Tying Function: CLEAR: Delete all records.
</dd>
</dl>
<dl>
<dt><kbd>$str = $hash{$key};</kbd></dt>
<dd>
Tying Function: FETCH: Retrieve whole value of a record.
</dd>
</dl>
<dl>
<dt><kbd>$bool = exists($hash{$val});</kbd></dt>
<dd>
Tying Function: EXISTS: Check whether a record exists or not.
</dd>
</dl>
<dl>
<dt><em>Called automatically by keys(), each(), and so on.</em></dt>
<dd>
Tying Function: FIRSTKEY: Get the first key.
</dd>
</dl>
<dl>
<dt><em>Called automatically by keys(), each(), and so on.</em></dt>
<dd>
Tying Function: NEXTKEY: Get the next key.
</dd>
</dl>
<dl>
<dt><kbd>$func = $villa->filter_store_key(\&nf);</kbd></dt>
<dd>
Method: set a filter invoked when writing a key.
`\&nf' specifies the reference of a filter function proofing `$_'. If it is undef, the
current filter function is cleared.
The return value is the old filter function.
</dd>
</dl>
<dl>
<dt><kbd>$func = $villa->filter_store_value(\&nf);</kbd></dt>
<dd>
Method: set a filter invoked when writing a value.
`\&nf' specifies the reference of a filter function proofing `$_'. If it is undef, the
current filter function is cleared.
The return value is the old filter function.
</dd>
</dl>
<dl>
<dt><kbd>$func = $villa->filter_fetch_key(\&nf);</kbd></dt>
<dd>
Method: set a filter invoked when reading a key.
`\&nf' specifies the reference of a filter function proofing `$_'. If it is undef, the
current filter function is cleared.
The return value is the old filter function.
</dd>
</dl>
<dl>
<dt><kbd>$func = $villa->filter_fetch_value(\&nf);</kbd></dt>
<dd>
Method: set a filter invoked when reading a value.
`\&nf' specifies the reference of a filter function proofing `$_'. If it is undef, the
current filter function is cleared.
The return value is the old filter function.
</dd>
</dl>
<hr />
<div class="note">Generated by mypldoc, 2010/08/05.</div>
</body>
</html>
|