QueryCapabilities.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/dataaccess/query/QueryCapabilities.cpp
22 
23  \brief A class that informs the query support of a given data source.
24 */
25 
26 // TerraLib
27 #include "QueryCapabilities.h"
28 
30  : m_sqlDialect(false),
31  m_spatialSQLDialect(false),
32  m_insert(false),
33  m_update(false),
34  m_delete(false),
35  m_create(false),
36  m_drop(false),
37  m_alter(false),
38  m_select(false),
39  m_selectInto(false)
40 {
41 }
42 
44 
46 {
47  return m_sqlDialect;
48 }
49 
51 {
52  m_sqlDialect = support;
53 }
54 
56 {
57  return m_spatialSQLDialect;
58 }
59 
61 {
62  m_spatialSQLDialect = support;
63 }
64 
66 {
67  return m_insert;
68 }
69 
71 {
72  m_insert = support;
73 }
74 
76 {
77  return m_update;
78 }
79 
81 {
82  m_update = support;
83 }
84 
86 {
87  return m_delete;
88 }
89 
91 {
92  m_delete = support;
93 }
94 
96 {
97  return m_create;
98 }
99 
101 {
102  m_create = support;
103 }
104 
106 {
107  return m_drop;
108 }
109 
111 {
112  m_drop = support;
113 }
114 
116 {
117  return m_alter;
118 }
119 
121 {
122  m_alter = support;
123 }
124 
126 {
127  return m_select;
128 }
129 
131 {
132  m_select = support;
133 }
134 
136 {
137  return m_selectInto;
138 }
139 
141 {
142  m_selectInto = support;
143 }
144 
146 {
147  m_sqlDialect = true;
148  m_spatialSQLDialect = true;
149  m_insert = true;
150  m_update = true;
151  m_delete = true;
152  m_create = true;
153  m_drop = true;
154  m_alter = true;
155  m_select = true;
156  m_selectInto = true;
157 }
158 
159 const std::set<std::string>& te::da::QueryCapabilities::getSpatialOperators() const
160 {
161  return m_spatialOperators;
162 }
163 
165 {
166  m_spatialOperators.insert(op);
167 }
168 
170 {
172 }
173 
175 {
176  m_spatialTopologicOperators.insert(op);
177 }
178 
179 const std::set<std::string>& te::da::QueryCapabilities::getSpatialMetricOperators() const
180 {
182 }
183 
185 {
186  m_spatialMetricOperators.insert(op);
187 }
188 
189 const std::set<std::string>& te::da::QueryCapabilities::getSpatialNewGeomOperators() const
190 {
192 }
193 
195 {
196  m_spatialNewGeomOperators.insert(op);
197 }
198 
199 const std::set<std::string>& te::da::QueryCapabilities::getLogicalOperators() const
200 {
201  return m_logicalOperators;
202 }
203 
205 {
206  m_logicalOperators.insert(op);
207 }
208 
209 const std::set<std::string>& te::da::QueryCapabilities::getComparsionOperators() const
210 {
211  return m_comparsionOperators;
212 }
213 
215 {
216  m_comparsionOperators.insert(op);
217 }
218 
219 const std::set<std::string>& te::da::QueryCapabilities::getArithmeticOperators() const
220 {
221  return m_arithmeticOperators;
222 }
223 
225 {
226  m_arithmeticOperators.insert(op);
227 }
228 
229 const std::set<std::string>& te::da::QueryCapabilities::getFunctions() const
230 {
231  return m_functions;
232 }
233 
234 void te::da::QueryCapabilities::addFunction(const std::string& op)
235 {
236  m_functions.insert(op);
237 }
238 
239 const std::set<te::gm::GeomType>& te::da::QueryCapabilities::getGeometryOperands() const
240 {
241  return m_geomOperands;
242 }
243 
245 {
246  m_geomOperands.insert(type);
247 }
const std::set< std::string > & getComparsionOperators() const
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
bool m_alter
A flag that indicates if the data source supports the ALTER command.
bool m_create
A flag that indicates if the data source supports the CREATE command.
void setSupportAlter(const bool &support)
std::set< std::string > m_spatialMetricOperators
The names of spatial metric supported operators (area, lenght, etc).
void setSupportSpatialSQLDialect(const bool &support)
const std::set< std::string > & getSpatialMetricOperators() const
void addSpatialTopologicOperator(const std::string &op)
std::set< te::gm::GeomType > m_geomOperands
The types of geometry supported operands.
void setSupportSelect(const bool &support)
bool m_drop
A flag that indicates if the data source supports the DROP command.
void addComparsionOperator(const std::string &op)
const std::set< std::string > & getFunctions() const
const std::set< std::string > & getArithmeticOperators() const
void addSpatialNewGeomOperator(const std::string &op)
bool m_update
A flag that indicates if the data source supports the UPDATE command.
void setSupportInsert(const bool &support)
bool m_delete
A flag that indicates if the data source supports the DELETE command.
void addLogicalOperator(const std::string &op)
void setSupportCreate(const bool &support)
const std::set< std::string > & getLogicalOperators() const
const std::set< te::gm::GeomType > & getGeometryOperands() const
void addSpatialOperator(const std::string &op)
bool m_selectInto
A flag that indicates if the data source supports the SELECT INTO command.
void setSupportSelectInto(const bool &support)
std::set< std::string > m_comparsionOperators
The names of comparsion supported operators.
void setSupportDrop(const bool &support)
void addGeometryOperand(const te::gm::GeomType &type)
std::set< std::string > m_functions
The names of supported functions.
const std::set< std::string > & getSpatialNewGeomOperators() const
const std::set< std::string > & getSpatialOperators() const
std::set< std::string > m_spatialOperators
The names of other spatial supported operators.
bool supportsSpatialSQLDialect() const
void setSupportSQLDialect(const bool &support)
void setSupportUpdate(const bool &support)
void addFunction(const std::string &op)
const std::set< std::string > & getSpatialTopologicOperators() const
~QueryCapabilities()
Destructor.
void addArithmeticOperator(const std::string &op)
bool m_insert
A flag that indicates if the data source supports the INSERT command.
bool m_spatialSQLDialect
A flag that indicates if the data source supports spatial Query API.
bool m_select
A flag that indicates if the data source supports the SELECT command.
std::set< std::string > m_spatialTopologicOperators
The names of topological supported operators (touches, crosses, etc).
bool m_sqlDialect
A flag that indicates if the data source supports Query API.
void addSpatialMetricOperator(const std::string &op)
void setSupportDelete(const bool &support)
std::set< std::string > m_arithmeticOperators
The names of arithmetic supported operators.
std::set< std::string > m_logicalOperators
The names of logical supported operators.
std::set< std::string > m_spatialNewGeomOperators
The names of spatial supported operators that generate new geometries (centroid, buffer, union, intersection,etc).
A class that informs the query support of a given data source.