The mi_scan_setuserdata() accessor function
The mi_scan_setuserdata() function stores a pointer to user data in the scan descriptor.
Syntax
void mi_scan_setuserdata(MI_AM_SCAN_DESC *scanDesc, void
*userdata);
- scanDesc
- Points to the scan descriptor.
- user_data
- Points to the user data.
Usage
The access method can create a user-data structure in shared memory to store reusable information, such as function descriptors for qualifications and to maintain a row pointer for each execution of the am_getnext purpose function. To retain user data in memory during the scan (starting when am_beginscan is called and ending when am_endscan is called), follow these steps:
- In the am_beginscan purpose function, call
the correct DataBlade
API function
to allocate memory for the user-data structure.
Allocate the user-data memory with a duration of PER_COMMAND.
- In am_getnext, populate the user-data structure with scan-state information.
- Before am_getnext exits, call mi_scan_setuserdata() to store a pointer to the user-data structure in the scan descriptor.
- In the am_endscan purpose function, call the correct DataBlade API function to deallocate the user-data memory.
Return values
None