DATAHANDLERS and the SQLDA
You may specify a user-defined datahandler as an SQLVAR element of the SQLDA, to transmit large objects to or from the database. The "eqsqlda.h" file included via the include sqlda statement defines an IISQLHDLR type which may be used to specify a datahandler and its argument. It is defined:
structure /IISQLHDLR/
integer*4 sqlarg ! Optional argument to pass
integer*4 sqlhdlr ! User-defined datahandler
end structure
The file does not declare an IISQLHDLR variable; the program must declare a variable of the specified type and set the values:
record /IISQLHDLR/ dathdlr
structure /hdlr_arg/
character*100 argstr
integer argint
end structure
record /hdlr_arg/ hdlarg
external Get_Handler()
integer Get_Handler()
UNIX:
dathdlr.sqlarg = loc(hdlarg)
dathdlr.sqlhdlr = loc(Get_Handler)
VMS:
dathdlr.sqlarg = %loc(hdlarg)
dathdlr.sqlhdlr = %loc(Get_Handler)
Windows:
dathdlr.sqlarg = %loc(hdlarg)
dathdlr.sqlhdlr = %loc(Get_Handler)
The sqltype, sqlind and sqldata fields of the SQLVAR element of the SQLDA should then be set as follows:
/*
** assume sqlda is a pointer to a dynamically allocated
** SQLDA
*/
sqlda.sqlvar[i].sqltype = IISQ_HDLR_TYPE;
sqlda.sqlvar[i].sqlind = loc(indvar)
sqlda.sqlvar[i].sqldata = loc(dathdlr)