Pass-Through TPF in tpf_blob

The TPF sample tpf_blob.cxx demonstrates advanced UDF LOB and CLOB handling. The example is available in the samples directory. This examination of tpf_blob illustrates concepts not already covered by the simpler examples in tpf_rg_1 and tpf_rg_2; only the relevant portions are discussed.

A table UDF or TPF can not produce LOB or CLOB data. However, using a concept known as pass-through, LOB or CLOB data can be passed from an input table to an output table. In fact, any data type can be passed through from an input table to the result set. This allows a TPF to filter rows, meaning that the output is a subset of the input table rows.

The CREATE PROCEDURE statement supported by tpf_blob is:
CREATE PROCEDURE tpf_blob( IN tab TABLE( num INT, s [LONG] <VARCHAR | BINARY >,
                           IN pattern char(1) )
RESULT SET ( num INT, s [LONG] <VARCHAR | BINARY > )
EXTERNAL NAME ‘tpf_blob@libv4apiex’

The procedure supports multiple schemas. The data types for column s in the result set and input table can be one of VARCHAR, BINARY, LONG VARCHAR, or LONG BINARY.