ogr_gensql.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _OGR_GENSQL_H_INCLUDED
00031 #define _OGR_GENSQL_H_INCLUDED
00032
00033 #include "ogrsf_frmts.h"
00034 #include "swq.h"
00035 #include "cpl_hash_set.h"
00036
00037
00038
00039
00040
00041 class CPL_DLL OGRGenSQLResultsLayer : public OGRLayer
00042 {
00043 private:
00044 OGRDataSource *poSrcDS;
00045 OGRLayer *poSrcLayer;
00046 void *pSelectInfo;
00047
00048 char *pszWHERE;
00049
00050 OGRLayer **papoTableLayers;
00051
00052 OGRFeatureDefn *poDefn;
00053
00054 int PrepareSummary();
00055
00056 int nIndexSize;
00057 long *panFIDIndex;
00058
00059 int nNextIndexFID;
00060 OGRFeature *poSummaryFeature;
00061
00062 int iFIDFieldIndex;
00063
00064 OGRField *pasOrderByIndex;
00065
00066 int nExtraDSCount;
00067 OGRDataSource **papoExtraDS;
00068
00069 OGRFeature *TranslateFeature( OGRFeature * );
00070 void CreateOrderByIndex();
00071 void SortIndexSection( OGRField *pasIndexFields,
00072 int nStart, int nEntries );
00073 int Compare( OGRField *pasFirst, OGRField *pasSecond );
00074
00075 void ClearFilters();
00076
00077 void SetIgnoredFields();
00078 void ExploreExprForIgnoredFields(swq_expr_node* expr, CPLHashSet* hSet);
00079 void AddFieldDefnToSet(int iTable, int iColumn, CPLHashSet* hSet);
00080
00081 public:
00082 OGRGenSQLResultsLayer( OGRDataSource *poSrcDS,
00083 void *pSelectInfo,
00084 OGRGeometry *poSpatFilter,
00085 const char *pszWHERE );
00086 virtual ~OGRGenSQLResultsLayer();
00087
00088 virtual OGRGeometry *GetSpatialFilter();
00089
00090 virtual void ResetReading();
00091 virtual OGRFeature *GetNextFeature();
00092 virtual OGRErr SetNextByIndex( long nIndex );
00093 virtual OGRFeature *GetFeature( long nFID );
00094
00095 virtual OGRFeatureDefn *GetLayerDefn();
00096
00097 virtual OGRSpatialReference *GetSpatialRef();
00098
00099 virtual int GetFeatureCount( int bForce = TRUE );
00100 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
00101
00102 virtual int TestCapability( const char * );
00103 };
00104
00105 #endif
00106