URL: http://www.firstbasesoftware.com/man/man1/dbload.htm
Last modified: 4 April 1996
Copyright © by FirstBase Software.
[
Index of Contents] [
FirstBase RDBMS Overview]
Dbload(1) can also be used with an existing database. Using the -a option will cause dbload(1) to append records from the loadfile to the database. The database map is also updated, so use of dbclean(1) is not required. To enforce field length checking, use the -l option.
Dbrload is similar to dbload, except that database records are replaced (updated) in an already existing database. To use dbrload(1), at least the database must exist already. For each line of the loadfile, dbrload(1) will determine if the record already exists by consulting the given index, which must be a FirstBase autoindex.
If the record exists, all non blank fields from the loadfile are written to the existing database record. To force the clearing of a field, use $ERASE as the field value. If the record does not exist, or if no index is given for dbrload(1) to search, a new record is appended to the end of the database. Again: without an index, dbrload(1) will append all records from the loadfile as if they were new.
To work properly on repeated duplicate records in the load file, dbrload(1) must update the given index as it adds new records to the database. The best use of this feature is with FirstBase Btree indexes which retain their order during record insertions.
Note that dbrload(1) will work on complex indexes -- and the fields that make up this index do not need to be in any specific order. However, only one non-auto index will be updated by dbrload(1).
Dbrload(1) also accepts the use of formulas for numeric fields. These formulas have the same basic format as those for FirstBase formula (virtual) fields defined via dbdbas(1). However, since the string passed in via dbrload could merely look like a formula, a special mechanism is used to tell dbrload(1) that the string is to be parsed as a formula -- all dbrload formulas must begin with "$F:".
Formulas use numbers to represent fields (eg. 16 for field 16) and a prepended 'C' or 'c' for constants (eg. C4.5 for 4.5). Addition (+), subtraction (-), multiplication (*), and division (/) are allowed as operators.
Note: Only dollar, float, numeric and positive numeric fields can be used in formula calculations. This means references to other formulas will not work. Also, all formulas read from left to right, and there is no precedence among the operators.
The precision of a formula is specified by appending a colon (:) to the formula followed by a number. Default precision is two.
For example, if the value of the third comma separated value of the rload file is $F:3+C22:0, then the contents of field three will be increased by 22 -- with the result having 0 places after the decimal.
The -b flag will run the FirstBase tool in batch mode, suitable for shell scripts. This mode produces no output on the terminal, thus can also be used when running the process in the background. The -y flag will run the tool at the terminal without pausing to ask the user if existing files can be destroyed and without displaying a 'picture' of the requested task.
If loadfile is not specified, the user is prompted for a file name. The default is *.emit, where * is the database file name. Note: normally, dbload(1) will not add the extension .emit to the loadfile.
If there are more fields defined in the dictionary than there are values in any one input line, the excess fields are null padded. Excess values not defined in the dictionary are ignored.
Although it is not necessary to put alphanumeric data in quotes, this will not hinder dbload(1). Quotes must be used if the data includes embedded commas. The backslash (\) is a metacharacter used to escape characters. To embed a quotation mark, use '\"', and to embed a backslash, '\\'.
Dbload(1) provides a convenient method of uploading from one database management system into the FirstBase system. The 'comma separated field' format is compatible with many other database management packages. It is also possible to emit values out of a FirstBase database file. See dbemit(1).
The -c argument can be used to change the field separator to another character. For example, -c \| could be used to change the separator to the vertical bar character ('|'). (Note the escaping of the pipeline character due to the shell.)
Note: Unless -a was used, dbclean(1) is automatically run at the completion of dbload(1) to create a map file for the new database.
FirstBase User's Guide and Reference Manual
Note: dbrload(1) tool will attempt to gain write access to a record before operating on that record. If access is currently locked, then the internal locking routine will respond according to the value of the FirstBase environment variable LOCKMESSAGE. See setup(5).
Each of these tools normally will ignore interrupt signals. However, if
the firstbase variable INTERRUPT is ON, these tools will terminate on
an interrupt signal.
However, if either of these database load tools is interrupted,
the database and index objects being updated should be deleted using
rmdb(8) and
rmidx(8) before the database load is attempted again.