Insert a simple large object from a named file
Babe Ruth signature glove. Black leather. Infield/outfield
style. Specify right- or left-handed.
The updcd_nf program in Code excerpt from the updcd_nf sample program first performs a SELECT statement on the catalog table for a catalog number that the user enters in response to a prompt. The SELECT statement returns the catalog_num and cat_descr columns. The prdesc() function (Guide to the prdesc.c file) displays the current content of cat_descr.
ans[0] = = 'y'
),
the updcd_nf program prepares the locator structure as follows
to update the cat_descr column from text in a file that the
user has specified: - The cat_descr.loc_loctype field is set to LOCFNAME to indicate that the source of the update text is a named file.
- The cat_descr.loc_fname field is set to descfl, the name of the file that contains the simple-large-object data.
- The cat_descr.loc_oflags field is set to LOC_RONLY to tell Informix® ESQL/C to open the file in read-only mode.
- The cat_descr.loc_size field is set to
-1
to tell Informix® ESQL/C to transfer the simple large object all at once, not to transfer it in smaller pieces, one piece at a time. You can also set the loc_oflags field to the LOC_USEALL mask to perform this operation.
If you insert a null simple-large-object value, your program
also needs to set the loc_indicator field to -1
.
After Informix®
ESQL/C reads
data from the named file and sends it to the database server, Informix®
ESQL/C updates
the loc_size field with the number of bytes read from the named
file and sent to the database server. Informix®
ESQL/C also
sets the loc_status field to indicate the status of the operation: 0
for
success and a negative value if an error has occurred. For possible
causes of the error, see Error returns in loc_status.