Call functions from a purpose function

A query proceeds as follows for the super_access access method, which has only an am_getnext purpose function:
  1. The access method am_getnext purpose function, get_next_record(), uses DataBlade® API functions to the initiate callback functions for error handling.
  2. The database server prepares a table descriptor to identify the index that the query specifies, a scan descriptor to describe the query projection, and a qualification descriptor to describe the query selection criteria.
  3. The database server passes a pointer to the scan descriptor through the get_next_record() to the access method. The scan descriptor, in turn, points to the table descriptor and qualification descriptor in shared memory.
  4. The access method get_next_record() function takes the following actions:
    1. Calls VII accessor functions to retrieve the index description and then calls DataBlade API functions to open that index
    2. Calls accessor functions to retrieve the query projection and selection criteria from the scan and qualification descriptors
    3. Calls the DataBlade API function (usually mi_dalloc()) to allocate memory for a user-data structure to hold the current virtual-index data
    4. Begins its scan
  5. Each time that the access method retrieves a qualifying record, it stores the row and fragment identifiers in the row-id descriptor.
  6. The database server executes get_next_record() to continue scanning until get_next_record() returns MI_NO_MORE_RESULTS to indicate to the database server that the access method has returned every qualifying row.
  7. The access method calls a DataBlade API function to close the index and release any allocated memory.
  8. The database server reports the results to the user or application that initiated the query.

The steps in the preceding example illustrate the interaction between the database server, the access method, and the DataBlade API.