Was this helpful?
User-Defined Data Handlers for Large Objects
You can use user-defined datahandlers to transmit large object column values to or from the database a segment at a time. For more details on Large Objects, the datahandler clause, the get data statement, and the put data statement, see the SQL Reference Guide and the Forms-based Application Development Tools User Guide.
ESQL/Fortran Usage Notes
Use datahandlers in the following ways:
The datahandler, and the datahandler argument, should not be declared in an ESQL declare section. Therefore do not use a colon before the datahandler or its argument.
You must ensure that the datahandler argument is a valid Fortran variable address. ESQL will not do any syntax or datatype checking of the argument.
The datahandler must be declared to return an integer. However, the actual return value will be ignored.
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)
Last modified date: 08/28/2024