Class used to centralize and control access to data in terralib. It aims to create a high-level interface for simplifying the concepts defined in the terralib DataAccess module. More...
#include <DataAccess.h>
Public Member Functions | |
void | beginTransaction () |
Commits a transaction. More... | |
virtual te::dt::AbstractData * | clone () const override |
Begins a transaction. More... | |
void | commitTransaction () |
Rollbacks the transaction. More... | |
void | createDataSet (te::da::DataSetType *dataSetType) |
Function used to create a new DataSet into internal datasource. This class will NOT take the ownership of the dataSetType pointer. More... | |
DataAccess (const te::core::URI &uri, const std::string &dataSourceDriver, const std::string &dataSetName="") | |
constructor. More... | |
DataAccess (const te::da::DataAccess &rhs) | |
DataAccess (te::da::DataSourcePtr dataSource, const std::string &dataSetName="") | |
Constructor. More... | |
DataAccess (te::da::DataSourcePtr dataSource, const te::da::DataSetType *dataSetType) | |
constructor. More... | |
bool | dataSetExists () const |
void | execute (const std::string &query) |
Executes the given sql in the current transactor. More... | |
void | flush () |
te::da::DataSetTypeConverter * | getConverter () const |
Get data set type. More... | |
std::unique_ptr< te::da::DataSet > | getDataSet () const |
Get dataset using internal information (data source, query, datasetTypeConverter) More... | |
std::unique_ptr< te::da::DataSet > | getDataSet (const te::da::Expression *filter) const |
Get dataset using internal information (data source, query, datasetTypeConverter), using the given filter. More... | |
std::string | getDataSetName () const |
Get data set name. More... | |
const te::da::DataSetType * | getDataSetType () const |
Get data set type. More... | |
te::da::DataSourcePtr | getDataSource () const |
Get the data source associated with this data access. More... | |
std::string | getDataSourceConnectionInfo () const |
Get data source connection info. More... | |
std::vector< std::string > | getDistinctValues (const std::string &attributeName) |
Function used to get distinct values ir order, from a specific attribute. More... | |
te::da::Literal * | getLiteral (const std::string &attributeName, const std::string &value) |
It creates a Literal Expression based on a attribute type. More... | |
te::gm::Envelope | getMBR () const |
Gets the MBR of the data access. More... | |
te::da::Select * | getQuery () const |
Get query object. More... | |
int | getSRID () const |
Gets the SRID of the data access. More... | |
std::string | getStrQuery () const |
Get query object as string. More... | |
te::da::DataSourceTransactorPtr | getTransactor () const |
Sets he transactor to be used. More... | |
virtual int | getTypeCode () const override |
It returns the data type code associated to the data value. More... | |
std::unique_ptr< te::da::DataSet > | query (const std::string &query) |
std::unique_ptr< te::da::DataSet > | query (const te::da::Select &select) |
Get dataset using internal information (data source, datasetTypeConverter), but using query parameter for data restriction. More... | |
void | rollbackTransaction () |
When handling with files, specially using OGR, the olnly way to ensure the data is writen tis to close dataSource. So this functions encapsulates it. More... | |
void | saveDataSet (te::da::DataSet *dataSet, bool enableProgress=true) |
Function used to save data into internal datasource (if a converter was defined, it will be used) More... | |
void | setConverter (te::da::DataSetTypeConverter *converter) |
Set data set converter type. More... | |
void | setObjectIdSetFilter (const te::da::ObjectIdSet *objectIdSetFilter) |
Gets the current transactor. If no transactor is defined, it creates one. More... | |
void | setQuery (te::da::Select *select) |
Set data set restriction. More... | |
void | setTransactor (te::da::DataSourceTransactorPtr transactor) |
virtual std::string | toString () const override |
Check if the the dataSet exists. More... | |
virtual | ~DataAccess () |
Default destructor. More... | |
Protected Attributes | |
std::string | m_dataSetName |
Dataset name. More... | |
std::unique_ptr< te::da::Select > | m_dataSetQuery |
Filter used to load data with restriction. More... | |
std::unique_ptr< te::da::DataSetType > | m_dataSetType |
Data set type. More... | |
std::unique_ptr< te::da::DataSetTypeConverter > | m_dataSetTypeConverter |
DataSetType Converter. More... | |
te::da::DataSourcePtr | m_dataSource |
Data source. More... | |
std::unique_ptr< te::da::ObjectIdSet > | m_objectIdSetFilter |
A optional filter containg an objectId set. More... | |
te::da::DataSourceTransactorPtr | m_transactor |
Transactor. More... | |
Class used to centralize and control access to data in terralib. It aims to create a high-level interface for simplifying the concepts defined in the terralib DataAccess module.
Definition at line 76 of file DataAccess.h.
te::da::DataAccess::DataAccess | ( | const te::core::URI & | uri, |
const std::string & | dataSourceDriver, | ||
const std::string & | dataSetName = "" |
||
) |
constructor.
uri | The URI used to describe the datasource connection. |
dataSourceDriver | The data source type name (example: POSTGIS, ORACLE, SQLITE). |
dataSetName | The dataset name (not needed to inform if DataAccess will be used to create a new Dataset) |
Exception | An exception can be thrown, if the data source cannot be created or opened and dataset not found. |
te::da::DataAccess::DataAccess | ( | te::da::DataSourcePtr | dataSource, |
const std::string & | dataSetName = "" |
||
) |
Constructor.
dataSource | The data source pointer. |
dataSetName | The dataset name (not needed to inform if DataAccess will be used to create a new Dataset) |
Exception | An exception can be thrown, if the data source cannot be opened or dataset not found. |
te::da::DataAccess::DataAccess | ( | te::da::DataSourcePtr | dataSource, |
const te::da::DataSetType * | dataSetType | ||
) |
constructor.
dataSource | The data source pointer. |
dataSetType | The dataset type |
Exception | An exception can be thrown, if the data source cannot be opened or dataset not found. |
te::da::DataAccess::DataAccess | ( | const te::da::DataAccess & | rhs | ) |
|
virtual |
Default destructor.
void te::da::DataAccess::beginTransaction | ( | ) |
Commits a transaction.
|
overridevirtual |
Begins a transaction.
Implements te::dt::AbstractData.
void te::da::DataAccess::commitTransaction | ( | ) |
Rollbacks the transaction.
void te::da::DataAccess::createDataSet | ( | te::da::DataSetType * | dataSetType | ) |
bool te::da::DataAccess::dataSetExists | ( | ) | const |
void te::da::DataAccess::execute | ( | const std::string & | query | ) |
Executes the given sql in the current transactor.
void te::da::DataAccess::flush | ( | ) |
te::da::DataSetTypeConverter* te::da::DataAccess::getConverter | ( | ) | const |
Get data set type.
std::unique_ptr<te::da::DataSet> te::da::DataAccess::getDataSet | ( | ) | const |
Get dataset using internal information (data source, query, datasetTypeConverter)
std::unique_ptr<te::da::DataSet> te::da::DataAccess::getDataSet | ( | const te::da::Expression * | filter | ) | const |
Get dataset using internal information (data source, query, datasetTypeConverter), using the given filter.
std::string te::da::DataAccess::getDataSetName | ( | ) | const |
Get data set name.
const te::da::DataSetType* te::da::DataAccess::getDataSetType | ( | ) | const |
Get data set type.
te::da::DataSourcePtr te::da::DataAccess::getDataSource | ( | ) | const |
Get the data source associated with this data access.
std::string te::da::DataAccess::getDataSourceConnectionInfo | ( | ) | const |
Get data source connection info.
std::vector<std::string> te::da::DataAccess::getDistinctValues | ( | const std::string & | attributeName | ) |
Function used to get distinct values ir order, from a specific attribute.
attributeName | String with attribute name |
te::da::Literal* te::da::DataAccess::getLiteral | ( | const std::string & | attributeName, |
const std::string & | value | ||
) |
It creates a Literal Expression based on a attribute type.
attributeName | Attribute name from data set |
value | Attribute value used to create the right Literal expression |
te::gm::Envelope te::da::DataAccess::getMBR | ( | ) | const |
Gets the MBR of the data access.
te::da::Select* te::da::DataAccess::getQuery | ( | ) | const |
Get query object.
int te::da::DataAccess::getSRID | ( | ) | const |
Gets the SRID of the data access.
std::string te::da::DataAccess::getStrQuery | ( | ) | const |
Get query object as string.
te::da::DataSourceTransactorPtr te::da::DataAccess::getTransactor | ( | ) | const |
Sets he transactor to be used.
|
overridevirtual |
It returns the data type code associated to the data value.
Implements te::dt::AbstractData.
std::unique_ptr<te::da::DataSet> te::da::DataAccess::query | ( | const std::string & | query | ) |
std::unique_ptr<te::da::DataSet> te::da::DataAccess::query | ( | const te::da::Select & | select | ) |
void te::da::DataAccess::rollbackTransaction | ( | ) |
When handling with files, specially using OGR, the olnly way to ensure the data is writen tis to close dataSource. So this functions encapsulates it.
void te::da::DataAccess::saveDataSet | ( | te::da::DataSet * | dataSet, |
bool | enableProgress = true |
||
) |
Function used to save data into internal datasource (if a converter was defined, it will be used)
dataSet | Pointer to a data set to be saved |
void te::da::DataAccess::setConverter | ( | te::da::DataSetTypeConverter * | converter | ) |
Set data set converter type.
converter | The data set type converter pointer |
void te::da::DataAccess::setObjectIdSetFilter | ( | const te::da::ObjectIdSet * | objectIdSetFilter | ) |
Gets the current transactor. If no transactor is defined, it creates one.
void te::da::DataAccess::setQuery | ( | te::da::Select * | select | ) |
Set data set restriction.
select | The data set query pointer |
void te::da::DataAccess::setTransactor | ( | te::da::DataSourceTransactorPtr | transactor | ) |
|
overridevirtual |
Check if the the dataSet exists.
Implements te::dt::AbstractData.
|
protected |
Dataset name.
Definition at line 313 of file DataAccess.h.
|
protected |
Filter used to load data with restriction.
Definition at line 312 of file DataAccess.h.
|
protected |
Data set type.
Definition at line 310 of file DataAccess.h.
|
protected |
DataSetType Converter.
Definition at line 311 of file DataAccess.h.
|
protected |
Data source.
Definition at line 308 of file DataAccess.h.
|
protected |
A optional filter containg an objectId set.
Definition at line 314 of file DataAccess.h.
|
mutableprotected |
Transactor.
Definition at line 309 of file DataAccess.h.