The ifx_lo_open() function

The ifx_lo_open() function opens a smart large object.

Syntax

ifx_lo_open(lofd, loptr, flags)

Arguments

The function accepts the following arguments.
Argument Type Use Description
lofd SQL_INTEGER Output Smart-large-object file descriptor. This file descriptor is only valid within the current database connection.
loptr SQL_INFX_UDT_FIXED Input Smart-large-object pointer structure
flags SQL_INTEGER Input Mode in which to open the smart large object.

Usage

The ifx_lo_open() function performs the following steps to open a smart large object:
  1. Opens the loptr smart large object in the access mode that flags specifies.
  2. Sets the seek position to byte zero.
  3. Locks the smart large object.
Important: The database server does not check access permissions on the smart large object. Your application must make sure that the user or application is trusted.
As the following table describes, the access mode determines the type of lock.
Access mode Type of lock
Dirty read No lock
Read only Shared lock
Write only, write/append, or read/write Update lock. When you call ifx_lo_write() or ifx_lo_writewithseek() for the smart large object, the database server promotes the lock to an exclusive lock.

The database server loses this lock when the current transaction terminates. The database server obtains the lock again the next time you call a function that needs a lock.

As an alternative, you can use a BEGIN WORK transaction block and place a COMMIT WORK or ROLLBACK WORK statement after the last statement that needs to use the lock.
  1. Associates the smart large object with the current connection.

    When you close this connection, the database server deallocates any associated smart large objects that have a reference count of zero. The reference count indicates the number of database columns that refer to the smart large object.

  2. Returns a file descriptor that identifies the smart large object.

The database server uses the default parameters that the call to ifx_lo_open() establishes to determine whether to lock or log subsequent operations on the smart large object.