ruby-qdbm 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +13 -0
- data/README.md +37 -0
- data/Rakefile +65 -0
- data/ext/curia/MANIFEST +5 -0
- data/ext/curia/extconf.rb +18 -0
- data/ext/curia/mod_curia.c +491 -0
- data/ext/depot/MANIFEST +5 -0
- data/ext/depot/extconf.rb +18 -0
- data/ext/depot/mod_depot.c +488 -0
- data/ext/villa/MANIFEST +5 -0
- data/ext/villa/extconf.rb +18 -0
- data/ext/villa/mod_villa.c +704 -0
- data/lib/curia.rb +598 -0
- data/lib/depot.rb +594 -0
- data/lib/villa.rb +816 -0
- data/myrbdoc +194 -0
- data/overview +6 -0
- data/rbapidoc/curia.rb.html +430 -0
- data/rbapidoc/depot.rb.html +426 -0
- data/rbapidoc/index.html +46 -0
- data/rbapidoc/villa.rb.html +551 -0
- data/rbspex-ja.html +284 -0
- data/rbspex.html +284 -0
- data/ruby-qdbm.gemspec +36 -0
- metadata +114 -0
@@ -0,0 +1,551 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<meta http-equiv="Content-Style-Type" content="text/css" />
|
7
|
+
<link rel="contents" href="./" />
|
8
|
+
<link rev="made" href="mailto:mikio@fallabs.com" />
|
9
|
+
<title>villa (QDBM for Ruby)</title>
|
10
|
+
<style type="text/css">html { margin: 0em 0em; padding 0em 0em; background: #eeeeee none; }
|
11
|
+
body { background-color: #eeeeee; color: #111111; padding: 1.5em 2em; margin: 0em 0em;
|
12
|
+
border-left: double 3.0em #eedddd; border-right: solid 1.0em #eedddd;
|
13
|
+
font-style: normal; font-weight: normal; font-family: serif; }
|
14
|
+
h1 { margin-top: 0.8em; margin-bottom: 1.3em; font-weight: bold; font-family: sans-serif; }
|
15
|
+
h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold; font-family: sans-serif; }
|
16
|
+
h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; font-family: sans-serif; }
|
17
|
+
p,ul,ol,dl { line-height: 140%; }
|
18
|
+
em { color: #111111; font-style: italic; font-weight: normal; font-family: serif; }
|
19
|
+
kbd { color: #111111; font-style: normal; font-weight: bold; font-family: monospace; }
|
20
|
+
a { color: #0022aa; text-decoration: none; }
|
21
|
+
a:hover { color: #0033ee; text-decoration: underline; }
|
22
|
+
a.head { color: #111111; text-decoration: none; }
|
23
|
+
.note { text-align: right; }
|
24
|
+
</style>
|
25
|
+
</head>
|
26
|
+
<body>
|
27
|
+
<div class="note">[<a href="index.html">Back</a>]</div>
|
28
|
+
<h1>API of villa</h1>
|
29
|
+
<hr />
|
30
|
+
<dl>
|
31
|
+
<dt><kbd>require 'villa'</kbd></dt>
|
32
|
+
<dd>
|
33
|
+
The library `villa' should be included in application codes.
|
34
|
+
An instance of the class `Villa' is used as a database handle.
|
35
|
+
`Villa' performs Mix-in of `Enumerable'.
|
36
|
+
Each method of `Villa' throws an exception of `Villa::EANY' or its sub classes when an error
|
37
|
+
occurs: `Villa::ENOERR', `Villa::EFATAL', `Villa::EMODE', `Villa::EBROKEN', `Villa::EKEEP',
|
38
|
+
`Villa::ENOITEM', `Villa::EALLOC', `Villa::EMAP', `Villa::EOPEN', `Villa::ECLOSE',
|
39
|
+
`Villa::ETRUNC', `Villa::ESYNC', `Villa::ESTAT', `Villa::ESEEK', `Villa::EREAD',
|
40
|
+
`Villa::EWRITE', `Villa::ELOCK', `Villa::EUNLINK', `Villa::EMKDIR', `Villa::ERMDIR' and
|
41
|
+
`Villa::EMISC'.
|
42
|
+
</dd>
|
43
|
+
</dl>
|
44
|
+
<dl>
|
45
|
+
<dt><kbd>villa = Villa::new(name, omode, cmode)</kbd></dt>
|
46
|
+
<dd>
|
47
|
+
Constructor: Get a database handle.
|
48
|
+
`name' specifies the name of a database file.
|
49
|
+
`omode' specifies the connection mode: `Villa::OWRITER' as a writer, `Villa::OREADER' as a
|
50
|
+
reader. If the mode is `Villa::OWRITER', the following may be added by bitwise or:
|
51
|
+
`Villa::OCREAT', which means it creates a new database if not exist, `Villa::OTRUNC', which
|
52
|
+
means it creates a new database regardless if one exists, `Villa::OZCOMP', which means
|
53
|
+
leaves in the database are compressed with ZLIB, `Villa::OYCOMP', which means leaves in the
|
54
|
+
database are compressed with LZO, `Villa::OXCOMP', which means leaves in the database are
|
55
|
+
compressed with BZIP2. Both of `Villa::OREADER' and `Villa::OWRITER' can be added to by
|
56
|
+
bitwise or: `Villa::ONOLCK', which means it opens a database file without file locking, or
|
57
|
+
`Villa::OLCKNB', which means locking is performed without blocking. If it is omitted,
|
58
|
+
`Villa::OREADER' is specified.
|
59
|
+
`cmode' specifies the comparing function: `Villa::CMPLEX' comparing keys in lexical order,
|
60
|
+
`Villa::CMPDEC' comparing keys as decimal strings, `Villa::CMPOBJ' comparing keys as
|
61
|
+
serialized objects implementing the method `<=>'. The comparing function should be kept
|
62
|
+
same in the life of a database. If `Villa::CMPOBJ' is used, such methods as `put', `out',
|
63
|
+
`get' and so on can treat not only instances of `String' but also any serializable and
|
64
|
+
comparable object.
|
65
|
+
If so, objects being stored are serialized and objects being retrieved are deserialized.
|
66
|
+
The return value is the database handle.
|
67
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
68
|
+
If a block parameter is given, this method works as an iterator. A database handle is
|
69
|
+
opened and passed via the first argument of the block. The database handle is surely
|
70
|
+
closed when the block is over.
|
71
|
+
While connecting as a writer, an exclusive lock is invoked to the database file.
|
72
|
+
While connecting as a reader, a shared lock is invoked to the database file. The thread
|
73
|
+
blocks until the lock is achieved. `Villa::OZCOMP', `Villa::OYCOMP', and `Villa::OXCOMP'
|
74
|
+
are available only if QDBM was built each with ZLIB, LZO, and BZIP2 enabled. If
|
75
|
+
`Villa::ONOLCK' is used, the application is responsible for exclusion control.
|
76
|
+
</dd>
|
77
|
+
</dl>
|
78
|
+
<dl>
|
79
|
+
<dt><kbd>villa = Villa::open(name, omode, cmode)</kbd></dt>
|
80
|
+
<dd>
|
81
|
+
Constructor: An alias of `new'.
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
<dl>
|
85
|
+
<dt><kbd>bool = villa.close()</kbd></dt>
|
86
|
+
<dd>
|
87
|
+
Method: Close the database handle.
|
88
|
+
The return value is always true.
|
89
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
90
|
+
Because the region of a closed handle is released, it becomes impossible to use the handle.
|
91
|
+
Updating a database is assured to be written when the handle is closed. If a writer opens
|
92
|
+
a database but does not close it appropriately, the database will be broken. If the
|
93
|
+
transaction is activated and not committed, it is aborted.
|
94
|
+
</dd>
|
95
|
+
</dl>
|
96
|
+
<dl>
|
97
|
+
<dt><kbd>villa.silent = bool</kbd></dt>
|
98
|
+
<dd>
|
99
|
+
Method: Set the flag whether to repress frequent exceptions.
|
100
|
+
The return value is the assigned value.
|
101
|
+
</dd>
|
102
|
+
</dl>
|
103
|
+
<dl>
|
104
|
+
<dt><kbd>bool = villa.put(key, val, dmode)</kbd></dt>
|
105
|
+
<dd>
|
106
|
+
Method: Store a record.
|
107
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
108
|
+
`val' specifies a value. Although it must be an instance of String, binary data is okey.
|
109
|
+
`dmode' specifies behavior when the key overlaps, by the following values: `Villa::DOVER',
|
110
|
+
which means the specified value overwrites the existing one, `Villa::DKEEP', which means the
|
111
|
+
existing value is kept, `Villa::DCAT', which means the specified value is concatenated at the
|
112
|
+
end of the existing value, `Villa::DDUP', which means duplication of keys is allowed and the
|
113
|
+
specified value is added as the last one, `Villa::DDUPR', which means duplication of keys is
|
114
|
+
allowed and the specified value is added as the first one. If it is omitted, `Villa::DOVER'
|
115
|
+
is specified.
|
116
|
+
The return value is always true. However, if the silent flag is true and replace is
|
117
|
+
cancelled, false is returned instead of exception.
|
118
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or replace
|
119
|
+
is cancelled.
|
120
|
+
The cursor becomes unavailable due to updating database.
|
121
|
+
</dd>
|
122
|
+
</dl>
|
123
|
+
<dl>
|
124
|
+
<dt><kbd>bool = villa.store(key, val)</kbd></dt>
|
125
|
+
<dd>
|
126
|
+
Method: An alias of `put'.
|
127
|
+
</dd>
|
128
|
+
</dl>
|
129
|
+
<dl>
|
130
|
+
<dt><kbd>villa[key] = val</kbd></dt>
|
131
|
+
<dd>
|
132
|
+
Method: An alias of `put'.
|
133
|
+
</dd>
|
134
|
+
</dl>
|
135
|
+
<dl>
|
136
|
+
<dt><kbd>bool = villa.out(key)</kbd></dt>
|
137
|
+
<dd>
|
138
|
+
Method: Delete a record.
|
139
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
140
|
+
The return value is always true. However, if the silent flag is true and no record
|
141
|
+
corresponds, false is returned instead of exception.
|
142
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
143
|
+
corresponds.
|
144
|
+
When the key of duplicated records is specified, the value of the first record of the same
|
145
|
+
key is selected. The cursor becomes unavailable due to updating database.
|
146
|
+
</dd>
|
147
|
+
</dl>
|
148
|
+
<dl>
|
149
|
+
<dt><kbd>bool = villa.delete(key)</kbd></dt>
|
150
|
+
<dd>
|
151
|
+
Method: An alias of `out'.
|
152
|
+
</dd>
|
153
|
+
</dl>
|
154
|
+
<dl>
|
155
|
+
<dt><kbd>bool = villa.clear()</kbd></dt>
|
156
|
+
<dd>
|
157
|
+
Method: Delete all records.
|
158
|
+
The return value is always true.
|
159
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
160
|
+
</dd>
|
161
|
+
</dl>
|
162
|
+
<dl>
|
163
|
+
<dt><kbd>str = villa.get(key)</kbd></dt>
|
164
|
+
<dd>
|
165
|
+
Method: Retrieve a record.
|
166
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
167
|
+
The return value is an instance of the value of the corresponding record. If the silent flag
|
168
|
+
is true and no record corresponds, nil is returned instead of exception.
|
169
|
+
When the key of duplicated records is specified, the first record of the same key is
|
170
|
+
deleted.
|
171
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
172
|
+
corresponds.
|
173
|
+
</dd>
|
174
|
+
</dl>
|
175
|
+
<dl>
|
176
|
+
<dt><kbd>str = villa.fetch(key, defval)</kbd></dt>
|
177
|
+
<dd>
|
178
|
+
Method: Retrieve a record.
|
179
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
180
|
+
`defval' specifies the default value used when no record corresponds. If it is omitted, nil
|
181
|
+
is specified.
|
182
|
+
The return value is an instance of the value of the corresponding record, or the default
|
183
|
+
value if no record corresponds.
|
184
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
185
|
+
</dd>
|
186
|
+
</dl>
|
187
|
+
<dl>
|
188
|
+
<dt><kbd>str = villa[key]</kbd></dt>
|
189
|
+
<dd>
|
190
|
+
Method: An alias of `fetch'.
|
191
|
+
</dd>
|
192
|
+
</dl>
|
193
|
+
<dl>
|
194
|
+
<dt><kbd>num = villa.vsiz(key)</kbd></dt>
|
195
|
+
<dd>
|
196
|
+
Method: Get the size of the value of a record.
|
197
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
198
|
+
The return value is the size of the value of the corresponding record. If the silent flag
|
199
|
+
is true and no record corresponds, -1 is returned instead of exception. If multiple records
|
200
|
+
correspond, the size of the first is returned.
|
201
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
202
|
+
</dd>
|
203
|
+
</dl>
|
204
|
+
<dl>
|
205
|
+
<dt><kbd>num = villa.vnum(key)</kbd></dt>
|
206
|
+
<dd>
|
207
|
+
Method: Get the number of records corresponding a key.
|
208
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
209
|
+
The return value is the size of the value of the corresponding record. If no record
|
210
|
+
corresponds, 0 is returned.
|
211
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
212
|
+
</dd>
|
213
|
+
</dl>
|
214
|
+
<dl>
|
215
|
+
<dt><kbd>bool = villa.curfirst()</kbd></dt>
|
216
|
+
<dd>
|
217
|
+
Method: Move the cursor to the first record.
|
218
|
+
The return value is always true. However, if the silent flag is true and no record
|
219
|
+
corresponds, false is returned instead of exception.
|
220
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or there is
|
221
|
+
no record in the database.
|
222
|
+
</dd>
|
223
|
+
</dl>
|
224
|
+
<dl>
|
225
|
+
<dt><kbd>bool = villa.curlast()</kbd></dt>
|
226
|
+
<dd>
|
227
|
+
Method: Move the cursor to the last record.
|
228
|
+
The return value is always true. However, if the silent flag is true and no record
|
229
|
+
corresponds, false is returned instead of exception.
|
230
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or there is
|
231
|
+
no record in the database.
|
232
|
+
</dd>
|
233
|
+
</dl>
|
234
|
+
<dl>
|
235
|
+
<dt><kbd>bool = villa.curprev()</kbd></dt>
|
236
|
+
<dd>
|
237
|
+
Method: Move the cursor to the previous record.
|
238
|
+
The return value is always true. However, if the silent flag is true and no record
|
239
|
+
corresponds, false is returned instead of exception.
|
240
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or there is
|
241
|
+
no previous record.
|
242
|
+
</dd>
|
243
|
+
</dl>
|
244
|
+
<dl>
|
245
|
+
<dt><kbd>bool = villa.curnext()</kbd></dt>
|
246
|
+
<dd>
|
247
|
+
Method: Move the cursor to the next record.
|
248
|
+
The return value is always true. However, if the silent flag is true and no record
|
249
|
+
corresponds, false is returned instead of exception.
|
250
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or there is
|
251
|
+
no next record.
|
252
|
+
</dd>
|
253
|
+
</dl>
|
254
|
+
<dl>
|
255
|
+
<dt><kbd>bool = villa.curjump(key, jmode)</kbd></dt>
|
256
|
+
<dd>
|
257
|
+
Method: Move the cursor to a position around a record.
|
258
|
+
`key' specifies a key. Although it must be an instance of String, binary data is okey.
|
259
|
+
`jmode' specifies detail adjustment: `Villa::JFORWARD', which means that the cursor is set
|
260
|
+
to the first record of the same key and that the cursor is set to the next substitute if
|
261
|
+
completely matching record does not exist, `Villa::JBACKWARD', which means that the cursor
|
262
|
+
is set to the last record of the same key and that the cursor is set to the previous
|
263
|
+
substitute if completely matching record does not exist. If it is omitted, `Villa::JFORWARD'
|
264
|
+
is specified.
|
265
|
+
The return value is always true. However, if the silent flag is true and no record
|
266
|
+
corresponds, false is returned instead of exception.
|
267
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or there is
|
268
|
+
no record corresponding the condition.
|
269
|
+
</dd>
|
270
|
+
</dl>
|
271
|
+
<dl>
|
272
|
+
<dt><kbd>str = villa.curkey()</kbd></dt>
|
273
|
+
<dd>
|
274
|
+
Method: Get the key of the record where the cursor is.
|
275
|
+
The return value is the key of the corresponding record. If the silent flag is true and no
|
276
|
+
record corresponds, nil is returned instead of exception.
|
277
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
278
|
+
corresponds to the cursor.
|
279
|
+
</dd>
|
280
|
+
</dl>
|
281
|
+
<dl>
|
282
|
+
<dt><kbd>str = villa.curval()</kbd></dt>
|
283
|
+
<dd>
|
284
|
+
Method: Get the value of the record where the cursor is.
|
285
|
+
The return value is the value of the corresponding record. If the silent flag is true and no
|
286
|
+
record corresponds, nil is returned instead of exception.
|
287
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
288
|
+
corresponds to the cursor.
|
289
|
+
</dd>
|
290
|
+
</dl>
|
291
|
+
<dl>
|
292
|
+
<dt><kbd>bool = villa.curput(val, cpmode);</kbd></dt>
|
293
|
+
<dd>
|
294
|
+
Method: Insert a record around the cursor.
|
295
|
+
`val' specifies a value. Although it must be an instance of String, binary data is okey.
|
296
|
+
`cpmode' specifies detail adjustment: `Villa::CPCURRENT', which means that the value of the
|
297
|
+
current record is overwritten, `Villa::CPBEFORE', which means that a new record is inserted
|
298
|
+
before the current record, `Villa::CPAFTER', which means that a new record is inserted after
|
299
|
+
the current record. If it is omitted, `Villa::CPCURRENT' is specified.
|
300
|
+
The return value is always true. However, if the silent flag is true and no record
|
301
|
+
corresponds to the cursor, false is returned instead of exception.
|
302
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
303
|
+
corresponds to the cursor.
|
304
|
+
After insertion, the cursor is moved to the inserted record.
|
305
|
+
</dd>
|
306
|
+
</dl>
|
307
|
+
<dl>
|
308
|
+
<dt><kbd>bool = villa.curout();</kbd></dt>
|
309
|
+
<dd>
|
310
|
+
Method: Delete the record where the cursor is.
|
311
|
+
The return value is always true. However, if the silent flag is true and no record
|
312
|
+
corresponds to the cursor, false is returned instead of exception.
|
313
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
314
|
+
corresponds to the cursor.
|
315
|
+
After deletion, the cursor is moved to the next record if possible.
|
316
|
+
</dd>
|
317
|
+
</dl>
|
318
|
+
<dl>
|
319
|
+
<dt><kbd>bool = villa.settuning(lrecmax, nidxmax, lcnum, ncnum)</kbd></dt>
|
320
|
+
<dd>
|
321
|
+
Method: Set the tuning parameters for performance.
|
322
|
+
`lrecmax' specifies the max number of records in a leaf node of B+ tree. If it is not more
|
323
|
+
than 0, the default value is specified.
|
324
|
+
`nidxmax' specifies the max number of indexes in a non-leaf node of B+ tree. If it is not
|
325
|
+
more than 0, the default value is specified.
|
326
|
+
`lcnum' specifies the max number of caching leaf nodes. If it is not more than 0, the
|
327
|
+
default value is specified.
|
328
|
+
`ncnum' specifies the max number of caching non-leaf nodes. If it is not more than 0, the
|
329
|
+
default value is specified.
|
330
|
+
The return value is always true.
|
331
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
332
|
+
The default setting is equivalent to `vlsettuning(49, 192, 1024, 512)'. Because tuning
|
333
|
+
parameters are not saved in a database, you should specify them every opening a database.
|
334
|
+
</dd>
|
335
|
+
</dl>
|
336
|
+
<dl>
|
337
|
+
<dt><kbd>bool = villa.sync()</kbd></dt>
|
338
|
+
<dd>
|
339
|
+
Method: Synchronize updating contents with the file and the device.
|
340
|
+
The return value is always true.
|
341
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
342
|
+
This method is useful when another process uses the connected database file. This method
|
343
|
+
should not be used while the transaction is activated.
|
344
|
+
</dd>
|
345
|
+
</dl>
|
346
|
+
<dl>
|
347
|
+
<dt><kbd>bool = villa.optimize()</kbd></dt>
|
348
|
+
<dd>
|
349
|
+
Method: Optimize the database.
|
350
|
+
The return value is always true.
|
351
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
352
|
+
In an alternating succession of deleting and storing with overwrite or concatenate,
|
353
|
+
dispensable regions accumulate. This method is useful to do away with them. This method
|
354
|
+
should not be used while the transaction is activated.
|
355
|
+
</dd>
|
356
|
+
</dl>
|
357
|
+
<dl>
|
358
|
+
<dt><kbd>num = villa.fsiz()</kbd></dt>
|
359
|
+
<dd>
|
360
|
+
Method: Get the size of the database file.
|
361
|
+
The return value is the size of the database file.
|
362
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
363
|
+
Because of the I/O buffer, the return value may be less than the real size.
|
364
|
+
</dd>
|
365
|
+
</dl>
|
366
|
+
<dl>
|
367
|
+
<dt><kbd>num = villa.rnum()</kbd></dt>
|
368
|
+
<dd>
|
369
|
+
Method: Get the number of the records stored in the database.
|
370
|
+
The return value is the number of the records stored in the database.
|
371
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
372
|
+
</dd>
|
373
|
+
</dl>
|
374
|
+
<dl>
|
375
|
+
<dt><kbd>num = villa.length()</kbd></dt>
|
376
|
+
<dd>
|
377
|
+
Method: An alias of `rnum'.
|
378
|
+
</dd>
|
379
|
+
</dl>
|
380
|
+
<dl>
|
381
|
+
<dt><kbd>num = villa.size()</kbd></dt>
|
382
|
+
<dd>
|
383
|
+
Method: An alias of `rnum'.
|
384
|
+
</dd>
|
385
|
+
</dl>
|
386
|
+
<dl>
|
387
|
+
<dt><kbd>bool = villa.writable()</kbd></dt>
|
388
|
+
<dd>
|
389
|
+
Method: Check whether the database handle is a writer or not.
|
390
|
+
The return value is true if the handle is a writer, false if not.
|
391
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
392
|
+
</dd>
|
393
|
+
</dl>
|
394
|
+
<dl>
|
395
|
+
<dt><kbd>bool = villa.fatalerror()</kbd></dt>
|
396
|
+
<dd>
|
397
|
+
Method: Check whether the database has a fatal error or not.
|
398
|
+
The return value is true if the database has a fatal error, false if not.
|
399
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
400
|
+
</dd>
|
401
|
+
</dl>
|
402
|
+
<dl>
|
403
|
+
<dt><kbd>bool = villa.tranbegin()</kbd></dt>
|
404
|
+
<dd>
|
405
|
+
Method: Begin the transaction.
|
406
|
+
The return value is always true.
|
407
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
408
|
+
If a thread is already in the transaction, the other threads block until the prius is out
|
409
|
+
of the transaction. Only one transaction can be activated with a database handle at the
|
410
|
+
same time.
|
411
|
+
</dd>
|
412
|
+
</dl>
|
413
|
+
<dl>
|
414
|
+
<dt><kbd>bool = villa.trancommit()</kbd></dt>
|
415
|
+
<dd>
|
416
|
+
Method: Commit the transaction.
|
417
|
+
The return value is always true.
|
418
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
419
|
+
Updating a database in the transaction is fixed when it is committed successfully. Any
|
420
|
+
other thread except for the one which began the transaction should not call this method.
|
421
|
+
</dd>
|
422
|
+
</dl>
|
423
|
+
<dl>
|
424
|
+
<dt><kbd>bool = villa.tranabort()</kbd></dt>
|
425
|
+
<dd>
|
426
|
+
Method: Abort the transaction.
|
427
|
+
The return value is always true.
|
428
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
429
|
+
Updating a database in the transaction is discarded when it is aborted. The state of the
|
430
|
+
database is rollbacked to before transaction. Any other thread except for the one which
|
431
|
+
began the transaction should not call this method.
|
432
|
+
</dd>
|
433
|
+
</dl>
|
434
|
+
<dl>
|
435
|
+
<dt><kbd>villa.transaction() do ... end</kbd></dt>
|
436
|
+
<dd>
|
437
|
+
Iterator Method: Perform an iterator block in the transaction.
|
438
|
+
The specified iterator block is performed in the transaction. If the block returns true,
|
439
|
+
the transaction is committed. If the block returns false or raises any exception, the
|
440
|
+
transaction is aborted.
|
441
|
+
</dd>
|
442
|
+
</dl>
|
443
|
+
<dl>
|
444
|
+
<dt><kbd>villa.each() do |key, val| ... end</kbd></dt>
|
445
|
+
<dd>
|
446
|
+
Iterator Method: Iterate a process with a pair of a key and a value of each record.
|
447
|
+
</dd>
|
448
|
+
</dl>
|
449
|
+
<dl>
|
450
|
+
<dt><kbd>villa.each_pair() do |key, val| ... end</kbd></dt>
|
451
|
+
<dd>
|
452
|
+
Iterator Method: An alias of `each'.
|
453
|
+
</dd>
|
454
|
+
</dl>
|
455
|
+
<dl>
|
456
|
+
<dt><kbd>villa.each_key() do |key| ... end</kbd></dt>
|
457
|
+
<dd>
|
458
|
+
Iterator Method: Iterate a process with a key of each record.
|
459
|
+
</dd>
|
460
|
+
</dl>
|
461
|
+
<dl>
|
462
|
+
<dt><kbd>villa.each_value() do |val| ... end</kbd></dt>
|
463
|
+
<dd>
|
464
|
+
Iterator Method: Iterate a process with a value of each record.
|
465
|
+
</dd>
|
466
|
+
</dl>
|
467
|
+
<dl>
|
468
|
+
<dt><kbd>ary = villa.keys()</kbd></dt>
|
469
|
+
<dd>
|
470
|
+
Method: Get an array of all keys.
|
471
|
+
The return value is an array of all keys.
|
472
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
473
|
+
</dd>
|
474
|
+
</dl>
|
475
|
+
<dl>
|
476
|
+
<dt><kbd>ary = villa.values()</kbd></dt>
|
477
|
+
<dd>
|
478
|
+
Method: Get an array of all values.
|
479
|
+
The return value is an array of all values.
|
480
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs.
|
481
|
+
</dd>
|
482
|
+
</dl>
|
483
|
+
<dl>
|
484
|
+
<dt><kbd>str = villa.index(val)</kbd></dt>
|
485
|
+
<dd>
|
486
|
+
Method: Retrieve a record with a value.
|
487
|
+
`val' specifies a value. Although it must be an instance of String, binary data is okey.
|
488
|
+
The return value is the key of the record with the specified value.
|
489
|
+
An exception of `Villa::EANY' or its sub classes is thrown if an error occurs or no record
|
490
|
+
corresponds.
|
491
|
+
If two or more records correspond, the first found record is selected.
|
492
|
+
</dd>
|
493
|
+
</dl>
|
494
|
+
<dl>
|
495
|
+
<dt><kbd>num = villa.to_int()</kbd></dt>
|
496
|
+
<dd>
|
497
|
+
Method: An alias of `rnum'.
|
498
|
+
</dd>
|
499
|
+
</dl>
|
500
|
+
<dl>
|
501
|
+
<dt><kbd>num = villa.to_i()</kbd></dt>
|
502
|
+
<dd>
|
503
|
+
Method: An alias of `to_int'.
|
504
|
+
</dd>
|
505
|
+
</dl>
|
506
|
+
<dl>
|
507
|
+
<dt><kbd>str = villa.to_str()</kbd></dt>
|
508
|
+
<dd>
|
509
|
+
Method: Get string standing for the instance.
|
510
|
+
</dd>
|
511
|
+
</dl>
|
512
|
+
<dl>
|
513
|
+
<dt><kbd>str = villa.to_s()</kbd></dt>
|
514
|
+
<dd>
|
515
|
+
Method: An alias of `to_str'.
|
516
|
+
</dd>
|
517
|
+
</dl>
|
518
|
+
<dl>
|
519
|
+
<dt><kbd>ary = villa.to_ary()</kbd></dt>
|
520
|
+
<dd>
|
521
|
+
Method: Get an array of alternation of each pair of a key and a value.
|
522
|
+
</dd>
|
523
|
+
</dl>
|
524
|
+
<dl>
|
525
|
+
<dt><kbd>ary = villa.to_a()</kbd></dt>
|
526
|
+
<dd>
|
527
|
+
Method: An alias of `to_ary'.
|
528
|
+
</dd>
|
529
|
+
</dl>
|
530
|
+
<dl>
|
531
|
+
<dt><kbd>hash = villa.to_hash()</kbd></dt>
|
532
|
+
<dd>
|
533
|
+
Method: Get a hash storing all records.
|
534
|
+
</dd>
|
535
|
+
</dl>
|
536
|
+
<dl>
|
537
|
+
<dt><kbd>hash = villa.to_h()</kbd></dt>
|
538
|
+
<dd>
|
539
|
+
Method: An alias of `to_hash'.
|
540
|
+
</dd>
|
541
|
+
</dl>
|
542
|
+
<dl>
|
543
|
+
<dt><kbd>str = villa.inspect()</kbd></dt>
|
544
|
+
<dd>
|
545
|
+
Method: An alias of `to_str'.
|
546
|
+
</dd>
|
547
|
+
</dl>
|
548
|
+
<hr />
|
549
|
+
<div class="note">Generated by ./myrbdoc, 2010/08/05.</div>
|
550
|
+
</body>
|
551
|
+
</html>
|