Put Handler
This example shows how to read the long varchar chapter_text from a text file and insert it into the database a segment at a time:
C Put_Handler
C ***********
integer function Put_Handler(info)
structure /hdlr_arg/
character*100 argstr
integer*4 argint
end structure
record /hdlr_arg/ info
exec sql begin declare section
character*1000 segbuf
integer*4 seglen
integer*4 datend
exec sql end declare section
process information passed in via the info record ...
open file ...
datend = 0
do while not end-of-file
read segment of less than 1000 characters from file into segbuf . . .
if end-of-file then
datend = 1
end if
exec sql put data (segment = :segbuf,
1 segmentlength = :seglen, dataend = :datend)
end do
. . .
close file ...
set info record to return appropriate values ...
. . .
Put_Handler = 0
end