Creating a Query

FDO API

 
Creating a Query
 
 
 

You create and perform queries using the FdoISelect class, which is a member of the Feature sub-package of the Commands package. Queries are used to retrieve features from the data store, and are executed against one class at a time. The class is specified using the SetFeatureClassName() method in FdoIFeatureCommand. The SetFeatureClassName can be used with feature and non-feature classes.

FdoISelect supports the use of filters to limit the scope of features returned by the command. This is done through one of the SetFilter methods available in the FdoIFeatureCommand class. The filter is similar to the SQL WHERE clause, which specifies the search conditions that are applied to one or more class properties.

Search conditions include spatial and non-spatial conditions. Non-spatial queries create a condition against a data property, such as an integer or string. Basic comparisons (=, <, >, >=, <=, !=), pattern matching (like), and ‘In’ comparisons can be specified. Spatial queries create a spatial condition against a geometry property. Spatial conditions are enumerated in FdoSpatialCondition and FdoDistanceCondition.

The feature reader (FdoIFeatureReader) is used to retrieve the results of a query for feature and non-feature classes. To retrieve the features from the reader, iterate through the reader using the FdoIFeatureReader.ReadNext method().