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/Ada Usage Notes
When using ESQL/Ada, the following notes apply:
The datahandler, and 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 Ada 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 with the include sqlda statement defines an IISQLDHDLR type which may be used to specify a datahandler and its argument. It is defined:
--
-- IISQLHDLR - Structure type with function pointer and
--             function argument for the DATAHANDLER.
--
type IISQLHDLR is
    record
       sqlarg:  Address;-- Optional argument to pass
       sqlhdlr: Address;--User-defined datahandler function
    end record;
The file does not declare an IISQLHDLR variable; the program must declare a variable of the specified type and set the values:
-- Declare argument to be passed to datahandler
      hdlr_arg:     Hdlr_Rec;

-- Declare IISQLHDLR
      data_handler: IISQLHDLR;
-- Declare Get_Handler function to return an integer
function Get_Handler(info: Hdlr_Rec) return Integer
        data_handler.sqlhdlr = Get_Handler'Address;
        data_handler.sqlarg     = hdlr_arg'Address;
The sqltype, sqlind and sqldata fields of the SQLVAR element of the SQLDA should then be set as follows:
    sqlda.sqlvar(i).sqltype := IISQ_HDLR_TYPE;
    sqlda.sqlvar(i).sqldata := data_handler'Address;
    sqlda.sqlvar(i).sqlind  := indvar'Address'
Last modified date: 01/30/2023