Loading Multiple Tables Per File

The same text as was used in the previous section can be loaded in more than one way. This often happens, where there is a choice of data structure which can be captured from the same text. In this case you may wish to load multiple tables on the same text.

You can use this method where there is only one recdelim for each way of loading the data, but you want to load fields from a single text record into different tables. Distinct data sets need different schema files.

To follow are the contents of the schema file multi.sch supplied with the program:

# same input format as timport.sch
     database /tmp/testdb
     recdelim \x0c
     #       name    type            tag     default_val
     field   load1.Subject   varchar(80)     Subject
     field   load1.From      varchar(40)     From
     field   load1.Date      date            Date
     field   load1.Number    long            Number  0
     field   load2.Number    long            Number  0
     field   load2.File      indirect        -
     field   load2.Text      varchar(1000)   -

If you try this as written, you will see the two different views created from the same data, in the tables load1 and load2 which are imported at the same time.

Note that where the table is specified as part of the field, as "load2.Number", there is no need to specify table as a separate keyword in the schema file.

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.