Examples on how to access/manipulate DataSources in TerraLib. More...
#include <terralib_buildconfig.h>#include <terralib/common.h>#include <terralib/dataaccess.h>#include <terralib/datatype_fw.h>#include <terralib/dataaccess_fw.h>#include <terralib/dataaccess/datasource/DataSourceFactory.h>#include <terralib/geometry.h>Go to the source code of this file.
Functions | |
| void | AddingDataSetPropertyValues (te::da::DataSet *ds) |
| It adds a new data set property and its values. More... | |
| te::da::PrimaryKey * | AddPrimaryKey (const std::string &datasetname, te::da::DataSourceTransactor *transactor) |
| te::dt::SimpleProperty * | AddProperty (const std::string &datasetname, te::da::DataSourceTransactor *transactor) |
| te::da::Index * | AddSpatialIndex (const std::string &datasetname, te::da::DataSourceTransactor *transactor) |
| te::da::UniqueKey * | AddUniqueKey (const std::string &datasetname, te::da::DataSourceTransactor *transactor) |
| void | CopyingData () |
| This example shows how to copy a given dataset from one data source to another one. More... | |
| void | CopyingDataSetToDataSource (te::da::DataSet *dataSet, const std::string &dsName, std::map< std::string, std::string > &dsInfo) |
| It copies a data set to a data source. More... | |
| te::da::DataSetType * | CreateDataSetType (const std::string &datasetname, te::da::DataSetType *dt, te::da::DataSourceTransactor *transactor) |
| te::da::DataSetType * | CreateDataSetTypeInMemory (const std::string &datasettypename) |
| te::da::DataSet * | CreatingDataSetInMemory (const std::string &datasetName) |
| It creates a data set in memory. More... | |
| te::da::DataSet * | CreatingDataSetInMemoryGivingDt (te::da::DataSetType *dt) |
| void | DataSetAdapter () |
| DataSet Adapter example. More... | |
| void | DataSetGetExtent (te::da::DataSourceTransactor *transactor) |
| An example showing how to retrieve the extent of a DataSet. More... | |
| void | DroppingDataSetType (const std::string &datasetname, te::da::DataSourceTransactor *trans) |
| It removes a data set type from the associated data source. More... | |
| void | DroppingDataSetTypeProperty (const std::string &datasetname, const std::string &propname, te::da::DataSourceTransactor *trans) |
| It removes a property from the data set type and from the associated data source. More... | |
| void | ExportingOGR () |
| An example using OGR data source driver to export some ;. More... | |
| void | GDALExample () |
| An example using GDAL data source driver. More... | |
| void | LoadModules () |
| It loads the data source drivers. More... | |
| void | MemoryExample () |
| This example shows how to create DataSet and DataSetType in memory. More... | |
| void | MySQLExample () |
| An example using MySQL data source driver. More... | |
| void | ObjectId () |
| ObjectId example. More... | |
| void | ObjectId3 () |
| void | ObjectId_query () |
| void | OGRExampleRead () |
| An example using OGR data source driver to retrieve data from a datafile. More... | |
| void | ORGExampleWrite () |
| An example using OGR data source driver to persist data to a datafile. More... | |
| void | PersistenceExample () |
| This example shows how to use the TerraLib Persistence. More... | |
| void | PostGISExample () |
| An example using PostGIS data source driver. More... | |
| void | PrintCatalog (te::da::DataSource *ds) |
| This example will print to standard output all information about the datasets stored in the data source. More... | |
| void | PrintDataSet (std::string datasetName, te::da::DataSet *dataset) |
| It prints the data in a given dataset. More... | |
| void | PrintDataSets (te::da::DataSource *ds) |
| It prints datasets in a given data source. More... | |
| void | PrintDataSourceCapabilities (te::da::DataSource *ds) |
| It retrieves and prints the capabilities of a given data source. More... | |
| void | QueryExample () |
| Quering a dataset. More... | |
| void | QueryInsertExample () |
| Quering Insert clause. More... | |
| void | RetrieveUsingSpatialFilter (te::da::DataSource *ds) |
| An example showing how to retrieve data using a spatial filter. More... | |
| void | SQLiteExample () |
| An example using SQLite data source driver. More... | |
Examples on how to access/manipulate DataSources in TerraLib.
Definition in file DataAccessExamples.h.
| void AddingDataSetPropertyValues | ( | te::da::DataSet * | ds | ) |
It adds a new data set property and its values.
| dataSet | the dataSet that will be added. |
| te::da::PrimaryKey* AddPrimaryKey | ( | const std::string & | datasetname, |
| te::da::DataSourceTransactor * | transactor | ||
| ) |
Definition at line 4 of file AddingPrimaryKey.cpp.
References te::da::PrimaryKey::add(), te::da::DataSourceTransactor::addPrimaryKey(), te::da::DataSourceTransactor::getPrimaryKey(), and te::da::DataSourceTransactor::getProperty().
Referenced by PostGISExample().
| te::dt::SimpleProperty* AddProperty | ( | const std::string & | datasetname, |
| te::da::DataSourceTransactor * | transactor | ||
| ) |
Definition at line 4 of file AddingProperty.cpp.
References te::da::DataSourceTransactor::addProperty(), te::dt::INT32_TYPE, and p.
Referenced by PostGISExample().
| te::da::Index* AddSpatialIndex | ( | const std::string & | datasetname, |
| te::da::DataSourceTransactor * | transactor | ||
| ) |
Definition at line 4 of file AddingSpatialIndex.cpp.
References te::da::Index::add(), te::da::DataSourceTransactor::addIndex(), te::da::DataSourceTransactor::getProperty(), and te::da::R_TREE_TYPE.
Referenced by PostGISExample().
| te::da::UniqueKey* AddUniqueKey | ( | const std::string & | datasetname, |
| te::da::DataSourceTransactor * | transactor | ||
| ) |
Definition at line 4 of file AddingUniqueKey.cpp.
References te::da::UniqueKey::add(), te::da::DataSourceTransactor::addUniqueKey(), and te::da::DataSourceTransactor::getProperty().
Referenced by PostGISExample().
| void CopyingData | ( | ) |
This example shows how to copy a given dataset from one data source to another one.
Definition at line 14 of file CopyingData.cpp.
References te::gm::GeometryType, te::da::GetFirstGeomProperty(), te::dt::Property::getName(), GetPostGISConnection(), te::da::DataSourceFactory::make(), te::gm::GeometryProperty::setGeometryType(), te::dt::Property::setName(), and te::gm::GeometryProperty::setSRID().
Referenced by main().
| void CopyingDataSetToDataSource | ( | te::da::DataSet * | dataSet, |
| const std::string & | dsName, | ||
| std::map< std::string, std::string > & | dsInfo | ||
| ) |
It copies a data set to a data source.
| dataSet | the dataSet that will be copied to data source. |
| dsName | the data source name |
| dsInfo | the data source info |
| te::da::DataSetType* CreateDataSetType | ( | const std::string & | datasetname, |
| te::da::DataSetType * | dt, | ||
| te::da::DataSourceTransactor * | transactor | ||
| ) |
Definition at line 7 of file CreatingDataSetType.cpp.
References te::da::DataSourceTransactor::createDataSet(), te::da::DataSourceTransactor::dataSetExists(), and dt.
Referenced by PostGISExample().
| te::da::DataSetType* CreateDataSetTypeInMemory | ( | const std::string & | datasettypename | ) |
Definition at line 9 of file CreatingDataSetTypeInMemory.cpp.
References te::da::PrimaryKey::add(), te::da::Index::add(), te::da::DataSetType::add(), te::da::B_TREE_TYPE, te::dt::DATE, dt, te::dt::INT32_TYPE, te::gm::PointType, te::da::R_TREE_TYPE, te::dt::SimpleProperty::setAutoNumber(), te::da::CheckConstraint::setExpression(), and te::gm::GeometryProperty::setSRID().
Referenced by MemoryExample(), and ORGExampleWrite().
| te::da::DataSet* CreatingDataSetInMemory | ( | const std::string & | datasetName | ) |
It creates a data set in memory.
Definition at line 17 of file CreatingDataSetInMemory.cpp.
References te::da::PrimaryKey::add(), te::mem::DataSet::add(), te::da::Index::add(), te::da::DataSetType::add(), te::da::B_TREE_TYPE, te::dt::AbstractData::clone(), DataSet(), te::dt::DATE, ds, dt, te::dt::INT32_TYPE, te::gm::PointType, te::da::R_TREE_TYPE, te::dt::SimpleProperty::setAutoNumber(), te::mem::DataSetItem::setDateTime(), te::da::CheckConstraint::setExpression(), te::mem::DataSetItem::setGeometry(), te::mem::DataSetItem::setInt32(), te::mem::DataSetItem::setNumeric(), and te::gm::GeometryProperty::setSRID().
| te::da::DataSet* CreatingDataSetInMemoryGivingDt | ( | te::da::DataSetType * | dt | ) |
Definition at line 14 of file CreatingDataSetInMemoryGivingDt.cpp.
References te::mem::DataSet::add(), te::dt::AbstractData::clone(), DataSet(), ds, te::mem::DataSetItem::setDateTime(), te::mem::DataSetItem::setGeometry(), te::mem::DataSetItem::setInt32(), and te::mem::DataSetItem::setNumeric().
Referenced by MemoryExample(), and ORGExampleWrite().
| void DataSetAdapter | ( | ) |
DataSet Adapter example.
Definition at line 47 of file examples/dataaccess/DataSetAdapter.cpp.
References te::da::DataSourceFactory::make().
Referenced by te::da::CreateAdapter().
| void DataSetGetExtent | ( | te::da::DataSourceTransactor * | transactor | ) |
An example showing how to retrieve the extent of a DataSet.
| transactor | The transactor to be used to retrieve the data. |
Definition at line 10 of file DataSetGetExtent.cpp.
References te::dt::GEOMETRY_TYPE, te::da::DataSourceTransactor::getDataSet(), te::da::GetFirstPropertyPos(), and te::gm::INTERSECTS.
| void DroppingDataSetType | ( | const std::string & | datasetname, |
| te::da::DataSourceTransactor * | trans | ||
| ) |
It removes a data set type from the associated data source.
| dt | the dataSetType that will be removed from data source. |
| trans | the transactor to be used in the removing. |
Definition at line 11 of file DroppingDataSetType.cpp.
References te::da::DataSourceTransactor::dropDataSet().
Referenced by PostGISExample().
| void DroppingDataSetTypeProperty | ( | const std::string & | datasetname, |
| const std::string & | propname, | ||
| te::da::DataSourceTransactor * | trans | ||
| ) |
It removes a property from the data set type and from the associated data source.
| prop | the property that will be removed. |
| trans | the transactor to be used in the removing. |
Definition at line 11 of file DroppingDataSetTypeProperty.cpp.
References te::da::DataSourceTransactor::dropProperty().
| void ExportingOGR | ( | ) |
An example using OGR data source driver to export some ;.
Definition at line 31 of file ExportingOGR.cpp.
References openDirectory(), and saveUsingOGR().
Referenced by main().
| void GDALExample | ( | ) |
An example using GDAL data source driver.
Definition at line 129 of file GDALExample.cpp.
References DataSourceTransactor(), OpenDirectory(), and OpenFile().
Referenced by main().
| void LoadModules | ( | ) |
It loads the data source drivers.
It loads the data source drivers.
Load terralib modules.
It loads the data source drivers.
Definition at line 38 of file attic/unittest/dataaccess/LoadModules.h.
| void MemoryExample | ( | ) |
This example shows how to create DataSet and DataSetType in memory.
Definition at line 11 of file MemoryExample.cpp.
References CreateDataSetTypeInMemory(), CreatingDataSetInMemoryGivingDt(), te::da::DataSourceFactory::make(), and PrintDataSet().
Referenced by main().
| void MySQLExample | ( | ) |
An example using MySQL data source driver.
| void ObjectId | ( | ) |
ObjectId example.
Definition at line 24 of file examples/dataaccess/ObjectId.cpp.
References ds, te::da::GenerateOIDSet(), GetPostGISConnection(), te::gm::INTERSECTS, and PrintDataSet().
Referenced by te::qt::widgets::Histogram::find(), te::qt::widgets::Scatter::find(), te::edit::GenerateId(), te::da::GenerateOID(), te::vp::CheckGeomValidityDialog::onVerifyPushButtonClicked(), and te::qt::plugins::edit::ToolBar::updateLayer().
| void ObjectId3 | ( | ) |
| void ObjectId_query | ( | ) |
Definition at line 76 of file examples/dataaccess/ObjectId.cpp.
References te::da::BuildSelect(), ds, te::da::GenerateOIDSet(), te::da::GetOIDPropertyNames(), GetPostGISConnection(), te::da::GetPropertyInfo(), te::gm::INTERSECTS, and PrintDataSet().
| void OGRExampleRead | ( | ) |
An example using OGR data source driver to retrieve data from a datafile.
Definition at line 13 of file OGRExample.cpp.
References ds, te::da::DataSourceFactory::make(), PrintDataSet(), and PrintDataSourceCapabilities().
Referenced by main().
| void ORGExampleWrite | ( | ) |
An example using OGR data source driver to persist data to a datafile.
Definition at line 65 of file OGRExample.cpp.
References CreateDataSetTypeInMemory(), CreatingDataSetInMemoryGivingDt(), ds, te::da::DataSourceFactory::make(), te::da::DataSet::moveBeforeFirst(), and PrintDataSet().
Referenced by main().
| void PostGISExample | ( | ) |
An example using PostGIS data source driver.
Definition at line 80 of file PostGISExample.cpp.
References te::da::DataSetType::add(), AddPrimaryKey(), AddProperty(), AddSpatialIndex(), AddUniqueKey(), CreateDataSetType(), DroppingDataSetType(), ds, te::gm::GeometryType, te::dt::Property::getName(), GetPostGISConnection(), te::dt::INT32_TYPE, PrintDataSet(), PrintDataSourceCapabilities(), RetrieveUsingSpatialFilter(), te::dt::STRING, and te::dt::VAR_STRING.
Referenced by main().
| void PrintCatalog | ( | te::da::DataSource * | ds | ) |
This example will print to standard output all information about the datasets stored in the data source.
| ds | The data source used to retrieve information about its datasets. |
This example will print to standard output all information about the datasets stored in the data source.
| ds | The data source used to retrieve information about their datasets. |
Definition at line 40 of file PrintCatalog.cpp.
References dt, te::da::DataSource::getDataSetNames(), te::da::DataSource::getDataSetType(), te::da::CheckConstraint::getExpression(), te::da::Constraint::getName(), te::da::Index::getName(), te::da::PrimaryKey::getProperties(), te::da::UniqueKey::getProperties(), te::da::Index::getProperties(), te::da::DataSource::getTransactor(), and te::da::DataSource::isOpened().
| void PrintDataSet | ( | std::string | datasetName, |
| te::da::DataSet * | dataset | ||
| ) |
It prints the data in a given dataset.
| datasetName | the dataset name |
| dataset | pointer to a dataset. Do not pass NULL. |
This function will move the dataset to the item before first and return it there after printing.
Definition at line 7 of file PrintDataSet.cpp.
References te::da::DataSet::getAsString(), te::da::DataSet::getNumProperties(), te::da::DataSet::getPropertyName(), te::da::DataSet::isNull(), te::da::DataSet::moveBeforeFirst(), and te::da::DataSet::moveNext().
Referenced by DataSourceTransactor(), MemoryExample(), ObjectId(), ObjectId_query(), OGRExampleRead(), ORGExampleWrite(), PostGISExample(), PrintDataSets(), and QueryExample().
| void PrintDataSets | ( | te::da::DataSource * | ds | ) |
It prints datasets in a given data source.
| ds | The data source you want to print its data |
| ds | The data source you want to print its data. |
Definition at line 38 of file ado/PrintDataSets.cpp.
References te::da::DataSource::getDataSet(), te::da::DataSource::getDataSetNames(), te::da::DataSource::getTransactor(), te::da::DataSource::isOpened(), PrintDataSet(), PrintDataSetValues(), and te::common::Exception::what().
| void PrintDataSourceCapabilities | ( | te::da::DataSource * | ds | ) |
It retrieves and prints the capabilities of a given data source.
| ds | A valid data source. |
Definition at line 16 of file PrintDataSourceCapabilities.cpp.
References capabilities, dataSetCapabilities, dataSetTypeCapabilities, dataTypeCapabilities, te::da::DataSourceCapabilities::getAccessPolicy(), te::da::DataSource::getCapabilities(), te::da::DataSourceCapabilities::getDataSetCapabilities(), te::da::DataSourceCapabilities::getDataSetTypeCapabilities(), te::da::DataSourceCapabilities::getDataTypeCapabilities(), te::da::DataSourceCapabilities::getQueryCapabilities(), te::common::NoAccess, PrintHelper(), queryCapabilities, te::common::RAccess, te::common::RWAccess, te::da::QueryCapabilities::supportsAlter(), te::da::DataTypeCapabilities::supportsArray(), te::da::DataSourceCapabilities::supportsBatchExecutorAPI(), te::da::DataSetCapabilities::supportsBidirectionalTraversing(), te::da::DataTypeCapabilities::supportsBit(), te::da::DataTypeCapabilities::supportsBoolean(), te::da::DataSetTypeCapabilities::supportsBTreeIndex(), te::da::DataTypeCapabilities::supportsByteArray(), te::da::DataTypeCapabilities::supportsCDouble(), te::da::DataTypeCapabilities::supportsCFloat(), te::da::DataTypeCapabilities::supportsChar(), te::da::DataSetTypeCapabilities::supportsCheckConstraints(), te::da::DataTypeCapabilities::supportsCInt16(), te::da::DataTypeCapabilities::supportsCInt32(), te::da::DataTypeCapabilities::supportsComposite(), te::da::QueryCapabilities::supportsCreate(), te::da::DataTypeCapabilities::supportsDataset(), te::da::DataSourceCapabilities::supportsDataSetPesistenceAPI(), te::da::DataSourceCapabilities::supportsDataSetTypePesistenceAPI(), te::da::DataTypeCapabilities::supportsDateTime(), te::da::QueryCapabilities::supportsDelete(), te::da::DataTypeCapabilities::supportsDouble(), te::da::QueryCapabilities::supportsDrop(), te::da::DataSetCapabilities::supportsEfficientDataSetSize(), te::da::DataSetCapabilities::supportsEfficientMove(), te::da::DataSetCapabilities::supportsEfficientMoveAfterLast(), te::da::DataSetCapabilities::supportsEfficientMoveBeforeFirst(), te::da::DataSetCapabilities::supportsEfficientMoveLast(), te::da::DataSetCapabilities::supportsEfficientMovePrevious(), te::da::DataTypeCapabilities::supportsFloat(), te::da::DataSetTypeCapabilities::supportsForeignKey(), te::da::DataTypeCapabilities::supportsGeometry(), te::da::DataSetTypeCapabilities::supportsHashIndex(), te::da::DataSetTypeCapabilities::supportsIndex(), te::da::DataSetCapabilities::supportsIndexedTraversing(), te::da::QueryCapabilities::supportsInsert(), te::da::DataTypeCapabilities::supportsInt16(), te::da::DataTypeCapabilities::supportsInt32(), te::da::DataTypeCapabilities::supportsInt64(), te::da::DataTypeCapabilities::supportsNumeric(), te::da::DataTypeCapabilities::supportsPolymorphic(), te::da::DataSourceCapabilities::supportsPreparedQueryAPI(), te::da::DataSetTypeCapabilities::supportsPrimaryKey(), te::da::DataSetTypeCapabilities::supportsQuadTreeIndex(), te::da::DataSetCapabilities::supportsRandomTraversing(), te::da::DataTypeCapabilities::supportsRaster(), te::da::DataSetTypeCapabilities::supportsRTreeIndex(), te::da::QueryCapabilities::supportsSelect(), te::da::QueryCapabilities::supportsSelectInto(), te::da::DataSetTypeCapabilities::supportsSequence(), te::da::QueryCapabilities::supportsSQLDialect(), te::da::DataTypeCapabilities::supportsString(), te::da::DataSourceCapabilities::supportsTransactions(), te::da::DataTypeCapabilities::supportsUChar(), te::da::DataTypeCapabilities::supportsUInt16(), te::da::DataTypeCapabilities::supportsUInt32(), te::da::DataTypeCapabilities::supportsUInt64(), te::da::DataSetTypeCapabilities::supportsUniqueKey(), te::da::QueryCapabilities::supportsUpdate(), te::da::DataTypeCapabilities::supportsXML(), and te::common::WAccess.
Referenced by OGRExampleRead(), and PostGISExample().
| void QueryExample | ( | ) |
Quering a dataset.
Definition at line 12 of file QueryExample_2.cpp.
References ds, GetPostGISConnection(), te::mnt::Max(), te::mnt::Min(), PrintDataSet(), and te::sa::Sum().
Referenced by main().
| void QueryInsertExample | ( | ) |
Quering Insert clause.
Definition at line 12 of file QueryInsertExample.cpp.
References te::da::PrimaryKey::add(), ds, GetPostGISConnection(), insert(), te::dt::INT32_TYPE, te::gm::MultiPolygonType, te::dt::SimpleProperty::setAutoNumber(), te::gm::GeometryProperty::setGeometryType(), and te::dt::STRING_TYPE.
Referenced by main().
| void RetrieveUsingSpatialFilter | ( | te::da::DataSource * | ds | ) |
An example showing how to retrieve data using a spatial filter.
| transactor | The transactor to be used to retrieve the data. |
Definition at line 5 of file RetrieveUsingSpatialFilter.cpp.
References te::gm::Geometry::asText(), te::gm::Geometry::computeMBR(), te::dt::GEOMETRY_TYPE, te::da::DataSource::getDataSet(), te::da::GetFirstPropertyPos(), te::gm::CurvePolygon::getNPoints(), te::gm::Geometry::getSRID(), te::da::DataSource::getTransactor(), te::gm::INTERSECTS, te::gm::LineStringType, te::gm::PolygonType, te::gm::CurvePolygon::push_back(), te::gm::LineString::setPoint(), and te::gm::CurvePolygon::setSRID().
Referenced by PostGISExample().
| void SQLiteExample | ( | ) |
An example using SQLite data source driver.