ruby-qdbm 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/myrbdoc ADDED
@@ -0,0 +1,194 @@
1
+ #! /usr/bin/ruby -w
2
+
3
+ #================================================================
4
+ # myrbdoc
5
+ # Document generator for Ruby sources
6
+ #================================================================
7
+
8
+
9
+ # main routine
10
+ def main
11
+ files = []
12
+ err = false
13
+ destdir = nil
14
+ ptitle = "Ruby API"
15
+ afile = nil
16
+ i = 0
17
+ while(i < ARGV.length)
18
+ if(files.length < 1 && ARGV[i] =~ /^-/)
19
+ if(ARGV[i] == "-d")
20
+ destdir = ARGV[i+=1]
21
+ elsif(ARGV[i] == "-t")
22
+ ptitle = ARGV[i+=1]
23
+ elsif(ARGV[i] == "-a")
24
+ afile = ARGV[i+=1]
25
+ else
26
+ usage()
27
+ end
28
+ else
29
+ files.push(ARGV[i])
30
+ end
31
+ i += 1
32
+ end
33
+ (files.length > 0) || usage()
34
+ (destdir) || (destdir = ".")
35
+ (File::directory?(destdir)) || Dir::mkdir(destdir)
36
+ files.each() do |file|
37
+ makedoc(destdir, ptitle, file)
38
+ end
39
+ makeindex(destdir, ptitle, afile, files)
40
+ return 0
41
+ end
42
+
43
+
44
+ # print the usage and exit
45
+ def usage
46
+ printf(STDERR, "%s: usage: %s: [-d dir] [-t str] [-a file] file ...\n", $0, $0)
47
+ exit(1)
48
+ end
49
+
50
+
51
+ # generate a document
52
+ def makedoc(destdir, ptitle, name)
53
+ source = name.gsub(/.*\//, "")
54
+ dest = sprintf("%s/%s.html", destdir, source)
55
+ File::open(name, "r") do |infile|
56
+ File::open(dest, "w") do |outfile|
57
+ writehead(outfile, ptitle, source)
58
+ while(line = infile.gets())
59
+ line.chomp!()
60
+ line.gsub!(/^ */, "")
61
+ if(line =~ /^\x23\x23/)
62
+ group = Array::new()
63
+ while(line = infile.gets())
64
+ line.chomp!()
65
+ line.gsub!(/^ */, "")
66
+ (line =~ /^\x23[^@]/) || break
67
+ (line.length() > 1) || next
68
+ group.push(line)
69
+ end
70
+ if(group.length() > 1)
71
+ printf(outfile, "<dl>\n")
72
+ kbd = group[0] =~ /^\x23:/
73
+ group.each() do |elem|
74
+ elem.gsub!(/^\x23[ :]*/, "")
75
+ elem.gsub!(/&/, "&amp;")
76
+ elem.gsub!(/</, "&lt;")
77
+ elem.gsub!(/>/, "&gt;")
78
+ elem.gsub!(/\x22/, "&quot;")
79
+ end
80
+ if(kbd)
81
+ printf(outfile, "<dt><em>%s</em></dt>\n", group[0])
82
+ else
83
+ printf(outfile, "<dt><kbd>%s</kbd></dt>\n", group[0])
84
+ end
85
+ group.shift()
86
+ if(group.length > 0)
87
+ printf(outfile, "<dd>\n")
88
+ group.each() do |elem|
89
+ printf(outfile, "%s\n", elem)
90
+ end
91
+ printf(outfile, "</dd>\n")
92
+ end
93
+ printf(outfile, "</dl>\n")
94
+ end
95
+ end
96
+ end
97
+ printf(outfile, "<hr />\n")
98
+ writetail(outfile)
99
+ end
100
+ end
101
+ end
102
+
103
+
104
+ # generate the index file
105
+ def makeindex(destdir, ptitle, afile, files)
106
+ dest = sprintf("%s/index.html", destdir)
107
+ File::open(dest, "w") do |outfile|
108
+ writehead(outfile, ptitle)
109
+ if(afile)
110
+ File::open(afile, "r") do |infile|
111
+ while(line = infile.gets())
112
+ line.chomp!()
113
+ printf(outfile, "%s\n", line)
114
+ end
115
+ end
116
+ printf(outfile, "<hr />\n")
117
+ end
118
+ printf(outfile, "<h2>API</h2>\n")
119
+ printf(outfile, "<ul>\n")
120
+ files.each() do |file|
121
+ file = file.gsub(/.*\//, "")
122
+ printf(outfile, "<li><a href=\"%s.html\">%s</a></li>\n", file, file.gsub(/\..*/, ""))
123
+ end
124
+ printf(outfile, "</ul>\n")
125
+ printf(outfile, "<hr />\n")
126
+ writetail(outfile)
127
+ end
128
+ end
129
+
130
+
131
+ # write header
132
+ def writehead(outfile, ptitle, name = nil)
133
+ if(name)
134
+ title = sprintf("%s (%s)", name.gsub(/\..*/, ""), ptitle)
135
+ head = sprintf("API of %s", name.gsub(/\..*/, ""))
136
+ navi = "<div class=\"note\">[<a href=\"index.html\">Back</a>]</div>"
137
+ else
138
+ title = sprintf("INDEX (%s)", ptitle)
139
+ head = ptitle
140
+ navi = "<div class=\"note\">Ruby Source Documents</div>"
141
+ end
142
+ printf(outfile, "%s", <<__MYEOF)
143
+ <?xml version="1.0" encoding="UTF-8"?>
144
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
145
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
146
+ <head>
147
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
148
+ <meta http-equiv="Content-Style-Type" content="text/css" />
149
+ <link rel="contents" href="./" />
150
+ <link rev="made" href="mailto:mikio\@fallabs.com" />
151
+ <title>#{title}</title>
152
+ <style type="text/css">html { margin: 0em 0em; padding 0em 0em; background: #eeeeee none; }
153
+ body { background-color: #eeeeee; color: #111111; padding: 1.5em 2em; margin: 0em 0em;
154
+ border-left: double 3.0em #eedddd; border-right: solid 1.0em #eedddd;
155
+ font-style: normal; font-weight: normal; font-family: serif; }
156
+ h1 { margin-top: 0.8em; margin-bottom: 1.3em; font-weight: bold; font-family: sans-serif; }
157
+ h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold; font-family: sans-serif; }
158
+ h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; font-family: sans-serif; }
159
+ p,ul,ol,dl { line-height: 140%; }
160
+ em { color: #111111; font-style: italic; font-weight: normal; font-family: serif; }
161
+ kbd { color: #111111; font-style: normal; font-weight: bold; font-family: monospace; }
162
+ a { color: #0022aa; text-decoration: none; }
163
+ a:hover { color: #0033ee; text-decoration: underline; }
164
+ a.head { color: #111111; text-decoration: none; }
165
+ .note { text-align: right; }
166
+ </style>
167
+ </head>
168
+ <body>
169
+ #{navi}
170
+ <h1>#{head}</h1>
171
+ <hr />
172
+ __MYEOF
173
+ end
174
+
175
+
176
+ # write tail
177
+ def writetail(outfile)
178
+ (sec, min, hour, mday, mon, year) = Time::now.to_a
179
+ datestr = sprintf("%04d/%02d/%02d", year, mon, mday)
180
+ printf(outfile, "%s", <<__MYEOF)
181
+ <div class="note">Generated by #{$0}, #{datestr}.</div>
182
+ </body>
183
+ </html>
184
+ __MYEOF
185
+ end
186
+
187
+
188
+ # execute main
189
+ #$0.gsub!(/.*\//, "")
190
+ exit(main())
191
+
192
+
193
+
194
+ # END OF FILE
data/overview ADDED
@@ -0,0 +1,6 @@
1
+ <h2>Overview</h2>
2
+ <p>QDBM is a library of routines for managing a database. The database is a simple data file containing records, each is a pair of a key and a value. Every key and value is serial bytes with variable length. Both binary data and character string can be used as a key and a value. There is neither concept of data tables nor data types. Records are organazed in hash table or B+ tree.</p>
3
+ <p>As for database of hash table, each key must be unique within a database, so it is impossible to store two or more records with a key overlaps. The following access methods are provided to the database: storing a record with a key and a value, deleting a record by a key, retrieving a record by a key. Moreover, traversal access to every key are provided, although the order is arbitrary. These access methods are similar to ones of DBM (or its followers, NDBM and GDBM) library defined in the UNIX standard. QDBM is an alternative for DBM because of its higher performance.</p>
4
+ <p>As for database of B+ tree, records whose keys are duplicated can be stored. Access methods of storing, deleting and retrieving are provided as with the database of hash table. Records are stored in order by a comparing function assigned by a user. It is possible to access each record with the cursor in ascending or descending order. According to this mechanism, forward matching search for strings and range search for integers are realized.</p>
5
+ <p>QDBM provides API for Ruby. This encapsulates the basic API, the extended API and the extended API of QDBM. A database handle can be used like an instance of `Hash'.</p>
6
+ <p>Refer to `<a href="http://fallabs.com/qdbm/">http://fallabs.com/qdbm/</a>' for more information.</p>
@@ -0,0 +1,430 @@
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>curia (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 curia</h1>
29
+ <hr />
30
+ <dl>
31
+ <dt><kbd>require 'curia'</kbd></dt>
32
+ <dd>
33
+ The library `curia' should be included in application codes.
34
+ An instance of the class `Curia' is used as a database handle.
35
+ `Curia' performs Mix-in of `Enumerable'.
36
+ Each method of `Curia' throws an exception of `Curia::EANY' or its sub classes when an error
37
+ occurs: `Curia::ENOERR', `Curia::EFATAL', `Curia::EMODE', `Curia::EBROKEN', `Curia::EKEEP',
38
+ `Curia::ENOITEM', `Curia::EALLOC', `Curia::EMAP', `Curia::EOPEN', `Curia::ECLOSE',
39
+ `Curia::ETRUNC', `Curia::ESYNC', `Curia::ESTAT', `Curia::ESEEK', `Curia::EREAD',
40
+ `Curia::EWRITE', `Curia::ELOCK', `Curia::EUNLINK', `Curia::EMKDIR', `Curia::ERMDIR' and
41
+ `Curia::EMISC'.
42
+ </dd>
43
+ </dl>
44
+ <dl>
45
+ <dt><kbd>curia = Curia::new(name, omode, bnum, dnum)</kbd></dt>
46
+ <dd>
47
+ Constructor: Get a database handle.
48
+ `name' specifies the name of a database directory.
49
+ `omode' specifies the connection mode: `Curia::OWRITER' as a writer, `Curia::OREADER' as a
50
+ reader. If the mode is `Curia::OWRITER', the following may be added by bitwise or:
51
+ `Curia::OCREAT', which means it creates a new database if not exist, `Curia::OTRUNC', which
52
+ means it creates a new database regardless if one exists. Both of `Curia::OREADER' and
53
+ `Curia::OWRITER' can be added to by bitwise or: `Curia::ONOLCK', which means it opens a
54
+ database directory without file locking, or `Curia::OLCKNB', which means locking is
55
+ performed without blocking. `Curia::OCREAT' can be added to by bitwise or: `Curia::OSPARSE',
56
+ which means it creates database files as sparse files. If it is omitted, `Curia::OREADER'
57
+ is specified.
58
+ `bnum' specifies the number of elements of the bucket array. If it is omitted or not more
59
+ than 0, the default value is specified. The size of a bucket array is determined on
60
+ creating, and can not be changed except for by optimization of the database. Suggested
61
+ size of a bucket array is about from 0.5 to 4 times of the number of all records to store.
62
+ `dnum' specifies the number of division of the database. If it is omitted or not more than
63
+ 0, the default value is specified. The number of division can not be changed from the
64
+ initial value. The max number of division is 512.
65
+ The return value is the database handle.
66
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
67
+ If a block parameter is given, this method works as an iterator. A database handle is
68
+ opened and passed via the first argument of the block. The database handle is surely
69
+ closed when the block is over.
70
+ While connecting as a writer, an exclusive lock is invoked to the database directory.
71
+ While connecting as a reader, a shared lock is invoked to the database directory. The thread
72
+ blocks until the lock is achieved. If `Curia::ONOLCK' is used, the application is
73
+ responsible for exclusion control.
74
+ </dd>
75
+ </dl>
76
+ <dl>
77
+ <dt><kbd>curia = Curia::open(name, omode, bnum, dnum)</kbd></dt>
78
+ <dd>
79
+ Constructor: An alias of `new'.
80
+ </dd>
81
+ </dl>
82
+ <dl>
83
+ <dt><kbd>bool = curia.close()</kbd></dt>
84
+ <dd>
85
+ Method: Close the database handle.
86
+ The return value is always true.
87
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
88
+ Because the region of a closed handle is released, it becomes impossible to use the handle.
89
+ Updating a database is assured to be written when the handle is closed. If a writer opens
90
+ a database but does not close it appropriately, the database will be broken.
91
+ </dd>
92
+ </dl>
93
+ <dl>
94
+ <dt><kbd>curia.silent = bool</kbd></dt>
95
+ <dd>
96
+ Method: Set the flag whether to repress frequent exceptions.
97
+ The return value is the assigned value.
98
+ </dd>
99
+ </dl>
100
+ <dl>
101
+ <dt><kbd>bool = curia.put(key, val, dmode)</kbd></dt>
102
+ <dd>
103
+ Method: Store a record.
104
+ `key' specifies a key. Although it must be an instance of String, binary data is okey.
105
+ `val' specifies a value. Although it must be an instance of String, binary data is okey.
106
+ `dmode' specifies behavior when the key overlaps, by the following values: `Curia::DOVER',
107
+ which means the specified value overwrites the existing one, `Curia::DKEEP', which means
108
+ the existing value is kept, `Curia::DCAT', which means the specified value is concatenated
109
+ at the end of the existing value. If it is omitted, `Curia::DOVER' is specified.
110
+ The return value is always true. However, if the silent flag is true and replace is
111
+ cancelled, false is returned instead of exception.
112
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or replace
113
+ is cancelled.
114
+ </dd>
115
+ </dl>
116
+ <dl>
117
+ <dt><kbd>bool = curia.store(key, val)</kbd></dt>
118
+ <dd>
119
+ Method: An alias of `put'.
120
+ </dd>
121
+ </dl>
122
+ <dl>
123
+ <dt><kbd>curia[key] = val</kbd></dt>
124
+ <dd>
125
+ Method: An alias of `put'.
126
+ </dd>
127
+ </dl>
128
+ <dl>
129
+ <dt><kbd>bool = curia.out(key)</kbd></dt>
130
+ <dd>
131
+ Method: Delete a record.
132
+ `key' specifies a key. Although it must be an instance of String, binary data is okey.
133
+ The return value is always true. However, if the silent flag is true and no record
134
+ corresponds, false is returned instead of exception.
135
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
136
+ corresponds.
137
+ </dd>
138
+ </dl>
139
+ <dl>
140
+ <dt><kbd>bool = curia.delete(key)</kbd></dt>
141
+ <dd>
142
+ Method: An alias of `out'.
143
+ </dd>
144
+ </dl>
145
+ <dl>
146
+ <dt><kbd>bool = curia.clear()</kbd></dt>
147
+ <dd>
148
+ Method: Delete all records.
149
+ The return value is always true.
150
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
151
+ </dd>
152
+ </dl>
153
+ <dl>
154
+ <dt><kbd>str = curia.get(key, start, max)</kbd></dt>
155
+ <dd>
156
+ Method: Retrieve a record.
157
+ `key' specifies a key. Although it must be an instance of String, binary data is okey.
158
+ `start' specifies the offset address of the beginning of the region of the value to be read.
159
+ If it is negative or omitted, the offset is specified as 0.
160
+ `max' specifies the max size to be read. If it is negative or omitted, the size to read is
161
+ unlimited.
162
+ The return value is an instance of the value of the corresponding record. If the silent flag
163
+ is true and no record corresponds, nil is returned instead of exception.
164
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs, no record
165
+ corresponds, or the size of the value of the corresponding record is less than `max'.
166
+ </dd>
167
+ </dl>
168
+ <dl>
169
+ <dt><kbd>str = curia.fetch(key, defval)</kbd></dt>
170
+ <dd>
171
+ Method: Retrieve a record.
172
+ `key' specifies a key. Although it must be an instance of String, binary data is okey.
173
+ `defval' specifies the default value used when no record corresponds. If it is omitted, nil
174
+ is specified.
175
+ The return value is an instance of the value of the corresponding record, or the default
176
+ value if no record corresponds.
177
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
178
+ </dd>
179
+ </dl>
180
+ <dl>
181
+ <dt><kbd>str = curia[key]</kbd></dt>
182
+ <dd>
183
+ Method: An alias of `fetch'.
184
+ </dd>
185
+ </dl>
186
+ <dl>
187
+ <dt><kbd>num = curia.vsiz(key)</kbd></dt>
188
+ <dd>
189
+ Method: Get the size of the value of a record.
190
+ `key' specifies a key. Although it must be an instance of String, binary data is okey.
191
+ The return value is the size of the value of the corresponding record. If the silent flag
192
+ is true and no record corresponds, -1 is returned instead of exception.
193
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
194
+ corresponds.
195
+ Because this method does not read the entity of a record, it is faster than `get'.
196
+ </dd>
197
+ </dl>
198
+ <dl>
199
+ <dt><kbd>bool = curia.iterinit()</kbd></dt>
200
+ <dd>
201
+ Method: Initialize the iterator of the database handle.
202
+ The return value is always true.
203
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
204
+ The iterator is used in order to access the key of every record stored in a database.
205
+ </dd>
206
+ </dl>
207
+ <dl>
208
+ <dt><kbd>str = curia.iternext()</kbd></dt>
209
+ <dd>
210
+ Method: Get the next key of the iterator.
211
+ The return value is the value of the next key. If the silent flag is true and no record
212
+ corresponds, nil is returned instead of exception.
213
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
214
+ is to be get out of the iterator.
215
+ It is possible to access every record by iteration of calling this method. However, it is
216
+ not assured if updating the database is occurred while the iteration. Besides, the order
217
+ of this traversal access method is arbitrary, so it is not assured that the order of
218
+ storing matches the one of the traversal access.
219
+ </dd>
220
+ </dl>
221
+ <dl>
222
+ <dt><kbd>bool = curia.setalign(align)</kbd></dt>
223
+ <dd>
224
+ Method: Set alignment of the database handle.
225
+ `align' specifies the basic size of alignment. If it is omitted, alignment is cleared.
226
+ The return value is always true.
227
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
228
+ If alignment is set to a database, the efficiency of overwriting values is improved.
229
+ The size of alignment is suggested to be average size of the values of the records to be
230
+ stored. If alignment is positive, padding whose size is multiple number of the alignment
231
+ is placed. If alignment is negative, as `vsiz' is the size of a value, the size of padding
232
+ is calculated with `(vsiz / pow(2, abs(align) - 1))'. Because alignment setting is not
233
+ saved in a database, you should specify alignment every opening a database.
234
+ </dd>
235
+ </dl>
236
+ <dl>
237
+ <dt><kbd>bool = curia.setfbpsiz(size);</kbd></dt>
238
+ <dd>
239
+ Method: Set the size of the free block pool.
240
+ `size' specifies the size of the free block pool. If it is undef, the free block pool is not
241
+ used.
242
+ The return value is always true.
243
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
244
+ The default size of the free block pool is 16. If the size is greater, the space efficiency
245
+ of overwriting values is improved with the time efficiency sacrificed.
246
+ </dd>
247
+ </dl>
248
+ <dl>
249
+ <dt><kbd>bool = curia.sync()</kbd></dt>
250
+ <dd>
251
+ Method: Synchronize updating contents with the files and the devices.
252
+ The return value is always true.
253
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
254
+ This method is useful when another process uses the connected database directory.
255
+ </dd>
256
+ </dl>
257
+ <dl>
258
+ <dt><kbd>bool = curia.optimize(bnum)</kbd></dt>
259
+ <dd>
260
+ Method: Optimize the database.
261
+ `bnum' specifies the number of the elements of the bucket array. If it is omitted or not
262
+ more than 0, the default value is specified.
263
+ The return value is always true.
264
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
265
+ In an alternating succession of deleting and storing with overwrite or concatenate,
266
+ dispensable regions accumulate. This method is useful to do away with them.
267
+ </dd>
268
+ </dl>
269
+ <dl>
270
+ <dt><kbd>num = curia.fsiz()</kbd></dt>
271
+ <dd>
272
+ Method: Get the total size of the database files.
273
+ The return value is the total size of the database files.
274
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
275
+ If the total size is more than 2GB, the return value overflows.
276
+ </dd>
277
+ </dl>
278
+ <dl>
279
+ <dt><kbd>num = curia.bnum()</kbd></dt>
280
+ <dd>
281
+ Method: Get the total number of the elements of each bucket array.
282
+ The return value is the total number of the elements of each bucket array
283
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
284
+ </dd>
285
+ </dl>
286
+ <dl>
287
+ <dt><kbd>num = curia.rnum()</kbd></dt>
288
+ <dd>
289
+ Method: Get the number of the records stored in the database.
290
+ The return value is the number of the records stored in the database.
291
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
292
+ </dd>
293
+ </dl>
294
+ <dl>
295
+ <dt><kbd>num = curia.length()</kbd></dt>
296
+ <dd>
297
+ Method: An alias of `rnum'.
298
+ </dd>
299
+ </dl>
300
+ <dl>
301
+ <dt><kbd>num = curia.size()</kbd></dt>
302
+ <dd>
303
+ Method: An alias of `rnum'.
304
+ </dd>
305
+ </dl>
306
+ <dl>
307
+ <dt><kbd>bool = curia.writable()</kbd></dt>
308
+ <dd>
309
+ Method: Check whether the database handle is a writer or not.
310
+ The return value is true if the handle is a writer, false if not.
311
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
312
+ </dd>
313
+ </dl>
314
+ <dl>
315
+ <dt><kbd>bool = curia.fatalerror()</kbd></dt>
316
+ <dd>
317
+ Method: Check whether the database has a fatal error or not.
318
+ The return value is true if the database has a fatal error, false if not.
319
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
320
+ </dd>
321
+ </dl>
322
+ <dl>
323
+ <dt><kbd>curia.each() do |key, val| ... end</kbd></dt>
324
+ <dd>
325
+ Iterator Method: Iterate a process with a pair of a key and a value of each record.
326
+ </dd>
327
+ </dl>
328
+ <dl>
329
+ <dt><kbd>curia.each_pair() do |key, val| ... end</kbd></dt>
330
+ <dd>
331
+ Iterator Method: An alias of `each'.
332
+ </dd>
333
+ </dl>
334
+ <dl>
335
+ <dt><kbd>curia.each_key() do |key| ... end</kbd></dt>
336
+ <dd>
337
+ Iterator Method: Iterate a process with a key of each record.
338
+ </dd>
339
+ </dl>
340
+ <dl>
341
+ <dt><kbd>curia.each_value() do |val| ... end</kbd></dt>
342
+ <dd>
343
+ Iterator Method: Iterate a process with a value of each record.
344
+ </dd>
345
+ </dl>
346
+ <dl>
347
+ <dt><kbd>ary = curia.keys()</kbd></dt>
348
+ <dd>
349
+ Method: Get an array of all keys.
350
+ The return value is an array of all keys.
351
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
352
+ </dd>
353
+ </dl>
354
+ <dl>
355
+ <dt><kbd>ary = curia.values()</kbd></dt>
356
+ <dd>
357
+ Method: Get an array of all values.
358
+ The return value is an array of all values.
359
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
360
+ </dd>
361
+ </dl>
362
+ <dl>
363
+ <dt><kbd>str = curia.index(val)</kbd></dt>
364
+ <dd>
365
+ Method: Retrieve a record with a value.
366
+ `val' specifies a value. Although it must be an instance of String, binary data is okey.
367
+ The return value is the key of the record with the specified value.
368
+ An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
369
+ corresponds.
370
+ If two or more records correspond, the first found record is selected.
371
+ </dd>
372
+ </dl>
373
+ <dl>
374
+ <dt><kbd>num = curia.to_int()</kbd></dt>
375
+ <dd>
376
+ Method: An alias of `rnum'.
377
+ </dd>
378
+ </dl>
379
+ <dl>
380
+ <dt><kbd>num = curia.to_i()</kbd></dt>
381
+ <dd>
382
+ Method: An alias of `to_int'.
383
+ </dd>
384
+ </dl>
385
+ <dl>
386
+ <dt><kbd>str = curia.to_str()</kbd></dt>
387
+ <dd>
388
+ Method: Get string standing for the instance.
389
+ </dd>
390
+ </dl>
391
+ <dl>
392
+ <dt><kbd>str = curia.to_s()</kbd></dt>
393
+ <dd>
394
+ Method: An alias of `to_str'.
395
+ </dd>
396
+ </dl>
397
+ <dl>
398
+ <dt><kbd>ary = curia.to_ary()</kbd></dt>
399
+ <dd>
400
+ Method: Get an array of alternation of each pair of key and value.
401
+ </dd>
402
+ </dl>
403
+ <dl>
404
+ <dt><kbd>ary = curia.to_a()</kbd></dt>
405
+ <dd>
406
+ Method: An alias of `to_ary'.
407
+ </dd>
408
+ </dl>
409
+ <dl>
410
+ <dt><kbd>hash = curia.to_hash()</kbd></dt>
411
+ <dd>
412
+ Method: Get a hash storing all records.
413
+ </dd>
414
+ </dl>
415
+ <dl>
416
+ <dt><kbd>hash = curia.to_h()</kbd></dt>
417
+ <dd>
418
+ Method: An alias of `to_hash'.
419
+ </dd>
420
+ </dl>
421
+ <dl>
422
+ <dt><kbd>str = curia.inspect()</kbd></dt>
423
+ <dd>
424
+ Method: An alias of `to_str'.
425
+ </dd>
426
+ </dl>
427
+ <hr />
428
+ <div class="note">Generated by ./myrbdoc, 2010/08/05.</div>
429
+ </body>
430
+ </html>