Query Mode

The IliDataSource and IliSQLTable classes support query mode.

When query mode is entered, the data source substitutes a memory table for the SQL table (see switchToQueryMode). This memory table has the same number of columns as the SQL table, but it differs in that all columns in the memory table have a String type. The user can then edit the contents of the memory table through the same set of gadgets that are used to edit the SQL table in regular (nonquery) mode.

Each column of a memory table can contain:

  • A literal value (implying the = relational operator)

  • A value containing the SQL wildcard character % or the underscore character “_” (implying the LIKE SQL operator)

  • An SQL condition such as:

    • NULL or IS NULL

    • NOT NULL or IS NOT NULL

    • LIKE ‘a pattern’

    • NOT LIKE ‘a pattern’

    • BETWEEN _literal_value AND another_literal_value

    • = a_literal_value

    • <> a_literal_value

    • < _literal_value

A memory table can contain more than one row. All conditions that appear on the same line will be combined with an AND operator when the query is applied. Conditions that appear on different lines will be combined with an OR operator.

Then, the user can apply the query (see applyQueryMode), which will synthesize a portion of the WHERE clause based on the contents of the memory table. This WHERE clause will then be assigned to the SQL table by calling the setQueryConjunct member function. The IliTable::select member function will be called and the data source will revert to using the SQL table instead of the memory table so that all connected gadgets show the contents of the SQL table.

Alternatively, the user can cancel the query (see IliDataSource::cancelQueryMode), which simply reverts to using the SQL table instead of the memory table so that all connected gadgets show the contents of the SQL table.

The IliDbNavigator gadget has been upgraded to optionally contain a QueryMode button.

The QueryMode button is labelled with a question mark (?). When the QueryMode button is clicked, the SQL data source switches to query mode. When in query mode, the Validate (V) and Cancel (X) buttons of the navigator behave differently than when in regular mode. Clicking on the Validate navigator button applies query mode and clicking on the Cancel navigator button cancels query mode.