OGR
ogr_gensql.h
1 /******************************************************************************
2  * $Id: ogr_gensql.h 23531 2011-12-11 19:11:56Z rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Classes related to generic implementation of ExecuteSQL().
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2002, Frank Warmerdam
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #ifndef _OGR_GENSQL_H_INCLUDED
31 #define _OGR_GENSQL_H_INCLUDED
32 
33 #include "ogrsf_frmts.h"
34 #include "swq.h"
35 #include "cpl_hash_set.h"
36 
37 /************************************************************************/
38 /* OGRGenSQLResultsLayer */
39 /************************************************************************/
40 
41 class CPL_DLL OGRGenSQLResultsLayer : public OGRLayer
42 {
43  private:
44  OGRDataSource *poSrcDS;
45  OGRLayer *poSrcLayer;
46  void *pSelectInfo;
47 
48  char *pszWHERE;
49 
50  OGRLayer **papoTableLayers;
51 
52  OGRFeatureDefn *poDefn;
53 
54  int PrepareSummary();
55 
56  int nIndexSize;
57  long *panFIDIndex;
58 
59  int nNextIndexFID;
60  OGRFeature *poSummaryFeature;
61 
62  int iFIDFieldIndex;
63 
64  OGRField *pasOrderByIndex;
65 
66  int nExtraDSCount;
67  OGRDataSource **papoExtraDS;
68 
69  OGRFeature *TranslateFeature( OGRFeature * );
70  void CreateOrderByIndex();
71  void SortIndexSection( OGRField *pasIndexFields,
72  int nStart, int nEntries );
73  int Compare( OGRField *pasFirst, OGRField *pasSecond );
74 
75  void ClearFilters();
76 
77  void FindAndSetIgnoredFields();
78  void ExploreExprForIgnoredFields(swq_expr_node* expr, CPLHashSet* hSet);
79  void AddFieldDefnToSet(int iTable, int iColumn, CPLHashSet* hSet);
80 
81  int ContainGeomSpecialField(swq_expr_node* expr);
82  public:
84  void *pSelectInfo,
85  OGRGeometry *poSpatFilter,
86  const char *pszWHERE,
87  const char *pszDialect );
88  virtual ~OGRGenSQLResultsLayer();
89 
90  virtual OGRGeometry *GetSpatialFilter();
91 
92  virtual void ResetReading();
93  virtual OGRFeature *GetNextFeature();
94  virtual OGRErr SetNextByIndex( long nIndex );
95  virtual OGRFeature *GetFeature( long nFID );
96 
97  virtual OGRFeatureDefn *GetLayerDefn();
98 
100 
101  virtual int GetFeatureCount( int bForce = TRUE );
102  virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
103 
104  virtual int TestCapability( const char * );
105 };
106 
107 #endif /* ndef _OGR_GENSQL_H_INCLUDED */
108 

Generated for GDAL by doxygen 1.8.2.