The user-defined close function
To define how to perform clean-up tasks for the user-defined location, you create a C function called a user-defined close function.
When a transfer to or from the database server is complete, Informix® ESQL/C calls the close function that the loc_close field of the locator structure supplies. Cleanup tasks include closing files or deallocating memory that the user-defined location uses.
This function must receive
one argument: the address of the locator structure, ifx_loc_t
*loc_struc, where loc_struc is a locator structure that
your user-defined close function uses. The user-defined close function
must return the success code for the close operation as follows:
- 0
- The cleanup was successful.
- -1
- The cleanup failed. This return code generates a loc_status (and
SQLCODE) error of
-453
.
The following figure shows a skeleton function
of a user-defined close function.