Advanced PowerBuilder

HomePrevious Lesson: Format 4
Next Lesson: Summary

Handling the Results

A similar process is required for handling results. PowerBuilder needs to know where to populate the information about the results, so, the DESCRIBE and PREPARE statements are used. Typically, this information storage container is SQLDA, unless you create another object of type SQLDA to connect to more data sources.

Before the actual execution of the SQL statement, you need to call SetDynamicParm() to specify parameters. This command takes three parameters: Dynamic Staging Area, the parameter number and the parameter itself. The FETCH command used here is different from the one used in cursors and Format 3. In this format, you don't specify the variables to store the result set, since, you don't know the number of columns in the result set, their data type and length of each column in the result set.

You can check both NumOutputs attribute of SQLDA, to establish the number of columns in the result set, and OutparmType array, for the datatype of each column in the result set. The data type can be any one of the following enumerated examples:

After checking for the data type, call one of the following corresponding functions, depending on the data type, to get the actual value:

HomePrevious Lesson: Format 4
Next Lesson: Summary