AddingUniqueKey.cpp
Go to the documentation of this file.
1 // Examples
2 #include "DataAccessExamples.h"
3 
4 te::da::UniqueKey* AddUniqueKey(const std::string& datasetname,
6 {
7  te::da::UniqueKey* uk = new te::da::UniqueKey("country_name_city_name_uk");
8  std::unique_ptr<te::dt::Property> uk1 = transactor->getProperty(datasetname,"country_name");
9  std::unique_ptr<te::dt::Property> uk2 = transactor->getProperty(datasetname,"city_name");
10 
11  uk->add(uk1.get());
12  uk->add(uk2.get());
13 
14  transactor->addUniqueKey(datasetname,uk);
15 
16  return uk;
17 }
18 
void add(te::dt::Property *p)
It adds the property to the list of properties that participates in the unique key.
Definition: UniqueKey.h:124
virtual std::unique_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)=0
It retrieves the property with the given name from the dataset.
te::da::UniqueKey * AddUniqueKey(const std::string &datasetname, te::da::DataSourceTransactor *transactor)
virtual void addUniqueKey(const std::string &datasetName, UniqueKey *uk)=0
It adds a unique key constraint to the dataset.
Examples on how to access/manipulate DataSources in TerraLib.
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...