version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
DB_LOAD |
|
|
2 |
!!!DB_LOAD |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
KEYWORDS |
|
|
7 |
EXAMPLES |
|
|
8 |
ENVIRONMENT VARIABLES |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
db_load - the DB database loader |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__db_load__ [[__-nT__] [[__-c |
|
|
19 |
name=value__] |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
[[__-f file__] [[__-h home__] [[__-t btree | hash | |
|
|
23 |
recno__] db_file |
|
|
24 |
!!DESCRIPTION |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
The ''db_load'' utility reads from the standard input and |
|
|
28 |
loads it into the database ''db_file''. The database |
|
|
29 |
''db_file'' is created if it does not already |
|
|
30 |
exist. |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
The input to ''db_load'' must be in the output format |
|
|
34 |
specified by the ''db_dump'' or ''db_dump185'' |
|
|
35 |
utilities (see ''db_dump''(1) for more information), or |
|
|
36 |
as specified for the __-T__ option below. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The options are as follows: |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
__-c__ |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
Specify configuration options for the DB_INFO structure |
|
|
46 |
provided to ''db_open''(3), ignoring any value they may |
|
|
47 |
have based on the input. The command-line format is |
|
|
48 |
``name=value''. Supported keywords are listed |
|
|
49 |
below. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
__-f__ |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
Read from the specified ''input'' file instead of from |
|
|
56 |
the standard input. |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
__-h__ |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
Specify a home directory for the database. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
If a home directory is specified, the database environment |
|
|
66 |
is opened using the DB_INIT_LOCK, DB_INIT_LOG, |
|
|
67 |
DB_INIT_MPOOL, DB_INIT_TXN and DB_USE_ENVIRON flags to |
|
|
68 |
''db_appinit''(3). (This means that ''db_load'' can be |
|
|
69 |
used to load data into databases while they are in use by |
|
|
70 |
other processes.) If the ''db_appinit'' call fails, or if |
|
|
71 |
no home directory is specified, the database is still |
|
|
72 |
updated, but the environment is ignored, e.g., no locking is |
|
|
73 |
done. |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
__-n__ |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
Do not overwrite existing keys in the database when loading |
|
|
80 |
into an already existing database. If a key/data pair cannot |
|
|
81 |
be loaded into the database for this reason, a warning |
|
|
82 |
message is displayed on the standard error output and the |
|
|
83 |
key/data pair are skipped. |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
__-T__ |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
The __-T__ option allows non-DB applications to easily |
|
|
90 |
load text files into databases. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
If the database to be created is of type __btree__ or |
|
|
94 |
__hash__, the input must be paired lines of text, where |
|
|
95 |
the first line of the pair is the key item, and the second |
|
|
96 |
line of the pair is its corresponding data item. If the |
|
|
97 |
database to be created is of type __recno__, the input |
|
|
98 |
must be lines of text, where each line is a new data item |
|
|
99 |
for the database. |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
A simple escape mechanism, where newline and backslash |
|
|
103 |
(``'') characters are special, is applied to the text input. |
|
|
104 |
Newline characters are interpreted as record separators. |
|
|
105 |
Backslash characters in the text will be interpreted in one |
|
|
106 |
of two ways: if the backslash character precedes another |
|
|
107 |
backslash character, the pair will be interpreted as a |
|
|
108 |
literal backslash. If the backslash character precedes any |
|
|
109 |
other character, the two characters following the backslash |
|
|
110 |
will be interpreted as hexadecimal specification of a single |
|
|
111 |
character, e.g., ``0a'' is a newline character in the ASCII |
|
|
112 |
character set. |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
For this reason, any backslash or newline characters that |
|
|
116 |
naturally occur in the text input must be escaped to avoid |
|
|
117 |
misinterpretation by ''db_load''. |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
If the __-T__ option is specified, the underlying access |
|
|
121 |
method type must be specified using the __-t__ |
|
|
122 |
option. |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
__-t__ |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
Specify the underlying access method. If no __-t__ option |
|
|
129 |
is specified, the database will be loaded into a database of |
|
|
130 |
the same type as was dumped, e.g., a hash database will be |
|
|
131 |
created if a hash database was dumped. |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
Btree and hash databases may be converted from one to the |
|
|
135 |
other. Recno databases may not be converted to any other |
|
|
136 |
database type or from any other database type. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
The ''db_load'' utility exits 0 on success, 1 if one or |
|
|
140 |
more key/data pairs were not loaded into the database |
|
|
141 |
because the key already existed, and |
|
|
142 |
'' |
|
|
143 |
!!KEYWORDS |
|
|
144 |
|
|
|
145 |
|
|
|
146 |
The following keywords are supported for the __-c__ |
|
|
147 |
command-line option. See ''db_open''(3) for further |
|
|
148 |
discussion of these keywords and what values should be |
|
|
149 |
specified. |
|
|
150 |
|
|
|
151 |
|
|
|
152 |
The parenthetical listing specifies how the value part of |
|
|
153 |
the ``name=value'' pair is interpreted. Items listed as |
|
|
154 |
(boolean) expect value to be ``1'' (set) or ``0'' (unset). |
|
|
155 |
Items listed as (number) convert value to a number. Items |
|
|
156 |
listed as (string) use the characters of value |
|
|
157 |
directly. |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
bt_minkey (number) |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
The minimum number of keys per page. |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
db_lorder (number) |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
The byte order for integers in the stored database |
|
|
170 |
metadata. |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
db_pagesize (number) |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
The size of pages used for nodes in the tree, in |
|
|
177 |
bytes. |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
duplicates (boolean) |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
The value of the DB_DUP flag. |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
h_ffactor (number) |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
The density within the hash table. |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
h_nelem (number) |
|
|
193 |
|
|
|
194 |
|
|
|
195 |
The size of the hash table. |
|
|
196 |
|
|
|
197 |
|
|
|
198 |
re_len (number) |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
Specify fixed-length records of the specified |
|
|
202 |
length. |
|
|
203 |
|
|
|
204 |
|
|
|
205 |
re_pad (string) |
|
|
206 |
|
|
|
207 |
|
|
|
208 |
Specify the fixed-length record pad character. |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
recnum (boolean) |
|
|
212 |
|
|
|
213 |
|
|
|
214 |
The value of the DB_RECNUM flag. |
|
|
215 |
|
|
|
216 |
|
|
|
217 |
renumber (boolean) |
|
|
218 |
|
|
|
219 |
|
|
|
220 |
The value of the DB_RENUMBER flag. |
|
|
221 |
!!EXAMPLES |
|
|
222 |
|
|
|
223 |
|
|
|
224 |
The ''db_load'' utility can be used to load text files |
|
|
225 |
into databases. For example, the following command loads the |
|
|
226 |
standard UNIX ''/etc/passwd'' file into a database, with |
|
|
227 |
the login name as the key item and the entire password entry |
|
|
228 |
as the data item: |
|
|
229 |
|
|
|
230 |
|
|
|
231 |
awk -F: '{print $1; print $0}' |
|
|
232 |
Note that backslash characters naturally occurring in the text are escaped to avoid interpretation as escape characters by ''db_load''. |
|
|
233 |
!!ENVIRONMENT VARIABLES |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
The following environment variables affect the execution of |
|
|
237 |
''db_load'': |
|
|
238 |
|
|
|
239 |
|
|
|
240 |
DB_HOME |
|
|
241 |
|
|
|
242 |
|
|
|
243 |
If the __-h__ option is not specified and the environment |
|
|
244 |
variable ''DB_HOME'' is set, it is used as the path of |
|
|
245 |
the database home, as described in |
|
|
246 |
''db_appinit''(3). |
|
|
247 |
!!SEE ALSO |
|
|
248 |
|
|
|
249 |
|
|
|
250 |
The DB library is a family of groups of functions that |
|
|
251 |
provides a modular programming interface to transactions and |
|
|
252 |
record-oriented file access. The library includes support |
|
|
253 |
for transactions, locking, logging and file page caching, as |
|
|
254 |
well as various indexed access methods. Many of the |
|
|
255 |
functional groups (e.g., the file page caching functions) |
|
|
256 |
are useful independent of the other DB functions, although |
|
|
257 |
some functional groups are explicitly based on other |
|
|
258 |
functional groups (e.g., transactions and |
|
|
259 |
logging). |
|
|
260 |
|
|
|
261 |
|
|
|
262 |
''db_archive''(1), ''db_checkpoint''(1), |
|
|
263 |
''db_deadlock''(1), ''db_dump''(1), ''db_load''(1), |
|
|
264 |
''db_recover''(1), ''db_stat''(1), |
|
|
265 |
---- |