skip to main content
Designing and coding the IP : SELECT processing : Simple SELECT processing
 

Simple SELECT processing

The processing of SELECT queries to read data and process in a single call to IP EXECUTE is done as follows:
1. Determine the criteria to use for building rows. To decide how to get information from the query that can be used to reduce the number of rows processed, see Optimization.
2. Build a row with the required columns. Call dam_allocRow to allocate a row and then use dam_addValToRow to add values for the columns. Here you may select to build a row with all columns as defined in the schema or to build only the required ones. Use the function dam_getFirstCol and the associated dam_getNextCol to select columns that appear in the various parts of the query. At minimum, you should add values for columns that appear either in the SELECT part of the query or in the WHERE condition of the query. Find these by calling: dam_getFirstCol(DAM_COL_IN_USE)
3. Evaluate against the expression. Call dam_isTargetRow to evaluate the row against the where condition.
4. Add the row to the result set if it evaluates true. If not, free it. Call dam_addRowToTable to add the row. Call dam_freeRow to free it.
5. Repeat from Step 2 until all candidate rows are read from the database and processed.