зеркало из https://github.com/mozilla/gecko-dev.git
202 строки
8.9 KiB
HTML
202 строки
8.9 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>db_load</TITLE>
|
|
</HEAD>
|
|
<BODY BGCOLOR=white>
|
|
<H1>db_load</H1>
|
|
<HR SIZE=1 NOSHADE>
|
|
<PRE>
|
|
<!-- Manpage converted by man2html 3.0.1 -->
|
|
<B>db</B>_<B>load</B> [<B>-nT</B>] [<B>-c</B> <B>name=value</B>]
|
|
[<B>-f</B> <B>file</B>] [<B>-h</B> <B>home</B>] [<B>-t</B> <B>btree</B> <B>|</B> <B>hash</B> <B>|</B> <B>recno</B>] db_file
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
The db_load utility reads from the standard input and
|
|
loads it into the database db_file. The database db_file
|
|
is created if it does not already exist.
|
|
|
|
The input to db_load must be in the output format
|
|
specified by the db_dump or db_dump185 utilities (see
|
|
<B><A HREF="db_dump.html">db_dump(1)</A></B> for more information), or as specified for the
|
|
<B>-T</B> option below.
|
|
|
|
The options are as follows:
|
|
|
|
<B>-c</B> Specify configuration options for the DB_INFO
|
|
structure provided to <B><A HREF="db_open.html">db_open(3)</A></B>, ignoring any value
|
|
they may have based on the input. The command-line
|
|
format is ``name=value''. Supported keywords are
|
|
listed below.
|
|
|
|
<B>-f</B> Read from the specified input file instead of from
|
|
the standard input.
|
|
|
|
<B>-h</B> Specify a home directory for the database.
|
|
|
|
If a home directory is specified, the database
|
|
environment is opened using the DB_INIT_LOCK,
|
|
DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and
|
|
DB_USE_ENVIRON flags to <B><A HREF="db_appinit.html">db_appinit(3)</A></B>. (This means
|
|
that db_load can be used to load data into databases
|
|
while they are in use by other processes.) If the
|
|
db_appinit call fails, or if no home directory is
|
|
specified, the database is still updated, but the
|
|
environment is ignored, e.g., no locking is done.
|
|
|
|
<B>-n</B> Do not overwrite existing keys in the database when
|
|
loading into an already existing database. If a
|
|
key/data pair cannot be loaded into the database for
|
|
this reason, a warning message is displayed on the
|
|
standard error output and the key/data pair are
|
|
skipped.
|
|
|
|
<B>-T</B> The <B>-T</B> option allows non-DB applications to easily
|
|
load text files into databases.
|
|
|
|
If the database to be created is of type <B>btree</B> or
|
|
<B>hash</B>, the input must be paired lines of text, where
|
|
the first line of the pair is the key item, and the
|
|
second line of the pair is its corresponding data
|
|
item. If the database to be created is of type
|
|
<B>recno</B>, the input must be lines of text, where each
|
|
line is a new data item for the database.
|
|
|
|
A simple escape mechanism, where newline and
|
|
backslash (``\'') characters are special, is applied
|
|
to the text input. Newline characters are
|
|
interpreted as record separators. Backslash
|
|
characters in the text will be interpreted in one of
|
|
two ways: if the backslash character precedes another
|
|
backslash character, the pair will be interpreted as
|
|
a literal backslash. If the backslash character
|
|
precedes any other character, the two characters
|
|
following the backslash will be interpreted as
|
|
hexadecimal specification of a single character,
|
|
e.g., ``\0a'' is a newline character in the ASCII
|
|
character set.
|
|
|
|
For this reason, any backslash or newline characters
|
|
that naturally occur in the text input must be
|
|
escaped to avoid misinterpretation by db_load.
|
|
|
|
If the <B>-T</B> option is specified, the underlying access
|
|
method type must be specified using the <B>-t</B> option.
|
|
|
|
<B>-t</B> Specify the underlying access method. If no <B>-t</B>
|
|
option is specified, the database will be loaded into
|
|
a database of the same type as was dumped, e.g., a
|
|
hash database will be created if a hash database was
|
|
dumped.
|
|
|
|
Btree and hash databases may be converted from one to
|
|
the other. Recno databases may not be converted to
|
|
any other database type or from any other database
|
|
type.
|
|
|
|
The db_load utility exits 0 on success, 1 if one or more
|
|
key/data pairs were not loaded into the database because
|
|
the key already existed, and >1 if an error occurs.
|
|
|
|
|
|
</PRE>
|
|
<H2>KEYWORDS</H2><PRE>
|
|
The following keywords are supported for the <B>-c</B> command-
|
|
line option. See <B><A HREF="db_open.html">db_open(3)</A></B> for further discussion of
|
|
these keywords and what values should be specified.
|
|
|
|
The parenthetical listing specifies how the value part of
|
|
the ``name=value'' pair is interpreted. Items listed as
|
|
(boolean) expect value to be ``1'' (set) or ``0'' (unset).
|
|
Items listed as (number) convert value to a number. Items
|
|
listed as (string) use the characters of value directly.
|
|
|
|
bt_minkey (number)
|
|
The minimum number of keys per page.
|
|
|
|
db_lorder (number)
|
|
The byte order for integers in the stored database
|
|
metadata.
|
|
|
|
db_pagesize (number)
|
|
The size of pages used for nodes in the tree, in
|
|
bytes.
|
|
|
|
duplicates (boolean)
|
|
The value of the DB_DUP flag.
|
|
|
|
h_ffactor (number)
|
|
The density within the hash table.
|
|
|
|
h_nelem (number)
|
|
The size of the hash table.
|
|
|
|
re_len (number)
|
|
Specify fixed-length records of the specified length.
|
|
|
|
re_pad (string)
|
|
Specify the fixed-length record pad character.
|
|
|
|
recnum (boolean)
|
|
The value of the DB_RECNUM flag.
|
|
|
|
renumber (boolean)
|
|
The value of the DB_RENUMBER flag.
|
|
|
|
|
|
</PRE>
|
|
<H2>EXAMPLES</H2><PRE>
|
|
The db_load utility can be used to load text files into
|
|
databases. For example, the following command loads the
|
|
standard UNIX /etc/passwd file into a database, with the
|
|
login name as the key item and the entire password entry
|
|
as the data item:
|
|
awk -F: '{print $1; print $0}' < /etc/passwd |
|
|
sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db
|
|
|
|
Note that backslash characters naturally occurring in the
|
|
text are escaped to avoid interpretation as escape
|
|
characters by db_load.
|
|
|
|
|
|
</PRE>
|
|
<H2>ENVIRONMENT VARIABLES</H2><PRE>
|
|
The following environment variables affect the execution
|
|
of db_load:
|
|
|
|
DB_HOME
|
|
If the <B>-h</B> option is not specified and the environment
|
|
variable DB_HOME is set, it is used as the path of
|
|
the database home, as described in <B><A HREF="db_appinit.html">db_appinit(3)</A></B>.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
The DB library is a family of groups of functions that
|
|
provides a modular programming interface to transactions
|
|
and record-oriented file access. The library includes
|
|
support for transactions, locking, logging and file page
|
|
caching, as well as various indexed access methods. Many
|
|
of the functional groups (e.g., the file page caching
|
|
functions) are useful independent of the other DB
|
|
functions, although some functional groups are explicitly
|
|
based on other functional groups (e.g., transactions and
|
|
logging). For a general description of the DB package,
|
|
see <B><A HREF="db_intro.html">db_intro(3)</A></B>.
|
|
|
|
<B><A HREF="db_archive.html">db_archive(1)</A></B>, <B><A HREF="db_checkpoint.html">db_checkpoint(1)</A></B>, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>, <B><A HREF="db_dump.html">db_dump(1)</A></B>,
|
|
<B><A HREF="db_load.html">db_load(1)</A></B>, <B><A HREF="db_recover.html">db_recover(1)</A></B>, <B><A HREF="db_stat.html">db_stat(1)</A></B>, <B><A HREF="db_intro.html">db_intro(3)</A></B>,
|
|
<B><A HREF="db_appinit.html">db_appinit(3)</A></B>, <B><A HREF="db_cursor.html">db_cursor(3)</A></B>, <B><A HREF="db_dbm.html">db_dbm(3)</A></B>, <B><A HREF="db_internal.html">db_internal(3)</A></B>,
|
|
<B><A HREF="db_lock.html">db_lock(3)</A></B>, <B><A HREF="db_log.html">db_log(3)</A></B>, <B><A HREF="db_mpool.html">db_mpool(3)</A></B>, <B><A HREF="db_open.html">db_open(3)</A></B>, <B><A HREF="db_thread.html">db_thread(3)</A></B>,
|
|
<B><A HREF="db_txn.html">db_txn(3)</A></B>
|
|
|
|
</PRE>
|
|
<HR SIZE=1 NOSHADE>
|
|
<ADDRESS>
|
|
Man(1) output converted with
|
|
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|