uiflst

Describes the set of records to which a function applies.

Description

An array of uiflst structures (called the ‘if’ list) describes the set of records to which a connector request applies. It does not specify which access techniques to use. The ‘if’ list can be used with SQL-like DBMSs to build the where clause. For ISAM-like DBMSs which are not capable of making the selection specified in the ‘if’ list, Uniface provides the where structure which can be used alternatively. The where structure is described in the uwhrlst structure.

The connector can access the ‘if’ list by means of the address of the first element provided in uctrl->uiflist. The uiflst structures are available in:

ControlBlock->uiflist[0]...

ControlBlock->uiflist[(ControlBlock->uifnum -1)]

where ControlBlock contains the address of the current uctrl structure.

Interpretation of the ‘if’ list

The ‘if’ list must be interpreted as a tokenized string. A query language expression for SQL-like languages can be generated by scanning the ‘if’ list from the first to the last element. For every element, the query language representation of the corresponding partial expression must be appended.

The partial expression for one ‘if’ list element must be constructed by applying the following algorithm:

  • If the current element in the ‘if’ list is not the first element, and the bracket level (see uiflst->level) in the current element is less than the level in the previous element, append closing brackets. The number of brackets to append is the difference in the bracket level.
  • Append the operator (see uiflst->opr).
  • If the current element in the ‘if’ list is not the last element, and the bracket level in the next element is higher than the level in the current element, append opening brackets. The number of brackets to append is the difference in the bracket level.
  • If the current element in the ‘if’ list is the last element, or the operator in the next element is not the logical NOT, append the operand (see uctrl->pack and uiflst->data). The operand can be a field name, an indication that the next element is a physical row address, or an actual value.

Finally, if the bracket level in the last element is higher than one, append closing brackets. The number of brackets to append is the bracket level in the last element, minus one.

Members

Member Description
short double data Element uctrl->pack and the element data together determine the exact interpretation of the data. See table Contents of the uiflst->data element for the possible combinations.
unsigned char level Bracket level of the subexpression in this entry of the ‘if’ list.
unsigned char opr Like and not like operators are present since Kanji was introduced. Like is set to value four and not like is set to value eleven. If the connector wants to receive the like operators, the uinfo->like needs to be set to the value of one. If the connector does not want to receive the like operators, the uinfo->like must be set to zero. When connectors set this field, they can skip the scanning of values for wildcard characters in pC, pR and pU fields as explained in the extra information that follows. The operator for this subexpression will be one of the values listed in the table Values and operators.

Note:   Values larger than ten are included here for future reference.

unsigned char prio Reserved for future use.
short len If uctrl->pack is not equal to seven, uiflst->len is the actual length of the constant data indicated by uiflst->data.
Contents of the uiflst->data element
uctrl->pack uiflst->data <>0 uiflst->data ==0
==7 filled number *1

*1 The field number is contained in element data.

physical row address *2

*2 The physical row address can be found in the next uiflist structure of the if list.

<>7 offset to data *3

*3 The actual data can be found at the offset in bytes as contained in element data from uctrl->uwlist.

Values and operators
Value Operator Meaning
0 WHERE WHERE, only allowed in first element of ‘if’ list
1 & Logical AND
2 || Logical inclusive OR
3 != Not equal to
4 like  
5 <= Less than or equal to
6 < Less than
7 ! Logical NOT
8 = Equal to
9 >= Greater than or equal to
10 > Greater than
11 notlike  
12 - Minus
13 + Plus
14 % Modulo
15 / Divide
16 * Multiply

Extra information

There is no explicit ‘like’ operator in the ‘if’ list. If uctrl->pack is pC or pU, and uiflst->opr is three (not equal to) or eight (equal to), the connector must scan data strings pointed to by uiflst->data for wildcard characters to determine the correct interpretation of the operator. The character value one represents the wildcard ‘*’ (any pattern of any number of characters). The value two represents the wildcard ‘?’ (any character). The values that represent the wildcards can be redefined by setting uinfo->profil[] to nonzero values in the Info connector request.

There is no explicit ‘is null’ or ‘is not null’ operator in the ‘if’ list. If uctrl->pack is not equal to seven and uiflst->len is zero, the interpretation of uiflst->opr value three (not equal to) and eight (equal to) depends on the following:

  • Whether the field involved in the comparison is mandatory or not. For more information, see ufldlst->ufbits, mask value 64, in data structure ufldlst.
  • The connector-level packing code of the field.

A field length of zero with connector-level packing codes pC, pR or pU must be interpreted either as an empty field (the value is present, but its length is zero) or the NULL value (the value is missing).

The interpretation is summarized in the table:

Interpretation of the equal and not equal operators
Packing Code Mandatory Field Non-Mndatory Field
pC, pR or pU field ==""

field <>""

field is NULL

field is not NULL

not pC, pR or pU   field is NULL

field is not NULL

The connector must be prepared to handle comparisons of mandatory pC, pR and pU fields with uiflst->len at zero. With some DBMSs this can be done by generating an ‘is null’ or ‘is not null’ operator which is guaranteed to result in TRUE or FALSE. If the DBMS does not allow the ‘is null’ and ‘is not null’ operators on mandatory fields, the connector can generate dummy subexpressions like ‘1 equals 0’ and ‘1 equals 1’ to obtain the same effect.