NNAAMMEE db_load - the DB database loader SSYYNNOOPPSSIISS ddbb__llooaadd [--nnTT] [--cc nnaammee==vvaalluuee] [--ff ffiillee] [--hh hhoommee] [--tt bbttrreeee || hhaasshh || rreeccnnoo] db_file DDEESSCCRRIIPPTTIIOONN The _d_b___l_o_a_d utility reads from the standard input and loads it into the database _d_b___f_i_l_e. The database _d_b___f_i_l_e is created if it does not already exist. The input to _d_b___l_o_a_d must be in the output format speci- fied by the _d_b___d_u_m_p or _d_b___d_u_m_p_1_8_5 utilities (see _d_b___d_u_m_p(1) for more information), or as specified for the --TT option below. The options are as follows: --cc Specify configuration options for the DB_INFO struc- ture provided to _d_b___o_p_e_n(3), ignoring any value they may have based on the input. The command-line format is ``name=value''. Supported keywords are listed below. --ff Read from the specified _i_n_p_u_t file instead of from the standard input. --hh Specify a home directory for the database. If a home directory is specified, the database envi- ronment is opened using the DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and DB_USE_ENVIRON flags to _d_b___a_p_p_i_n_i_t(3). (This means that _d_b___l_o_a_d can be used to load data into databases while they are in use by other processes.) If the _d_b___a_p_p_i_n_i_t 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. --nn 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. --TT The --TT option allows non-DB applications to easily load text files into databases. If the database to be created is of type bbttrreeee or hhaasshh, 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 rreeccnnoo, 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 back- slash (``\'') 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 char- acter, 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 specifi- cation of a single character, e.g., ``\0a'' is a new- line 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 _d_b___l_o_a_d. If the --TT option is specified, the underlying access method type must be specified using the --tt option. --tt Specify the underlying access method. If no --tt 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 _d_b___l_o_a_d 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. KKEEYYWWOORRDDSS The following keywords are supported for the --cc command- line option. See _d_b___o_p_e_n(3) 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. EEXXAAMMPPLLEESS The _d_b___l_o_a_d utility can be used to load text files into databases. For example, the following command loads the standard UNIX _/_e_t_c_/_p_a_s_s_w_d 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 charac- ters by _d_b___l_o_a_d. EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS The following environment variables affect the execution of _d_b___l_o_a_d: DB_HOME If the --hh option is not specified and the environment variable _D_B___H_O_M_E is set, it is used as the path of the database home, as described in _d_b___a_p_p_i_n_i_t(3). SSEEEE AALLSSOO 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 func- tions, 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 _d_b___i_n_t_r_o(3). _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), _d_b___t_x_n(3)