Populate a table that contains an IfxDocDesc data type
Use the IfxDocDesc data type to store your documents in a table as smart large objects or to reference the documents on the operating system by file name.
Suppose that your search text is stored in the following collection
of Microsoft™ Word files
on a UNIX™ file system:
/local0/excal/desc1.doc
/local0/excal/desc2.doc
Further suppose that you want to load these files into a table
called videos1, described by the following example:
CREATE TABLE videos1
(
id INTEGER,
name VARCHAR(30),
description IfxDocDesc
);
To load the first of these files, /local0/excal/desc1.doc,
into a row of the videos1 table, execute the following statement:
INSERT INTO videos1 (id, name, description)
VALUES ( 1010, 'The Unforgiven',
Row ('MS Word', '7.0',
Row ('IFX_FILE', NULL::LLD_Lob,
'/local0/excal/desc1.doc')::LLD_Locator,
NULL::LVARCHAR )::IfxDocDesc
);
Because you specified IFX_FILE as the protocol, the description column does not actually contain the search text, but instead has a pointer (of data type LLD_Locator) to the operating system file specified by the INSERT statement.
If you want to store the second text file, /local0/excal/desc2.doc,
in the database itself, use the IFX_BLOB or IFX_CLOB protocol, as
shown in the following similar example:
INSERT INTO videos1 (id, name, description)
VALUES ( 1011, 'The Sting',
Row ('MS Word', '7.0',
Row ('IFX_CLOB',
FileToCLOB ('/local0/excal/desc2.doc', 'client'),
NULL::LVARCHAR )::LLD_Locator,
NULL::LVARCHAR )::IfxDocDesc
);
The FileToCLOB() routine reads the file from the operating system into the database.