All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataSource.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/datasource/DataSource.cpp
22 
23  \brief An abstract class for data providers like a DBMS, Web Services or a regular file.
24 */
25 
26 // TerraLib
27 #include "../../common/Translator.h"
28 #include "../../geometry/Envelope.h"
29 #include "../dataset/ObjectIdSet.h"
30 #include "../query/DataSetName.h"
31 #include "../query/Field.h"
32 #include "../query/Fields.h"
33 #include "../query/From.h"
34 #include "../query/FromItem.h"
35 #include "../query/Select.h"
36 #include "../query/Where.h"
37 #include "DataSource.h"
38 #include "DataSourceCatalog.h"
39 #include "DataSourceFactory.h"
40 #include "DataSourceTransactor.h"
41 
43 {
44 }
45 
47 {
48 }
49 
50 const std::string& te::da::DataSource::getId() const
51 {
52  return m_id;
53 }
54 
55 void te::da::DataSource::setId(const std::string& id)
56 {
57  m_id = id;
58 }
59 
60 std::auto_ptr<te::da::DataSet> te::da::DataSource::getDataSet(const std::string& name,
61  te::common::TraverseType travType,
62  const te::common::AccessPolicy accessPolicy)
63 {
64  std::auto_ptr<DataSourceTransactor> t = getTransactor();
65  return t->getDataSet(name, travType, false, accessPolicy);
66 }
67 
68 std::auto_ptr<te::da::DataSet> te::da::DataSource::getDataSet(const std::string& name,
69  const std::string& propertyName,
70  const te::gm::Envelope* e,
72  te::common::TraverseType travType,
73  const te::common::AccessPolicy accessPolicy)
74 {
75  std::auto_ptr<DataSourceTransactor> t = getTransactor();
76  return t->getDataSet(name, propertyName, e, r, travType, false, accessPolicy);
77 }
78 
79 std::auto_ptr<te::da::DataSet> te::da::DataSource::getDataSet(const std::string& name,
80  const std::string& propertyName,
81  const te::gm::Geometry* g,
83  te::common::TraverseType travType,
84  const te::common::AccessPolicy accessPolicy)
85 {
86  std::auto_ptr<DataSourceTransactor> t = getTransactor();
87  return t->getDataSet(name, propertyName, g, r, travType, false, accessPolicy);
88 }
89 
90 std::auto_ptr<te::da::DataSet> te::da::DataSource::getDataSet(const std::string& name,
91  const te::da::ObjectIdSet* oids,
92  te::common::TraverseType travType,
93  const te::common::AccessPolicy accessPolicy)
94 {
95  std::auto_ptr<DataSourceTransactor> t = getTransactor();
96  return t->getDataSet(name, oids, travType, false, accessPolicy);
97 }
98 
99 std::auto_ptr<te::da::DataSet> te::da::DataSource::query(const Select& q, te::common::TraverseType travType,
100  const te::common::AccessPolicy accessPolicy)
101 {
102  std::auto_ptr<DataSourceTransactor> t = getTransactor();
103  return t->query(q, travType, false,accessPolicy);
104 }
105 
106 std::auto_ptr<te::da::DataSet> te::da::DataSource::query(const std::string& query, te::common::TraverseType travType,
107  const te::common::AccessPolicy accessPolicy)
108 {
109  std::auto_ptr<DataSourceTransactor> t = getTransactor();
110  return t->query(query, travType, false,accessPolicy);
111 }
112 
113 void te::da::DataSource::execute(const Query& command)
114 {
115  std::auto_ptr<DataSourceTransactor> t = getTransactor();
116  return t->execute(command);
117 }
118 
119 void te::da::DataSource::execute(const std::string& command)
120 {
121  std::auto_ptr<DataSourceTransactor> t = getTransactor();
122  return t->execute(command);
123 }
124 
125 std::string te::da::DataSource::escape(const std::string& value)
126 {
127  std::auto_ptr<DataSourceTransactor> t = getTransactor();
128  return t->escape(value);
129 }
130 
131 bool te::da::DataSource::isDataSetNameValid(const std::string& datasetName)
132 {
133  std::auto_ptr<DataSourceTransactor> t = getTransactor();
134  return t->isDataSetNameValid(datasetName);
135 }
136 
137 bool te::da::DataSource::isPropertyNameValid(const std::string& propertyName)
138 {
139  std::auto_ptr<DataSourceTransactor> t = getTransactor();
140  return t->isPropertyNameValid(propertyName);
141 }
142 
143 std::vector<std::string> te::da::DataSource::getDataSetNames()
144 {
145  std::auto_ptr<DataSourceTransactor> t = getTransactor();
146  return t->getDataSetNames();
147 }
148 
150 {
151  std::auto_ptr<DataSourceTransactor> t = getTransactor();
152  return t->getNumberOfDataSets();
153 }
154 
155 std::auto_ptr<te::da::DataSetType> te::da::DataSource::getDataSetType(const std::string& name)
156 {
157  std::auto_ptr<DataSourceTransactor> t = getTransactor();
158  return t->getDataSetType(name);
159 }
160 
161 boost::ptr_vector<te::dt::Property> te::da::DataSource::getProperties(const std::string& datasetName)
162 {
163  std::auto_ptr<DataSourceTransactor> t = getTransactor();
164  return t->getProperties(datasetName);
165 }
166 
167 std::vector<std::string> te::da::DataSource::getPropertyNames(const std::string& datasetName)
168 {
169  std::auto_ptr<DataSourceTransactor> t = getTransactor();
170  return t->getPropertyNames(datasetName);
171 }
172 
173 std::size_t te::da::DataSource::getNumberOfProperties(const std::string& datasetName)
174 {
175  std::auto_ptr<DataSourceTransactor> t = getTransactor();
176  return t->getNumberOfProperties(datasetName);
177 }
178 
179 bool te::da::DataSource::propertyExists(const std::string& datasetName, const std::string& name)
180 {
181  std::auto_ptr<DataSourceTransactor> t = getTransactor();
182  return t->propertyExists(datasetName, name);
183 }
184 
185 std::auto_ptr<te::dt::Property> te::da::DataSource::getProperty(const std::string& datasetName, const std::string& name)
186 {
187  std::auto_ptr<DataSourceTransactor> t = getTransactor();
188  return t->getProperty(datasetName, name);
189 }
190 
191 std::auto_ptr<te::dt::Property> te::da::DataSource::getProperty(const std::string& datasetName, std::size_t propertyPos)
192 {
193  std::auto_ptr<DataSourceTransactor> t = getTransactor();
194  return t->getProperty(datasetName, propertyPos);
195 }
196 
197 void te::da::DataSource::addProperty(const std::string& datasetName, te::dt::Property* p)
198 {
199  std::auto_ptr<DataSourceTransactor> t = getTransactor();
200  return t->addProperty(datasetName, p);
201 }
202 
203 void te::da::DataSource::dropProperty(const std::string& datasetName, const std::string& name)
204 {
205  std::auto_ptr<DataSourceTransactor> t = getTransactor();
206  return t->dropProperty(datasetName, name);
207 }
208 
209 void te::da::DataSource::renameProperty(const std::string& datasetName,
210  const std::string& propertyName,
211  const std::string& newPropertyName)
212 {
213  std::auto_ptr<DataSourceTransactor> t = getTransactor();
214  return t->renameProperty(datasetName, propertyName, newPropertyName);
215 }
216 
217 std::auto_ptr<te::da::PrimaryKey> te::da::DataSource::getPrimaryKey(const std::string& datasetName)
218 {
219  std::auto_ptr<DataSourceTransactor> t = getTransactor();
220  return t->getPrimaryKey(datasetName);
221 }
222 
223 bool te::da::DataSource::primaryKeyExists(const std::string& datasetName, const std::string& name)
224 {
225  std::auto_ptr<DataSourceTransactor> t = getTransactor();
226  return t->primaryKeyExists(datasetName, name);
227 }
228 
229 void te::da::DataSource::addPrimaryKey(const std::string& datasetName, PrimaryKey* pk)
230 {
231  std::auto_ptr<DataSourceTransactor> t = getTransactor();
232  return t->addPrimaryKey(datasetName, pk);
233 }
234 
235 void te::da::DataSource::dropPrimaryKey(const std::string& datasetName)
236 {
237  std::auto_ptr<DataSourceTransactor> t = getTransactor();
238  return t->dropPrimaryKey(datasetName);
239 }
240 
241 std::auto_ptr<te::da::ForeignKey> te::da::DataSource::getForeignKey(const std::string& datasetName, const std::string& name)
242 {
243  std::auto_ptr<DataSourceTransactor> t = getTransactor();
244  return t->getForeignKey(datasetName, name);
245 }
246 
247 std::vector<std::string> te::da::DataSource::getForeignKeyNames(const std::string& datasetName)
248 {
249  std::auto_ptr<DataSourceTransactor> t = getTransactor();
250  return t->getForeignKeyNames(datasetName);
251 }
252 
253 bool te::da::DataSource::foreignKeyExists(const std::string& datasetName, const std::string& name)
254 {
255  std::auto_ptr<DataSourceTransactor> t = getTransactor();
256  return t->foreignKeyExists(datasetName, name);
257 }
258 
259 void te::da::DataSource::addForeignKey(const std::string& datasetName, ForeignKey* fk)
260 {
261  std::auto_ptr<DataSourceTransactor> t = getTransactor();
262  return t->addForeignKey(datasetName, fk);
263 }
264 
265 void te::da::DataSource::dropForeignKey(const std::string& datasetName, const std::string& fkName)
266 {
267  std::auto_ptr<DataSourceTransactor> t = getTransactor();
268  return t->dropForeignKey(datasetName, fkName);
269 }
270 
271 std::auto_ptr<te::da::UniqueKey> te::da::DataSource::getUniqueKey(const std::string& datasetName,
272  const std::string& name)
273 {
274  std::auto_ptr<DataSourceTransactor> t = getTransactor();
275  return t->getUniqueKey(datasetName, name);
276 }
277 
278 std::vector<std::string> te::da::DataSource::getUniqueKeyNames(const std::string& datasetName)
279 {
280  std::auto_ptr<DataSourceTransactor> t = getTransactor();
281  return t->getUniqueKeyNames(datasetName);
282 }
283 
284 bool te::da::DataSource::uniqueKeyExists(const std::string& datasetName, const std::string& name)
285 {
286  std::auto_ptr<DataSourceTransactor> t = getTransactor();
287  return t->uniqueKeyExists(datasetName, name);
288 }
289 
290 void te::da::DataSource::addUniqueKey(const std::string& datasetName, UniqueKey* uk)
291 {
292  std::auto_ptr<DataSourceTransactor> t = getTransactor();
293  return t->addUniqueKey(datasetName, uk);
294 }
295 
296 void te::da::DataSource::dropUniqueKey(const std::string& datasetName, const std::string& name)
297 {
298  std::auto_ptr<DataSourceTransactor> t = getTransactor();
299  return t->dropUniqueKey(datasetName, name);
300 }
301 
302 std::auto_ptr<te::da::CheckConstraint> te::da::DataSource::getCheckConstraint(const std::string& datasetName,
303  const std::string& name)
304 {
305  std::auto_ptr<DataSourceTransactor> t = getTransactor();
306  return t->getCheckConstraint(datasetName, name);
307 }
308 
309 std::vector<std::string> te::da::DataSource::getCheckConstraintNames(const std::string& datasetName)
310 {
311  std::auto_ptr<DataSourceTransactor> t = getTransactor();
312  return t->getCheckConstraintNames(datasetName);
313 }
314 
315 bool te::da::DataSource::checkConstraintExists(const std::string& datasetName, const std::string& name)
316 {
317  std::auto_ptr<DataSourceTransactor> t = getTransactor();
318  return t->checkConstraintExists(datasetName, name);
319 }
320 
321 void te::da::DataSource::addCheckConstraint(const std::string& datasetName, CheckConstraint* cc)
322 {
323  std::auto_ptr<DataSourceTransactor> t = getTransactor();
324  return t->addCheckConstraint(datasetName, cc);
325 }
326 
327 void te::da::DataSource::dropCheckConstraint(const std::string& datasetName, const std::string& name)
328 {
329  std::auto_ptr<DataSourceTransactor> t = getTransactor();
330  return t->dropCheckConstraint(datasetName, name);
331 }
332 
333 std::auto_ptr<te::da::Index> te::da::DataSource::getIndex(const std::string& datasetName, const std::string& name)
334 {
335  std::auto_ptr<DataSourceTransactor> t = getTransactor();
336  return t->getIndex(datasetName, name);
337 }
338 
339 std::vector<std::string> te::da::DataSource::getIndexNames(const std::string& datasetName)
340 {
341  std::auto_ptr<DataSourceTransactor> t = getTransactor();
342  return t->getIndexNames(datasetName);
343 }
344 
345 bool te::da::DataSource::indexExists(const std::string& datasetName, const std::string& name)
346 {
347  std::auto_ptr<DataSourceTransactor> t = getTransactor();
348  return t->indexExists(datasetName, name);
349 }
350 
351 void te::da::DataSource::addIndex(const std::string& datasetName, Index* idx,
352  const std::map<std::string, std::string>& options)
353 {
354  std::auto_ptr<DataSourceTransactor> t = getTransactor();
355  return t->addIndex(datasetName, idx, options);
356 }
357 
358 void te::da::DataSource::dropIndex(const std::string& datasetName, const std::string& idxName)
359 {
360  std::auto_ptr<DataSourceTransactor> t = getTransactor();
361  return t->dropIndex(datasetName, idxName);
362 }
363 
364 std::auto_ptr<te::da::Sequence> te::da::DataSource::getSequence(const std::string& name)
365 {
366  std::auto_ptr<DataSourceTransactor> t = getTransactor();
367  return t->getSequence(name);
368 }
369 
370 std::vector<std::string> te::da::DataSource::getSequenceNames()
371 {
372  std::auto_ptr<DataSourceTransactor> t = getTransactor();
373  return t->getSequenceNames();
374 }
375 
376 bool te::da::DataSource::sequenceExists(const std::string& name)
377 {
378  std::auto_ptr<DataSourceTransactor> t = getTransactor();
379  return t->sequenceExists(name);
380 }
381 
383 {
384  std::auto_ptr<DataSourceTransactor> t = getTransactor();
385  return t->addSequence(sequence);
386 }
387 
388 void te::da::DataSource::dropSequence(const std::string& name)
389 {
390  std::auto_ptr<DataSourceTransactor> t = getTransactor();
391  return t->dropSequence(name);
392 }
393 
394 std::auto_ptr<te::gm::Envelope> te::da::DataSource::getExtent(const std::string& datasetName, const std::string& propertyName)
395 {
396  std::auto_ptr<DataSourceTransactor> t = getTransactor();
397  return t->getExtent(datasetName, propertyName);
398 }
399 
400 std::auto_ptr<te::gm::Envelope> te::da::DataSource::getExtent(const std::string& datasetName, std::size_t propertyPos)
401 {
402  std::auto_ptr<DataSourceTransactor> t = getTransactor();
403  return t->getExtent(datasetName, propertyPos);
404 }
405 
406 std::size_t te::da::DataSource::getNumberOfItems(const std::string& datasetName)
407 {
408  std::auto_ptr<DataSourceTransactor> t = getTransactor();
409  return t->getNumberOfItems(datasetName);
410 }
411 
413 {
414  std::auto_ptr<DataSourceTransactor> t = getTransactor();
415  return t->hasDataSets();
416 }
417 
418 bool te::da::DataSource::dataSetExists(const std::string& name)
419 {
420  std::auto_ptr<DataSourceTransactor> t = getTransactor();
421  return t->dataSetExists(name);
422 }
423 
424 void te::da::DataSource::createDataSet(DataSetType* dt, const std::map<std::string, std::string>& options)
425 {
426  std::auto_ptr<DataSourceTransactor> t = getTransactor();
427  return t->createDataSet(dt, options);
428 }
429 
430 void te::da::DataSource::cloneDataSet(const std::string& name,
431  const std::string& cloneName,
432  const std::map<std::string, std::string>& options)
433 {
434  std::auto_ptr<DataSourceTransactor> t = getTransactor();
435  return t->cloneDataSet(name, cloneName, options);
436 }
437 
438 void te::da::DataSource::dropDataSet(const std::string& name)
439 {
440  std::auto_ptr<DataSourceTransactor> t = getTransactor();
441  return t->dropDataSet(name);
442 }
443 
444 void te::da::DataSource::renameDataSet(const std::string& name, const std::string& newName)
445 {
446  std::auto_ptr<DataSourceTransactor> t = getTransactor();
447  return t->renameDataSet(name, newName);
448 }
449 
450 void te::da::DataSource::add(const std::string& datasetName,
451  DataSet* d,
452  const std::map<std::string, std::string>& options,
453  std::size_t limit)
454 {
455  std::auto_ptr<DataSourceTransactor> t = getTransactor();
456  return t->add(datasetName, d, options, limit);
457 }
458 
459 void te::da::DataSource::remove(const std::string& datasetName, const ObjectIdSet* oids)
460 {
461  std::auto_ptr<DataSourceTransactor> t = getTransactor();
462  return t->remove(datasetName);
463 }
464 
465 void te::da::DataSource::update(const std::string& datasetName,
466  DataSet* dataset,
467  const std::vector<std::size_t>& properties,
468  const ObjectIdSet* oids,
469  const std::map<std::string, std::string>& options,
470  std::size_t limit)
471 {
472  std::auto_ptr<DataSourceTransactor> t = getTransactor();
473  return t->update(datasetName, dataset, properties, oids, options, limit);
474 }
475 
476 std::auto_ptr<te::da::DataSource> te::da::DataSource::create(const std::string& dsType, const std::map<std::string, std::string>& dsInfo)
477 {
478  std::auto_ptr<DataSource> ds(DataSourceFactory::make(dsType));
479 
480  if(ds.get() == 0)
481  throw Exception(TR_DATAACCESS("Could not find the appropriate factory to create a data source instance!"));
482 
483  ds->create(dsInfo);
484 
485  return ds;
486 }
487 
488 void te::da::DataSource::drop(const std::string& dsType, const std::map<std::string, std::string>& dsInfo)
489 {
490  std::auto_ptr<DataSource> ds(DataSourceFactory::make(dsType));
491 
492  if(ds.get() == 0)
493  throw Exception(TR_DATAACCESS("Could not find the appropriate factory to create a data source instance!"));
494 
495  ds->drop(dsInfo);
496 }
497 
498 bool te::da::DataSource::exists(const std::string& dsType, const std::map<std::string, std::string>& dsInfo)
499 {
500  std::auto_ptr<DataSource> ds(DataSourceFactory::make(dsType));
501 
502  if(ds.get() == 0)
503  throw Exception(TR_DATAACCESS("Could not find the appropriate factory in order to create a data source instance!"));
504 
505  return ds->exists(dsInfo);
506 }
507 
508 std::vector<std::string> te::da::DataSource::getDataSourceNames(const std::string& dsType, const std::map<std::string, std::string>& dsInfo)
509 {
510  std::auto_ptr<DataSource> ds(DataSourceFactory::make(dsType));
511 
512  if(ds.get() == 0)
513  throw Exception(TR_DATAACCESS("Could not find the appropriate factory to create a data source instance!"));
514 
515  return ds->getDataSourceNames(dsInfo);
516 }
517 
518 std::vector<std::string> te::da::DataSource::getEncodings(const std::string& dsType, const std::map<std::string, std::string>& dsInfo)
519 {
520  std::auto_ptr<DataSource> ds(DataSourceFactory::make(dsType));
521 
522  if(ds.get() == 0)
523  throw Exception(TR_DATAACCESS("Could not find the appropriate factory to create a data source instance!"));
524 
525  return ds->getEncodings(dsInfo);
526 }
static std::vector< std::string > getDataSourceNames(const std::string &dsType, const std::map< std::string, std::string > &info)
It returns the data source names available in the driver.
Definition: DataSource.cpp:508
virtual void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
Definition: DataSource.cpp:444
static std::auto_ptr< DataSource > create(const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
It creates a new repository for a data source.
Definition: DataSource.cpp:476
virtual bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid.
Definition: DataSource.cpp:137
virtual void execute(const Query &command)
It executes the specified command using a generic query representation.
Definition: DataSource.cpp:113
virtual void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
Definition: DataSource.cpp:203
It describes an index associated to a DataSetType.
Definition: Index.h:54
A factory for data sources.
virtual void cloneDataSet(const std::string &name, const std::string &cloneName, const std::map< std::string, std::string > &options)
It clones the dataset in the data source.
Definition: DataSource.cpp:430
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:53
virtual bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
Definition: DataSource.cpp:418
virtual void createDataSet(DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
Definition: DataSource.cpp:424
virtual boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
Definition: DataSource.cpp:161
virtual std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source.
Definition: DataSource.cpp:143
static bool exists(const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
It checks if the data source exists with the connection information and the driver type...
Definition: DataSource.cpp:498
virtual void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
Definition: DataSource.cpp:265
void setId(const std::string &id)
It sets the data source identification.
Definition: DataSource.cpp:55
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
virtual ~DataSource()
Virtual destructor.
Definition: DataSource.cpp:46
virtual std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
Definition: DataSource.cpp:247
virtual std::auto_ptr< te::da::UniqueKey > getUniqueKey(const std::string &datasetName, const std::string &name)
It gets the unique key in the dataset with the given name.
Definition: DataSource.cpp:271
virtual void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the given dataset.
Definition: DataSource.cpp:358
virtual void dropSequence(const std::string &name)
It removes the sequence from the data source.
Definition: DataSource.cpp:388
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
virtual bool isDataSetNameValid(const std::string &datasetName)
It checks if the given dataset name is valid.
Definition: DataSource.cpp:131
virtual void addPrimaryKey(const std::string &datasetName, PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
Definition: DataSource.cpp:229
static void drop(const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
It removes a data source identified by its connection information and the driver type.
Definition: DataSource.cpp:488
static std::auto_ptr< DataSource > make(const std::string &dsType)
It describes a sequence (a number generator).
Definition: Sequence.h:56
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
virtual std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
Definition: DataSource.cpp:309
virtual std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
Definition: DataSource.cpp:217
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:122
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
virtual void addSequence(Sequence *sequence)
It adds a new sequence in the data source.
Definition: DataSource.cpp:382
virtual std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
Definition: DataSource.cpp:173
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
DataSource()
Default constructor that can be called by subclasses.
Definition: DataSource.cpp:42
virtual void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
Definition: DataSource.cpp:459
virtual std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
Definition: DataSource.cpp:167
static std::vector< std::string > getEncodings(const std::string &dsType, const std::map< std::string, std::string > &info)
It gets the encoding names of the data source.
Definition: DataSource.cpp:518
virtual void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
Definition: DataSource.cpp:327
virtual void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
Definition: DataSource.cpp:197
virtual std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
Definition: DataSource.cpp:149
virtual void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
Definition: DataSource.cpp:296
A Query is independent from the data source language/dialect.
Definition: Query.h:46
virtual void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
Definition: DataSource.cpp:209
virtual void addForeignKey(const std::string &datasetName, ForeignKey *fk)
It adds a foreign key constraint to a dataset.
Definition: DataSource.cpp:259
virtual void addCheckConstraint(const std::string &datasetName, CheckConstraint *cc)
It adds a check constraint to the dataset.
Definition: DataSource.cpp:321
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
virtual bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
Definition: DataSource.cpp:376
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
virtual std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
Definition: DataSource.cpp:125
virtual bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
Definition: DataSource.cpp:223
virtual std::auto_ptr< Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
Definition: DataSource.cpp:364
virtual std::auto_ptr< DataSet > query(const Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. This method always returns a dis...
Definition: DataSource.cpp:99
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
virtual void add(const std::string &datasetName, DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0)
It adds data items to the dataset in the data source.
Definition: DataSource.cpp:450
#define TR_DATAACCESS(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:95
virtual bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
Definition: DataSource.cpp:179
virtual void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
Definition: DataSource.cpp:438
A class that models the description of a dataset.
Definition: DataSetType.h:72
virtual void update(const std::string &datasetName, DataSet *dataset, const std::vector< std::size_t > &properties, const te::da::ObjectIdSet *oids, const std::map< std::string, std::string > &options, std::size_t limit=0)
It updates the contents of a dataset for the set of data items.
Definition: DataSource.cpp:465
virtual std::auto_ptr< te::gm::Envelope > getExtent(const std::string &datasetName, const std::string &propertyName)
It retrieves the bounding rectangle of the spatial property for the given dataset.
Definition: DataSource.cpp:394
virtual std::auto_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset.
Definition: DataSource.cpp:185
virtual void addUniqueKey(const std::string &datasetName, UniqueKey *uk)
It adds a unique key constraint to the dataset.
Definition: DataSource.cpp:290
It models a property definition.
Definition: Property.h:59
virtual std::auto_ptr< te::da::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset.
Definition: DataSource.cpp:333
virtual std::auto_ptr< DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. This method always returns a disconnected dataset...
Definition: DataSource.cpp:60
const std::string & getId() const
An identification value for the data source.
Definition: DataSource.cpp:50
virtual std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
Definition: DataSource.cpp:278
virtual std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
Definition: DataSource.cpp:406
virtual std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
Definition: DataSource.cpp:339
virtual void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
Definition: DataSource.cpp:235
virtual std::auto_ptr< ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
Definition: DataSource.cpp:241
A class that describes a check constraint.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
It represents the system catalog of a DataSource.
virtual std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
Definition: DataSource.cpp:370
virtual bool hasDataSets()
It checks if the data source has any dataset.
Definition: DataSource.cpp:412
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
virtual std::auto_ptr< te::da::CheckConstraint > getCheckConstraint(const std::string &datasetName, const std::string &name)
It gets the check constraint of the dataset with the given name.
Definition: DataSource.cpp:302
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111
virtual std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
Definition: DataSource.cpp:155
virtual bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset.
Definition: DataSource.cpp:284
virtual bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
Definition: DataSource.cpp:345
virtual void addIndex(const std::string &datasetName, Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset.
Definition: DataSource.cpp:351
virtual bool checkConstraintExists(const std::string &datasetName, const std::string &name)
It checks if a check-constraint with the given name exists in the data source.
Definition: DataSource.cpp:315
virtual bool foreignKeyExists(const std::string &datasetName, const std::string &name)
It checks if a foreign key with the given name exists in the data source.
Definition: DataSource.cpp:253