MailBoxSaveFileDBs

sql

FUNCTION MailBoxSaveFileDBs(IN mailbox HANDLE, IN id INT, IN fileidx INT, INOUT filename CHAR(255), INOUT table CHAR (63), INOUT attr CHAR (31), INOUT cond CHAR (4090)) RETURNS INT;

Parameters

mailbox mailbox handle
id letter identifier
fileidx ordinal number of a file from the attachment (starting with 0); reasonable to use only if no filename is specified
filename name of a file from the attachment; if the fileidx parameter is set, filename will equal NIL (NULL) or empty string
table name of the table we'll be storing to (or generally any object that can be used in the SELECT clause after the FROM keyword)
attr name of the column we'll be storing to (the column must be variable-length and CLOB/BLOB type)
cond select condition that identifies the record we'll be storing to (the condition must select only a single record; if the condition selects multiple records, the 21000 (SQ_CARDINALITY_VIOLATION) error will occur)

Since version

7.0d

Description

Stores an attached file of the specified mail letter into the table table. A SQL condition is used for selecting the record (unlike the similar MailBoxSaveFileDBr function, which specifies the record for storing the file in the way used in the client language).

Loading attached files may be done in two ways. You may get information about attachments and attachments list using the MailBoxLoad and MailBoxGetFilInfo functions and then store selected files. If you need to get all files regardless of their names, you may call the MailBoxSaveFileAs function in a loop with the fileidx parameter ranging from 0 to (attachment count)–1. If the count of attachments is not known in advance, you may call this function until it returns the MAIL_NO_MORE_FILES error.

The table table must exist and must have an appropriate row and column.

Function value

This function returns 0 if successful, the error number otherwise.

See