Locate simple large objects in named files

To have Informix® ESQL/C locate the TEXT or BYTE data in a named file, set the loc_loctype field of the locator structure to LOCFNAME, as shown in the following example:
EXEC SQL BEGIN DECLARE SECTION;
    loc_t my_simple_lo;
EXEC SQL END DECLARE SECTION;


my_simple_lo.loc_loctype = LOCFNAME; 

To use a named file as a simple-large-object location, your Informix® ESQL/C program must specify a pointer to the file name in the loc_fname field of the locator structure. You must also set the loc_oflags field with a file-open mode flag to tell Informix® ESQL/C how to access the file when it opens it.

To open a named file, Informix® ESQL/C opens the file named in the loc_fname field with the mode flags that the loc_oflags field specifies. If this file does not exist, Informix® ESQL/C creates it. Informix® ESQL/C then puts the file descriptor of the open file in the loc_fd field and proceeds as if your program opened the file. If Informix® ESQL/C cannot open this file, it sets the loc_status field (and SQLCODE) to -461. When the transfer is complete, Informix® ESQL/C closes the file, which releases the file descriptor in the loc_fd field.

The demo directory contains the following two sample Informix® ESQL/C programs that demonstrate how to handle simple-large-object data located in a named file:
  • The getcd_nf.ec program selects a simple large object into a named file.
  • The updcd_nf.ec program inserts a simple large object from a named file.
These programs assume the stores7 database as the default database for the simple-large-object data. The user can specify another database (on the default database server) as a command-line argument as follows:
getcd_of mystores