All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Transactor.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/stmememory/Transactor.cpp
22 
23  \brief An implementation of DataSourceTransactor class for the ST in-memory driver.
24 */
25 
26 // TerraLib
27 #include "../common/Translator.h"
28 #include "../dataaccess/dataset/DataSetType.h"
29 #include "../dataaccess/dataset/PrimaryKey.h"
30 #include "../datatype/DateTimePeriod.h"
31 #include "DataSet.h"
32 #include "DataSource.h"
33 #include "Transactor.h"
34 #include "Exception.h"
35 
36 
38  m_ds(parent)
39 {
40 }
41 
43 {
44 }
45 
47 {
48  return m_ds;
49 }
50 
52 {
53  return;
54 }
55 
57 {
58  return;
59 }
60 
62 {
63  return;
64 }
65 
67 {
68  return false;
69 }
70 
71 std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
72  te::common::TraverseType /*travType*/ ,
73  bool /*connected*/,
75 {
76  //It creates a new DataSet that shares the internal observations.
77  DataSet* ds = new DataSet(*getData(name), false);
78  return std::auto_ptr<te::da::DataSet>(ds);
79 }
80 
81 std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
82  const std::string& propertyName,
83  const te::gm::Envelope* e,
85  te::common::TraverseType /*travType*/,
86  bool /*connected*/,
88 {
89  te::da::DataSetType* type = getType(name);
90  DataSet* ds = getData(name);
91  if(type->getPropertyPosition(propertyName) != ds->getGeomPropIdx())
92  throw Exception("Not supported by ST In-Memory driver!");
93  return std::auto_ptr<te::da::DataSet>(ds->filter(e, r));
94 }
95 
96 std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
97  const std::string& propertyName,
98  const te::gm::Geometry* g,
100  te::common::TraverseType /*travType*/,
101  bool /*connected*/,
103 {
104  te::da::DataSetType* type = getType(name);
105  DataSet* ds = getData(name);
106  if(type->getPropertyPosition(propertyName) != ds->getGeomPropIdx())
107  throw Exception("Not supported by ST In-Memory driver!");
108  return std::auto_ptr<te::da::DataSet>(ds->filter(g, r));
109 }
110 
111 std::auto_ptr<te::da::DataSet> te::stmem::Transactor::query(const te::da::Select& /*q*/,
112  te::common::TraverseType /*travType*/, bool /*connected*/,
114 {
115  return std::auto_ptr<te::da::DataSet>(0);
116 }
117 
118 std::auto_ptr<te::da::DataSet> te::stmem::Transactor::query(const std::string& /*query*/,
119  te::common::TraverseType /*travType*/,
120  bool /*connected*/,
122 {
123  return std::auto_ptr<te::da::DataSet>(0);
124 }
125 
127 {
128  return;
129 }
130 
131 void te::stmem::Transactor::execute(const std::string& /*command*/)
132 {
133  return;
134 }
135 
136 std::auto_ptr<te::da::PreparedQuery>
137 te::stmem::Transactor::getPrepared(const std::string& /*qName*/)
138 {
139  return std::auto_ptr<te::da::PreparedQuery> (0);
140 }
141 
142 std::auto_ptr<te::da::BatchExecutor>
144 {
145  return std::auto_ptr<te::da::BatchExecutor> (0);
146 }
147 
149 {
150  return;
151 }
152 
154 {
155  return 0;
156 }
157 
158 std::string te::stmem::Transactor::escape(const std::string& value)
159 {
160  return "";
161 }
162 
163 bool te::stmem::Transactor::isDataSetNameValid(const std::string& datasetName)
164 {
165  std::map<std::string, DataSet*>::const_iterator it = m_ds->m_datasets.find(datasetName);
166  if(it==m_ds->m_datasets.end())
167  return true;
168  return false;
169 }
170 
171 bool te::stmem::Transactor::isPropertyNameValid(const std::string& /*propertyName*/)
172 {
173  return true;
174 }
175 
176 std::vector<std::string> te::stmem::Transactor::getDataSetNames()
177 {
178  std::vector<std::string> result;
179  std::map<std::string, DataSet*>::const_iterator it = m_ds->m_datasets.begin();
180  if(it!=m_ds->m_datasets.end())
181  {
182  result.push_back(it->first);
183  ++it;
184  }
185  return result;
186 }
187 
189 {
190  return m_ds->m_datasets.size();
191 }
192 
193 std::auto_ptr<te::da::DataSetType> te::stmem::Transactor::getDataSetType(const std::string& name)
194 {
195  te::da::DataSetType* type = getType(name);
196  return std::auto_ptr<te::da::DataSetType>(static_cast<te::da::DataSetType*>(type->clone()));
197 }
198 
199 boost::ptr_vector<te::dt::Property> te::stmem::Transactor::getProperties(const std::string& datasetName)
200 {
201  boost::ptr_vector<te::dt::Property> properties;
202 
203  te::da::DataSetType* type = getType(datasetName);
204 
205  const std::size_t np = type->size();
206 
207  for(std::size_t i = 0; i != np; ++i)
208  properties.push_back(type->getProperty(i)->clone());
209 
210  return properties;
211 }
212 
213 std::auto_ptr<te::dt::Property>
214 te::stmem::Transactor::getProperty(const std::string& datasetName, const std::string& name)
215 {
216  te::da::DataSetType* type = getType(datasetName);
217 
218  return std::auto_ptr<te::dt::Property>(type->getProperty(name)->clone());
219 }
220 
221 std::auto_ptr<te::dt::Property>
222 te::stmem::Transactor::getProperty(const std::string& datasetName, std::size_t propertyPos)
223 {
224  te::da::DataSetType* type = getType(datasetName);
225 
226  return std::auto_ptr<te::dt::Property>(type->getProperty(propertyPos)->clone());
227 }
228 
229 std::vector<std::string> te::stmem::Transactor::getPropertyNames(const std::string& datasetName)
230 {
231  std::vector<std::string> propertyNames;
232 
233  te::da::DataSetType* type = getType(datasetName);
234 
235  const std::size_t np = type->size();
236 
237  for(std::size_t i = 0; i != np; ++i)
238  propertyNames.push_back(type->getProperty(i)->getName());
239 
240  return propertyNames;
241 }
242 
243 std::size_t te::stmem::Transactor::getNumberOfProperties(const std::string& datasetName)
244 {
245  te::da::DataSetType* type = getType(datasetName);
246 
247  return type->size();
248 }
249 
250 bool te::stmem::Transactor::propertyExists(const std::string& datasetName, const std::string& name)
251 {
252  te::da::DataSetType* type = getType(datasetName);
253 
254  if(type->getProperty(name)!=0)
255  return true;
256 
257  return false;
258 }
259 
260 void te::stmem::Transactor::addProperty(const std::string& /*datasetName*/, te::dt::Property* /*p*/)
261 {
262  return;
263 }
264 
265 void te::stmem::Transactor::dropProperty(const std::string& /*datasetName*/, const std::string& /*name*/)
266 {
267  return;
268 }
269 
270 void te::stmem::Transactor::renameProperty(const std::string& /*datasetName*/,
271  const std::string& /*propertyName*/,
272  const std::string& /*newPropertyName*/)
273 {
274  return;
275 }
276 
277 std::auto_ptr<te::da::PrimaryKey> te::stmem::Transactor::getPrimaryKey(const std::string& datasetName)
278 {
279  te::da::DataSetType* type = getType(datasetName);
280 
281  return std::auto_ptr<te::da::PrimaryKey>(static_cast<te::da::PrimaryKey*>(type->getPrimaryKey()->clone()));
282 }
283 
284 bool te::stmem::Transactor::primaryKeyExists(const std::string& datasetName, const std::string& name)
285 {
286  te::da::DataSetType* type = getType(datasetName);
287  te::da::PrimaryKey* pk = type->getPrimaryKey();
288 
289  if(pk==0)
290  return false;
291 
292  if(pk->getName()==name)
293  return true;
294 
295  return false;
296 }
297 
298 void te::stmem::Transactor::addPrimaryKey(const std::string& datasetName, te::da::PrimaryKey* pk)
299 {
300  te::da::DataSetType* type = getType(datasetName);
301  type->add(pk);
302 }
303 
304 void te::stmem::Transactor::dropPrimaryKey(const std::string& /*datasetName*/)
305 {
306  return;
307 }
308 
309 std::auto_ptr<te::da::ForeignKey>
310 te::stmem::Transactor::getForeignKey(const std::string& /*datasetName*/, const std::string& /*name*/)
311 {
312  return std::auto_ptr<te::da::ForeignKey>(0);
313 }
314 
315 std::vector<std::string> te::stmem::Transactor::getForeignKeyNames(const std::string& /*datasetName*/)
316 {
317  return std::vector<std::string>();
318 }
319 
320 bool te::stmem::Transactor::foreignKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
321 {
322  return false;
323 }
324 
325 void te::stmem::Transactor::addForeignKey(const std::string& /*datasetName*/, te::da::ForeignKey* /*fk*/)
326 {
327  return;
328 }
329 
330 void te::stmem::Transactor::dropForeignKey(const std::string& /*datasetName*/, const std::string& /*fkName*/)
331 {
332  return;
333 }
334 
335 std::auto_ptr<te::da::UniqueKey> te::stmem::Transactor::getUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
336 {
337  return std::auto_ptr<te::da::UniqueKey>(0);
338 }
339 
340 std::vector<std::string> te::stmem::Transactor::getUniqueKeyNames(const std::string& /*datasetName*/)
341 {
342  return std::vector<std::string>(0);
343 }
344 
345 bool te::stmem::Transactor::uniqueKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
346 {
347  return false;
348 }
349 
350 void te::stmem::Transactor::addUniqueKey(const std::string& /*datasetName*/, te::da::UniqueKey* /*uk*/)
351 {
352  return;
353 }
354 
355 void te::stmem::Transactor::dropUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
356 {
357  return;
358 }
359 
360 std::auto_ptr<te::da::CheckConstraint> te::stmem::Transactor::getCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
361 {
362  return std::auto_ptr<te::da::CheckConstraint>(0);
363 }
364 
365 std::vector<std::string> te::stmem::Transactor::getCheckConstraintNames(const std::string& /*datasetName*/)
366 {
367  return std::vector<std::string>(0);
368 }
369 
370 bool te::stmem::Transactor::checkConstraintExists(const std::string& /*datasetName*/, const std::string& /*name*/)
371 {
372  return false;
373 }
374 
375 void te::stmem::Transactor::addCheckConstraint(const std::string& /*datasetName*/, te::da::CheckConstraint* /*cc*/)
376 {
377  return;
378 }
379 
380 void te::stmem::Transactor::dropCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
381 {
382  return;
383 }
384 
385 std::auto_ptr<te::da::Index> te::stmem::Transactor::getIndex(const std::string& /*datasetName*/, const std::string& /*name*/)
386 {
387  return std::auto_ptr<te::da::Index>(0);
388 }
389 
390 std::vector<std::string> te::stmem::Transactor::getIndexNames(const std::string& /*datasetName*/)
391 {
392  return std::vector<std::string>(0);
393 }
394 
395 bool te::stmem::Transactor::indexExists(const std::string& /*datasetName*/, const std::string& /*name*/)
396 {
397  return false;
398 }
399 
400 void te::stmem::Transactor::addIndex(const std::string& /*datasetName*/, te::da::Index* /*idx*/,
401  const std::map<std::string, std::string>& /*options*/)
402 {
403  return;
404 }
405 
406 void te::stmem::Transactor::dropIndex(const std::string& /*datasetName*/, const std::string& /*idxName*/)
407 {
408  return;
409 }
410 
411 std::auto_ptr<te::da::Sequence> te::stmem::Transactor::getSequence(const std::string& /*name*/)
412 {
413  return std::auto_ptr<te::da::Sequence>(0);
414 }
415 
416 std::vector<std::string> te::stmem::Transactor::getSequenceNames()
417 {
418  return std::vector<std::string>(0);
419 }
420 
421 bool te::stmem::Transactor::sequenceExists(const std::string& /*name*/)
422 {
423  return false;
424 }
425 
427 {
428  return;
429 }
430 
431 void te::stmem::Transactor::dropSequence(const std::string& /*name*/)
432 {
433  return;
434 }
435 
436 std::auto_ptr<te::gm::Envelope> te::stmem::Transactor::getExtent(const std::string& datasetName,
437  const std::string& propertyName)
438 {
439  te::da::DataSetType* type = getType(datasetName);
440  DataSet* ds = getData(datasetName);
441  if(type->getPropertyPosition(propertyName) != ds->getGeomPropIdx())
442  throw Exception("Not supported by ST In-Memory driver!");
443 
444  return std::auto_ptr<te::gm::Envelope>(ds->getExtent(ds->getGeomPropIdx()));
445 }
446 
447 std::auto_ptr<te::gm::Envelope> te::stmem::Transactor::getExtent(const std::string& datasetName,
448  std::size_t propertyPos)
449 {
450  DataSet* ds = getData(datasetName);
451  if(propertyPos != ds->getGeomPropIdx())
452  throw Exception("Not supported by ST In-Memory driver!");
453 
454  return std::auto_ptr<te::gm::Envelope>(ds->getExtent(ds->getGeomPropIdx()));
455 }
456 
457 std::size_t te::stmem::Transactor::getNumberOfItems(const std::string& datasetName)
458 {
459  DataSet* ds = getData(datasetName);
460  return ds->size();
461 }
462 
464 {
465  return !m_ds->m_datasets.empty();
466 }
467 
468 bool te::stmem::Transactor::dataSetExists(const std::string& name)
469 {
470  std::map<std::string, DataSet*>::const_iterator it = m_ds->m_datasets.find(name);
471  if(it== m_ds->m_datasets.end())
472  return false;
473  return true;
474 }
475 
476 void te::stmem::Transactor::createDataSet(te::da::DataSetType* /*dt*/, const std::map<std::string, std::string>& /*options*/)
477 {
478  return;
479 }
480 
481 void te::stmem::Transactor::cloneDataSet(const std::string& /*name*/,
482  const std::string& /*cloneName*/,
483  const std::map<std::string, std::string>& /*options*/)
484 {
485  return;
486 }
487 
488 
489 void te::stmem::Transactor::dropDataSet(const std::string& name)
490 {
491  std::map<std::string, te::da::DataSetType*>::iterator itdt = m_ds->m_schemas.find(name);
492  if(itdt==m_ds->m_schemas.end())
493  throw Exception("There is not a DataSetType with the given name!");
494 
495  std::map<std::string, DataSet*>::iterator itds = m_ds->m_datasets.find(name);
496  if(itds==m_ds->m_datasets.end())
497  throw Exception("There is not a DataSet with the given name!");
498 
499  delete(itdt->second);
500  delete(itds->second);
501  m_ds->m_schemas.erase(itdt);
502  m_ds->m_datasets.erase(itds);
503  return;
504 }
505 
506 void te::stmem::Transactor::renameDataSet(const std::string& name, const std::string& newName)
507 {
508  if(dataSetExists(newName))
509  throw Exception("The is already a DataSet with the new name!");
510 
511  std::map<std::string, te::da::DataSetType*>::iterator itdt = m_ds->m_schemas.find(name);
512  if(itdt==m_ds->m_schemas.end())
513  throw Exception("There is not a DataSetType with the given name!");
514 
515  std::map<std::string, DataSet*>::iterator itds = m_ds->m_datasets.find(name);
516  if(itds==m_ds->m_datasets.end())
517  throw Exception("There is not a DataSet with the given name!");
518 
519  te::da::DataSetType* dt = itdt->second;
520  dt->setName(newName);
521  DataSet* ds = itds->second;
522  //ds->setName(newName); => DataSet does not have name!!
523 
524  //erase without deleting the pointer.
525  m_ds->m_schemas.erase(itdt);
526  m_ds->m_datasets.erase(itds);
527 
528  m_ds->m_schemas.insert(std::pair<std::string, te::da::DataSetType*>(newName,dt));
529  m_ds->m_datasets.insert(std::pair<std::string, DataSet*>(newName,ds));
530 
531  return;
532 }
533 
534 void te::stmem::Transactor::add(const std::string& /*datasetName*/,
535  te::da::DataSet* /*d*/,
536  const std::map<std::string, std::string>& /*options*/,
537  std::size_t /*limit*/)
538 {
539  return;
540 }
541 
542 void te::stmem::Transactor::remove(const std::string& /*datasetName*/, const te::da::ObjectIdSet* /*oids*/)
543 {
544  return;
545 }
546 
547 void te::stmem::Transactor::update( const std::string& /*datasetName*/,
548  te::da::DataSet* /*dataset*/,
549  const std::vector<std::size_t>& /*properties*/,
550  const te::da::ObjectIdSet* /*oids*/,
551  const std::map<std::string, std::string>& /*options*/,
552  std::size_t /*limit*/)
553 {
554  return;
555 }
556 
557 void te::stmem::Transactor::optimize(const std::map<std::string, std::string>& /*opInfo*/)
558 {
559  return;
560 }
561 
562 
564 {
565  return m_ds;
566 }
567 
568 void te::stmem::Transactor::add(const std::string& name, te::da::DataSetType* t, DataSet* d)
569 {
570  if(dataSetExists(name))
571  throw Exception("There is already a DataSet with the new name!");
572 
573  m_ds->m_datasets.insert(std::pair<std::string, DataSet*>(name,d));
574  m_ds->m_schemas.insert(std::pair<std::string, te::da::DataSetType*>(name,t));
575  return;
576 }
577 
578  std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
580  te::common::TraverseType /*travType*/, bool /*connected*/,
582  {
583  DataSet* ds = getData(name);
584  return std::auto_ptr<te::da::DataSet>(ds->filter(dt, r));
585  }
586 
587  std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
590  te::common::TraverseType /*travType*/, bool /*connected*/,
592  {
593  DataSet* ds = getData(name);
594  return std::auto_ptr<te::da::DataSet>(ds->filter(g, sr, dt, tr));
595  }
596 
597  std::auto_ptr<te::da::DataSet> te::stmem::Transactor::getDataSet(const std::string& name,
600  te::common::TraverseType /*travType*/, bool /*connected*/,
602  {
603  DataSet* ds = getData(name);
604  return std::auto_ptr<te::da::DataSet>(ds->filter(e, sr, dt, tr));
605  }
606 
607  std::auto_ptr<te::dt::DateTimePeriod>
609  {
610  DataSet* ds = getData(name);
611  return std::auto_ptr<te::dt::DateTimePeriod>(ds->getTemporalExtent());
612  }
613 
614 // Protected Methods
615 te::da::DataSetType* te::stmem::Transactor::getType(const std::string& datasetName)
616 {
617  std::map<std::string, te::da::DataSetType*>::const_iterator it = m_ds->m_schemas.find(datasetName);
618  if(it==m_ds->m_schemas.end())
619  throw Exception("There is not a DataSetType with the given name!");
620  return it->second;
621 }
622 
623 te::stmem::DataSet* te::stmem::Transactor::getData(const std::string& datasetName)
624 {
625  std::map<std::string, DataSet*>::const_iterator it = m_ds->m_datasets.find(datasetName);
626  if(it==m_ds->m_datasets.end())
627  throw Exception("There is not a DataSet with the given name!");
628  return it->second;
629 }
630 
632 {
633  return te::common::UTF8;
634 }
Property * getProperty(std::size_t i) const
It returns the i-th property.
void rollBack()
It aborts the transaction. Any changes will be rolled-back.
Definition: Transactor.cpp:61
An implementation of DataSourceTransactor class for the ST In-memory driver.
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: Transactor.cpp:320
Implements a DataSource that contains st memory DataSets indexed by space and time.
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent(const std::string &name)
It returns the temporal extent associated to a DataSet.
Definition: Transactor.cpp:608
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema.
Definition: Transactor.cpp:406
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
Definition: Transactor.cpp:304
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: Transactor.cpp:345
~Transactor()
It constructs a Transactor.
Definition: Transactor.cpp:42
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset.
Definition: Transactor.cpp:350
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
Definition: Transactor.cpp:457
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
Definition: Transactor.cpp:416
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset.
Definition: Transactor.cpp:325
CharEncoding
Supported charsets (character encoding).
Property * clone() const
It returns a clone of the object.
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
Definition: Transactor.cpp:188
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation.
Definition: Transactor.cpp:126
bool hasDataSets()
It checks if the data source has any dataset.
Definition: Transactor.cpp:463
std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
Definition: Transactor.cpp:277
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
Definition: Transactor.cpp:199
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
Definition: Transactor.cpp:315
A class that models the description of a dataset.
Definition: DataSetType.h:72
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: Transactor.cpp:335
Implements a DataSource that contains In-Memory DataSets indexed by space and time.
Definition: DataSource.h:57
void addIndex(const std::string &datasetName, te::da::Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset.
Definition: Transactor.cpp:400
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
Definition: Transactor.cpp:265
An exception class for the TerraLib ST memory driver.
DataSet * getData(const std::string &datasetName)
It returns the DataSet associated to a given name.
Definition: Transactor.cpp:623
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: Transactor.cpp:436
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
Definition: Enums.h:140
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
Definition: Transactor.cpp:270
virtual Property * clone() const =0
It returns a clone of the object.
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
Definition: Transactor.cpp:542
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source.
Definition: Transactor.cpp:176
PrimaryKey * getPrimaryKey() const
It returns the primary key associated to the dataset type.
Definition: DataSetType.h:214
bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid.
Definition: Transactor.cpp:171
std::auto_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
Definition: Transactor.cpp:411
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:122
It describes a sequence (a number generator).
Definition: Sequence.h:56
A class that describes a check constraint.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
It models a property definition.
Definition: Property.h:59
void commit()
It commits the transaction.
Definition: Transactor.cpp:56
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset.
Definition: Transactor.cpp:375
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
Definition: DataSet.cpp:588
te::da::DataSetType * getType(const std::string &datasetName)
It returns the DataSetType associated to a given name.
Definition: Transactor.cpp:615
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
Definition: Transactor.cpp:298
void begin()
It starts a new transaction.
Definition: Transactor.cpp:51
bool isDataSetNameValid(const std::string &datasetName)
It returns true if the given string is a valid dataset name.
Definition: Transactor.cpp:163
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: Transactor.cpp:370
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: Transactor.cpp:214
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
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
Definition: Transactor.cpp:284
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
Definition: Transactor.cpp:468
std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
Definition: Transactor.cpp:158
void setName(const std::string &name)
It sets the property name.
Definition: Property.h:137
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
Definition: Transactor.cpp:250
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source.
Definition: Transactor.cpp:426
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: Transactor.cpp:385
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
Definition: Transactor.cpp:506
Constraint * clone()
It returns a clone of the object.
Definition: PrimaryKey.cpp:89
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
std::auto_ptr< DataSet > filter(const te::gm::Envelope *e, te::gm::SpatialRelation r) const
It returns a new DataSet, based on a given spatial filter.
Definition: DataSet.cpp:388
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
Definition: Transactor.cpp:395
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
Definition: Transactor.cpp:243
std::auto_ptr< te::da::DataSet > query(const te::da::Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. A dataset can be connected or di...
Definition: Transactor.cpp:111
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
Definition: Transactor.cpp:380
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
Definition: Transactor.cpp:489
void update(const std::string &datasetName, te::da::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: Transactor.cpp:547
DataSource * getSTMemDataSource() const
It returns its associated ST In-Memory DataSource.
Definition: Transactor.cpp:563
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
Definition: Transactor.cpp:390
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command.
Definition: Transactor.cpp:153
std::auto_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor.
Definition: Transactor.cpp:143
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
te::common::CharEncoding getEncoding()
It return the DataSource current encoding.
Definition: Transactor.cpp:631
std::size_t size() const
It returns the number of properties of the CompositeProperty.
std::auto_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
Definition: Transactor.cpp:310
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
std::auto_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source.
Definition: Transactor.cpp:71
te::da::DataSource * getDataSource() const
It returns the parent data source of the transactor.
Definition: Transactor.cpp:46
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
Definition: Transactor.cpp:476
std::size_t size() const
It returns the collection size, if it is known.
Definition: DataSet.cpp:583
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
Definition: Transactor.cpp:355
Implementation of a in-memory data set that contains spatiotemporal observations indexed by time and ...
Definition: DataSet.h:61
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
Definition: Transactor.cpp:260
void add(Constraint *c)
It adds a new constraint.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the observations.
Definition: DataSet.cpp:376
Transactor(DataSource *parent)
It constructs a Transactor.
Definition: Transactor.cpp:37
void optimize(const std::map< std::string, std::string > &opInfo)
For some data access drivers, this method will perform some operations to optimize the data storage...
Definition: Transactor.cpp:557
void cancel()
It requests that the data source stop the processing of the current command.
Definition: Transactor.cpp:148
Implementation of an in-memory data set that contains spatiotemporal observations indexed by time and...
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
Definition: Transactor.cpp:421
std::size_t getPropertyPosition(const std::string &name) const
It returns the property position based on its name.
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
Definition: Transactor.cpp:340
int getGeomPropIdx() const
It returns the index of the property that contains the observed geometries.
Definition: DataSet.cpp:312
void dropSequence(const std::string &name)
It removes the sequence from the data source.
Definition: Transactor.cpp:431
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
Definition: Transactor.cpp:365
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
Definition: Transactor.cpp:330
virtual const std::string & getName() const
It returns the constraint name.
Definition: Constraint.h:119
std::auto_ptr< te::da::PreparedQuery > getPrepared(const std::string &qName=std::string(""))
It creates a prepared query object that may be used for query commands (select, insert, update and delete) that are used repeatedly.
Definition: Transactor.cpp:137
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
Definition: Transactor.cpp:229
std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
Definition: Transactor.cpp:193
A Query is independent from the data source language/dialect.
Definition: Query.h:46
void add(const std::string &datasetName, te::da::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: Transactor.cpp:534
It describes an index associated to a DataSetType.
Definition: Index.h:54
bool isInTransaction() const
It returns true if a transaction is in progress, otherwise, it returns false.
Definition: Transactor.cpp:66
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: Transactor.cpp:360
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: Transactor.cpp:481
const std::string & getName() const
It returns the property name.
Definition: Property.h:127