The am_update purpose function

The database server calls am_update to process an UPDATE statement if the update affects the key rows or results in changing the physical location of the row.

Syntax

mi_integer am_update(MI_AM_TABLE_DESC *tableDesc, MI_ROW *oldrow,
       MI_AM_ROWID_DESC *oldridDesc,
       MI_ROW *newrow,
       MI_AM_ROWID_DESC *newridDesc)
tableDesc
Points to the index descriptor.
oldrow
Points to the row structure that contains the before-update values.
oldridDesc
Points to the row-ID descriptor for the row before the update.
newrow
Points to the row structure that contains the updated values.
newridDesc
Points to the row-ID descriptor for the updated row.

Usage

The am_update function modifies the contents of an existing index entry.

The access method stores the row identifier and fragment identifier for the updated table row in newridDesc. To alter the contents of a component in the key, am_update:
  • Deletes the old key
  • Adjusts the key data format in newrow to conform to the source data
  • Calls the appropriate support functions to make room for the new entry
  • Stores the new entry
If the access method needs to move the updated row, am_update can take the following actions:
  • Deletes the old row
  • Adjusts the data format in row to conform to the source data
  • Stores the updated source-data record
  • Stores the updated row identifier
Important: The database server does not call am_update unless both the am_rowids and am_readwrite purpose flags are set.
Important: If the access method does not supply am_update, but an SQL statement requires it, the database server raises an error. For more information about how to handle this error, see Supply error messages and a user guide for your functions.

For more information, see the purpose flags am_rowids and am_readwrite in Setting purpose functions, flags, and values.

Return values

MI_OK
Indicates success.
MI_ERROR
Indicates failure.