INFORMIX
DataBlade API Programmer's Manual
Chapter 12: DataBlade API Function Descriptions
Home Contents Index Master Index New Book

mi_lo_to_file()

The mi_lo_to_file() function copies a smart large object to an operating-system file on the client or server computer.

Syntax

Usage

The mi_lo_to_file() function can create the target files on either the server or the client computer. The flag values for the flags argument indicate the location and access mode of the operating-system file to copy.

Valid values include the following file-mode constants.

File-Mode Constant Purpose

MI_O_EXCL

Raise an exception if a file by that name already exists.

MI_O_TRUNC

Truncate the file, if it there.

MI_O_APPEND

Append to the file, if it already exists.

MI_O_RDWR

Open the file in read/write mode.

MI_O_WRONLY

Open the file in write-only mode.

MI_O_BINARY

Process the data as binary data.

MI_O_TEXT

Process the data as text (not binary). (Binary is used if you do not specify MI_O_TEXT.)

MI_O_SERVER_FILE

The fname_spec file is created on the server computer. The file mode is read/write for all users. The file owner is root.

MI_O_CLIENT_FILE

The fname_spec file is created on the client computer. The file mode is zero so that the file uses the client umask permission-mask value. The file owner is the client user identifier.

The default value for the flags argument is the masking of the following flag values:

By default, the mi_lo_to_file() function generates a filename in the following form:

In this format, fname_spec is the filename that you specify as an argument to mi_lo_to_file(), and hex_id is the unique hexadecimal smart-large-object identifier. The maximum number of digits for a smart-large-object identifier is 16; however, most smart large objects have an identifier with fewer significant digits.

For example, suppose you specify a fname_spec value as follows:

If the LO handle has an identifier of 00000000000203b2, the mi_lo_to_file() function creates the following file:

To change this default filename, you can specify the following wildcard symbols in the filename portion of fname_spec:

    The mi_lo_to_file() function replaces each question mark with a hexadecimal digit from the identifier of the LO handle. Substitution is right to left. Question marks need not be contiguous. If you specify more than 16 question marks, the mi_lo_to_file() function ignores them.

    The mi_lo_to_file() function omits the exclamation point from the result and does not substitute any characters. The exclamation point overrides the question marks in the filename specification.

Tip: These wildcards are also valid in the fname_spec argument of the mi_lo_filename() function. For more information on mi_lo_filename(), see page 12-282.

The following table shows some examples of wildcard substitution when the hexadecimal identifier for the LO handle of a smart large object is 0000000000000019.
(1 of 2)

Filename Specification Actual Filename

x!

x

resume.txt!

resume.txt

x

x.0000000000000019

?resume

9resume

resume??.txt

resume19.txt

resume???.???

resume000.019

?abc???.???

0abc000.019

???a???.???

000a000.019

???a???.???b

000a000.019b

???a???.???b!

???a???.???b

???a???.???b??????????????

???a???.?00b00000000000019

Tip: The mi_lo_to_file() function replaces the mi_large_object_to_file() function, which Informix supports for backward compatibility only. Use mi_lo_to_file() for all new DataBlade routines.

Return Values

char *

This character string is the filename that results from the wildcard expansion.

NULL

The function was not successful.

Related Topics

See the description of the following functions: mi_lo_filename() and mi_lo_from_file().

In Chapter 3, "Handling Smart Large Objects," see "Using Operating-System Files".




DataBlade API Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.