77 catch(
const std::exception& e)
79 std::cout << std::endl <<
"An exception has occurred: " << e.what() << std::endl;
85 std::cout << std::endl <<
"An unexpected exception has occurred!" << std::endl;
95 std::cout <<
"===== Data Source Names available: \n";
98 for(std::size_t i = 0; i < dataSourceNames.size(); ++i)
99 std::cout << dataSourceNames[i] << std::endl;
102 std::unique_ptr<te::da::DataSource>
CreateDataSource(
const std::string& dsType,
const std::string& connInfo)
124 std::string dbName = uri.
path().substr(1, uri.
path().length());
126 std::cout <<
"\n===== Dataset Names in the data source \"" << dbName <<
"\":\n";
129 for(std::size_t i = 0; i < datasetNames.size(); ++i)
130 std::cout << datasetNames[i] << std::endl;
135 std::cout <<
"\n===== Property Names of the dataset \"" << datasetName <<
"\":\n";
138 for(std::size_t i = 0; i < pNames.size(); ++i)
139 std::cout << pNames[i] << std::endl;
144 std::cout <<
"\n===== Primary Key Name of the dataset \"" << datasetName <<
"\": ";
146 std::unique_ptr<te::da::PrimaryKey> pk = ds->
getPrimaryKey(datasetName);
147 std::cout << pk->getName() << std::endl;
149 std::cout <<
"\n===== Property Names of the Primary Key \"" << pk->getName() <<
"\": ";
151 const std::vector<te::dt::Property*> pkProperties = pk->getProperties();
152 std::size_t numPkProperties = pkProperties.size();
153 for(std::size_t i = 0; i < numPkProperties; ++i)
154 std::cout << pkProperties[i]->getName() << std::endl;
static std::unique_ptr< DataSource > create(const std::string &dsType, const std::string &connInfo)
It creates a new repository for a data source.
std::string path() const
Retrieving the path.
An utility class to control the startup and cleanup of the TerraLib Platform and its resources...
Include files for Core Plugin Library.
void OGRExampleRead()
An example using OGR data source driver to retrieve data from a datafile.
It describes a primary key (pk) constraint.
void PrintDataSourceNames(const std::string &dsType, const std::string &connInfo)
void DropDataSource(const std::string &dsType, const std::string &connInfo)
void PostGISExample()
An example using PostGIS data source driver.
void QueryExample()
Quering a dataset.
static te::dt::Date ds(2010, 01, 01)
static void drop(const std::string &dsType, const std::string &connInfo)
It removes a data source identified by its connection information and the driver type.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
static std::vector< std::string > getDataSourceNames(const std::string &dsType, const std::string &connInfo)
It returns the data source names available in the driver.
It describes an index associated to a DataSetType.
static PluginManager & instance()
Access the singleton.
void CopyingData()
This example shows how to copy a given dataset from one data source to another one.
void finalize()
It finalizes the TerraLib Platform.
static TerraLib & getInstance()
It returns a reference to the singleton instance.
Examples on how to access/manipulate DataSources in TerraLib.
A factory for data sources.
void PrintDataSetPropertyNames(te::da::DataSource *ds, const std::string &datasetName)
virtual std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source.
A class for handling character enconding/decoding.
void ORGExampleWrite()
An example using OGR data source driver to persist data to a datafile.
void initialize()
It initializes the TerraLib Platform.
void GDALExample()
An example using GDAL data source driver.
A class that describes a check constraint.
A class for representing an Uniform Resource Identifier (URI).
void ExportingOGR()
An example using OGR data source driver to export some ;.
const te::core::URI & getConnectionInfo() const
An Uniform Resource Identifier used to describe the datasource connection.
virtual std::unique_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
An atomic property like an integer or double.
A class for representing an Uniform Resource Identifier (URI).
void LoadModules()
Load terralib modules.
static bool exists(const std::string &dsType, const std::string &connInfo)
It checks if the data source exists with the connection information and the driver type...
void clear()
Stop and unload all plugins, then clear the internal list of plugins.
This is the factory for PostGIS data sources.
std::unique_ptr< te::da::DataSource > CreateDataSource(const std::string &dsType, const std::string &connInfo)
void PrintDataSetNames(te::da::DataSource *ds)
A class that implements a prepared query for PostgreSQL data access driver.
Implementation of the data source for the PostGIS driver.
void MemoryExample()
This example shows how to create DataSet and DataSetType in memory.
virtual std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
void QueryInsertExample()
Quering Insert clause.
void PrintDataSetConstraints(te::da::DataSource *ds, const std::string &datasetName)
bool CheckDataSourceExistence(const std::string &dsType, const std::string &connInfo)