The am_rescan purpose function

The database server typically calls am_rescan to process a join or subquery that requires multiple scans on the same table.

Syntax

mi_integer am_rescan(MI_AM_SCAN_DESC *scanDesc)
scanDesc
Points to the scan descriptor.

Usage

Although am_rescan is an optional purpose function, the access method can enhance efficiency by supplying am_rescan for applications that involve joins, subqueries, and other multiple-pass scan processes. The am_rescan purpose function ends the previous scan in an appropriate manner and begins a new scan on the same open table.

Without an am_rescan purpose function, the database server calls the am_endscan function and then am_beginscan, if the access method provides these functions.
Tip: To determine if an outer join might cause a constant value to change, call mi_qual_const_depends_outer(). To determine the need to re-evaluate the qualification descriptor, call mi_scan_newquals() from am_rescan.

Return values

MI_OK
Indicates success.
MI_ERROR
Indicates failure.