Home > Class Reference > ENSLIB namespace > %SQL.AbstractFind

%SQL.AbstractFind

abstract class %SQL.AbstractFind extends %Library.RegisteredObject

%SQL.AbstractFind defines the interface used by the SQL %FIND and %INSET filter conditions.

SQL %FIND and other filters

SQL Filter Interface

Overview

This class defines the interface used for %FIND and %INSET SQL filter conditions, which use the following syntax:

    f <filter> x
where <filter> is either %FIND or %INSET, and x represents a set of values S used as a filter for f, or more precisely, the condition is satisfied iff f is a member of S.

x is an expression that evaluates at run-time to the oref of an object that provides an abstract representation encapsulating the set S of non-NULL values (often IDs), by implementing the interface specified in this class. This interface consists of methods called at query run-time, that represent S's contents. The interface differs based on which of the two filter conditions is used.

These conditions enable filtering using a given abstract, programmatically specified set of values, and in particular, enable filtering of the rowid field using an abstract, programmatically specified temp-file or bitmap index, where x behaves similarly to the last subscript layer of a bitmap index.

%INSET requires x to support the simplest and most general interface, consisting of the single method ContainsItem()(i), which returns 1 iff i is in the set.

This method must also be supported by x for %FIND.

%FIND requires x to support an interface that emulates a set S of positive integers as if being stored in a CacheSQL conventional bitmap layer. When t.%ID is used for f, this interface allows the query processor to use x in various capacities as if it were an index of t, including driving the processing of table t, or as part of a complex multi-index strategy for t.

In addition to ContainsItem(), the %FIND interface includes the three methods GetChunk(), NextChunk(), and PreviousChunk(), which emulate the usage of $ORDER()/$DATA()