The schema format for these records, as contained in the supplied file
timport.sch
follows:
database /tmp/testdb
table load
# use formfeed as record delimiter (recdelim implies multiple)
recdelim \x0c
# take multiple records from a single file
#multiple
# name type tag default_val
field Subject varchar(80) Subject
field From varchar(40) From
field Number long Number 0
field Date date Date
field File varind -
field Text varchar(1000) -
# create table load(id counter,Subject varchar(80),From varchar(40),
# Number long,Date date,File varind,Text varchar(1000));
The specification of each field is the most precisely defined item in a schema file. Follow these rules:
mytable.myfield
").
create table
".
If no length it provided varchar fields will be set to length 80 and
all other types will be set to 1.
>>$\Rtag:=\P[\x20\x09]*[^\x0d\x0a]+
\x20
and \x09
instead of space and tab, respectively,
within the REX expression, since space and tab are delimiters within the
schema file.#
the field will be filled
in with an incrementing number starting with 1. If there is a number after
the #
it will be used as the starting number.
If the "default value" starts with a field name
the field will be filled in with the length of the fields named
as the "default value". To get the length of multiple fields name
them all with plus(+
) between the names
(e.g.: Title+Subject+Body
). A minus(-
) may also
be used for subtraction.
NONE
", or
"UNKNOWN
" (without the quotes), or you
can put ''
or ""
in the field for "empty".
NOTE: ""
for empty was added in version 2.12 (Feb 20 1999)
With no default, the importer makes one up based on field type as below:
indirect -> input file name
byte -> empty
strlst -> empty
char -> entire record
numerics -> 0
date -> current date/time
The fields Subject
, From
, Number
and Date
will be loaded by locating those tags at the start of those respective
lines. The text which follows the tag up to the end of the line will
be imported as the content of the field.
The text of the whole file will be loaded into the field called
File
, and the text of each separate record will be loaded into
the field called Text, as indicated by the lone '-' in Value 3.