Outbound database Tcl API

The dbpObGetResultset Tcl procedure is provided with the Database Outbound protocol. You can use this Tcl proc in the TPS Inbound Reply UPoC to handle the returned result set of the database-outbound protocol.

By default, this generates a VRL under HCISITEDIR/formats/variable/thread_name.vrl based on the returned result set.

The caller can set {BUILD_VRL 0} in TPS Args to disable the VRL build.

When creating the VRL file or parsing the result set, the script uses the VRL default field separator and termination.

The caller can set key FIELD_SEPARATOR, TERMINATION in the TPS Args to provide user-defined ones.

When building the VRL definition, the field separator and termination are set with hex format.

If the database-outbound protocol is configured to use a stored procedure, then the caller must set {SP_FLAG 1} in TPS Args.

Example 1

This example builds the VRL and sets the user-defined field separator and termination.

In TPS Inbound Reply, select dbpObGetResultset() and set Args as {FIELD_SEPARATOR |} {TERMINATION \n}.

Result:

VRL HCISITEDIR/formats/variable/thread_name.vrl definition is built.

If the VRL file exists, then the VRL definition is not built again.

The data that is parsed by the proc is similar to:

key01|test1|1|2012-10-01 00:00:00.0|1 
key02|test2|2|2012-10-02 00:00:00.0|1 
... 

Example 2

This example does not build the VRL, but uses the default field separator and termination.

In TPS Inbound Reply, select dbpObGetResultset() and set Args as {BUILD_VRL 0}.

Result:

No VRL definition is built.

The data that is parsed by the proc is similar to:

key01,test1,1,2012-10-01 00:00:00.0,1

Example 3

In this example, the result set is returned from a stored procedure.

In TPS Inbound Reply, select dbpObGetResultset() and set Args as {SP_FLAG 1} {FIELD_SEPARATOR |} {TERMINATION \n}.

Result:

VRL HCISITEDIR/formats/variable/thread_name.vrl definition is built.

The data that is parsed by the proc is similar to:

key01|test1|1|2012-10-01 00:00:00.0|1 key02|test2|2|2012-10-02 00:00:00.0|1