The am_delete purpose function
The database server calls am_delete for:
- A DELETE statement
- An UPDATE statement that requires a change in physical location
- An ALTER FRAGMENT statement that moves a row to a different fragment
- A MERGE statement, which can perform both INSERT and DELETE or UPDATE operations on the result of an outer join of two tables
Syntax
mi_integer am_delete(MI_AM_TABLE_DESC *tableDesc,
MI_ROW *row,
MI_AM_ROWID_DESC *ridDesc)
- tableDesc
- Points to the index descriptor.
- row
- Points to a row structure that contains the key value to delete.
- ridDesc
- Points to the row-ID descriptor.
Usage
The am_delete deletes one index key in the virtual index. Additionally, the function passes (by reference) the row-ID descriptor, which contains the location of the underlying table row to delete.
In response to a DELETE statement, the database server first calls the appropriate purpose functions to scan for the index entry or entries that qualify for deletion and then executes am_delete separately for each qualifying entry.
The access method identifies and executes support functions to adjust the index structure after the delete.
Important: The database server does not call
the am_delete purpose function unless you set both
the am_rowids and am_readwrite purpose flags.
Important: If the access method does not supply an am_delete purpose
function, but an SQL statement requires it, the database server raises
an error. For more information on 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.