31 #ifndef OGR_GENSQL_H_INCLUDED
32 #define OGR_GENSQL_H_INCLUDED
43 #define GEOM_FIELD_INDEX_TO_ALL_FIELD_INDEX(poFDefn, iGeom) \
44 ((poFDefn)->GetFieldCount() + SPECIAL_FIELD_COUNT + (iGeom))
46 #define IS_GEOM_FIELD_INDEX(poFDefn, idx) \
47 (((idx) >= (poFDefn)->GetFieldCount() + SPECIAL_FIELD_COUNT) && \
48 ((idx) < (poFDefn)->GetFieldCount() + SPECIAL_FIELD_COUNT + (poFDefn)->GetGeomFieldCount()))
50 #define ALL_FIELD_INDEX_TO_GEOM_FIELD_INDEX(poFDefn, idx) \
51 ((idx) - ((poFDefn)->GetFieldCount() + SPECIAL_FIELD_COUNT))
57 class OGRGenSQLResultsLayer final:
public OGRLayer
70 int *panGeomFieldToSrcGeomField;
85 std::vector<CPLString> m_oDistinctList;
90 void CreateOrderByIndex();
94 void SortIndexSection(
const OGRField *pasIndexFields,
96 size_t nStart,
size_t nEntries );
97 void FreeIndexFields(
OGRField *pasIndexFields,
99 bool bFreeArray =
true);
103 void ApplyFiltersToSource();
105 void FindAndSetIgnoredFields();
106 void ExploreExprForIgnoredFields(swq_expr_node* expr,
CPLHashSet* hSet);
107 void AddFieldDefnToSet(
int iTable,
int iColumn,
CPLHashSet* hSet);
109 int ContainGeomSpecialField(swq_expr_node* expr);
111 void InvalidateOrderByIndex();
113 int MustEvaluateSpatialFilterOnGenSQL();
121 const
char *pszWHERE,
122 const
char *pszDialect );
123 virtual ~OGRGenSQLResultsLayer();
127 virtual
void ResetReading() override;
128 virtual
OGRFeature *GetNextFeature() override;
134 virtual
GIntBig GetFeatureCount(
int bForce = TRUE ) override;
135 virtual
OGRErr GetExtent(OGREnvelope *psExtent,
int bForce = TRUE)
override {
return GetExtent(0, psExtent, bForce); }
136 virtual OGRErr GetExtent(
int iGeomField, OGREnvelope *psExtent,
int bForce = TRUE)
override;
virtual OGRErr SetAttributeFilter(const char *)
Set a new attribute query.
Definition: ogrlayer.cpp:338
virtual void SetSpatialFilter(OGRGeometry *)
Set a new spatial filter.
Definition: ogrlayer.cpp:1113
Definition of a feature class or feature layer.
Definition: ogr_feature.h:259
Various convenience functions for working with strings and string lists.
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:286
Classes related to registration of format support, and opening datasets.
virtual int TestCapability(const char *)=0
Test if this layer supported the named capability.
OGRFeature field attribute value union.
Definition: ogr_core.h:683
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce=TRUE) CPL_WARN_UNUSED_RESULT
Fetch the extent of this layer.
Definition: ogrlayer.cpp:211
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:354
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:248
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:989