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