Register driver functions

The pl_set_method_function() registers a passed function to the passed method ID.

For a description of the method IDs (defined in $INFORMIXDIR/incl/plcustom/pldriver.h) applicable to your driver implementation, refer to the Available API support functions.

The following table shows the available methods.
Method Description
PL_MTH_OPEN The function called to open the file of interest for the load/unload
PL_MTH_CLOSE The function called to close the file at the end of the load/unload
PL_MTH_RAWREAD The function called to get the next block of data from the load file
PL_MTH_RAWWRITE The function called to write a block of data that is passed to it

You do not need to register a function for any of the methods IDs (although presumably you register at least one, or there is no point in writing the driver).

Use the pl_driver_inherit() function to get the standard function for the passed method. For example, to find and run the function currently registered for reading data from the load input, you would code as follows:
int my_rawread_function(bufptr, bufsize, bytesread)
char *bufptr;
int  bufsize;
int *bytesread;
int (*funcptr)();
int rtn;

funcptr = pl_driver_inherit(PL_MTH_RAWREAD);
rtn = (*funcptr)(bufptr, bufsize, &bytesread);
if (rtn)
return(rtn);  /* error */
* Now you have a buffer of data in bufptr, of
* size bytesread.  So you can process data in
* this buffer here before it is converted

For performance reasons, system calls are discouraged. System calls cause the VP on which the driver thread is running to be blocked for the duration of the system call. This blockage prevents the VP from doing other work, causing onpload to run less efficiently.

Copyright© 2018 HCL Technologies Limited