The am_open purpose function

The database server calls am_open to initialize input or output before processing an SQL statement.

Syntax

mi_integer am_open(MI_AM_TABLE_DESC *tableDesc)
tableDesc
Points to the table descriptor.

Usage

As part of the initialization, am_open might:
  • Determine the reason or mode for the open, as described in The mi_tab_mode() accessor function.
  • Allocate PER_STMT_EXEC or PER_STMT_PREP memory for a user-data structure as described in Persistent user data.
  • Open a database connection with the DataBlade® API mi_open() function.

    To enable subsequent purpose functions to use the database, am_open can copy the connection handle that mi_open() returns into the user-data structure.

  • Register callback functions to handle exceptions, as described in Handle the unexpected.
  • Call the appropriate DataBlade API functions to obtain a file handle for an extspace or an LO handle for a smart large object.

Return values

MI_OK
Indicates success.
MI_ERROR
Indicates failure.

Related topics

See the description of:
  • Memory allocation, callback functions, and the functions to open files or smart large objects in the Informix® DataBlade API Programmer's Guide