Most applications use a program structure similar to the following pseudocode to perform a bulk-copy-in operation:
ct_con_props to set connection properties
ct_connect to open the connection
blk_alloc to allocate a CS_BLKDESC
blk_init to initiate the bulk copy
for each column
(optional: blk_describe to get a description of
the column)
(optional: blk_default to get the column’s default
value)
blk_bind to bind the column to a program
variable, or to mark the column for transfer
via blk_textxfer
endfor
while there’s data to transfer
if it’s time to save a batch of rows
blk_done(CS_BLK_BATCH)
endif
copy row values to program variables
call blk_rowxfer_mult to transfer the row data
if data is being transferred via blk_textxfer
for each column to transfer
while there’s data for this column
blk_textxfer to tranfer a chunk of data
endwhile
endfor
endif
endwhile
blk_done(CS_BLK_ALL)
blk_drop to deallocate the CS_BLKDESC