7. Embedded SQL for Pascal : Advanced Processing : Sample Programs : Handler
 
Share this page                  
Handler
This program inserts a row into the book table using the data handler Put_Handler to transmit the value of column chapter_text from a text file to the database. Then it selects the column chapter_text from the table book using the data handler Get_Handler to process each row returned.
program handler(input,output);
    exec sql include sqlca

-- Do not declare the data handlers nor the data handler argument
-- to the ESQL preprocessor

type

    String100 = packed array [1..100] of char;
        hdlr_rec = record
            argstr: String100;
            argint: Integer;

        end;

var
        hdlr_rec: hdlr_arg;

        exec sql begin declare section;
            indvar;      II_int2;
            seg_buf;     packed array [1...1000] of char;
            seg_len;     integer;
            data_end;    integer;
            max_len;     integer;
        exec sql end declare section;