Inserting Text

There are a few different ways to manage large quantities of text in a database. The previous examples given for the REPORT table concentrated on the VARCHAR (variable length character) column which held a filename as a character string; e.g., '/data/rnd/ink.txt' as stored in the FILENAME column. This column manages the filename only, not the text contained in that file.

In the examples used in Chapter here, Table Definition, a RESUME table is created which uses a VARCHAR field of around 2000 characters to hold the text of the resumes. In this case, the job experience text of each resume is stored in the column EXP. A Load Program would be used to insert text of this length into the column of a table.

Another way Texis has of managing text is to allow the files to remain outside the confines of the table. Where the INDIRECT data type is used, a filename can be entered as a value which points to an actual file, rather than treated as a character string. The INDIRECT type looks at the contents of the file when doing LIKE, and these contents can be retrieved using the API (Application Program Interface).

The form of the INSERT INTO command is the same as above. Where a data type is defined as INDIRECT, a filename may be entered as the value of one or more columns.

Example: Let's say we have the following information available for a resume to be entered into the RESUME table, and that the job experience column EXP has been defined as INDIRECT.

RES_ID = R421
    RNAME = Smith, James
    JOB = Jr Analyst
    EDUC = B.A. 1982 Radford University
    EXP = contained in the resume file "/usr/local/resume/smith.res"

Use this INSERT INTO statement to add a row containing this information to the RESUME table:

INSERT INTO RESUME
     VALUES ('R421','Smith, James','Jr Analyst',
             'B.A. 1982 Radford University',
             '/usr/local/resume/smith.res') ;

The EXP column acts as a pointer to the full text files containing the resumes. As such, the text in those files responds to all SELECT-FROM-WHERE statements. Thus Metamorph queries used after LIKE can be done on the text content manipulated by Texis in this table.


Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.