te::sqlite::DataSource Class Reference

#include <DataSource.h>

Inheritance diagram for te::sqlite::DataSource:
te::da::DataSource

Public Member Functions

void close ()
 It closes the data source and clears all the resources used by its internal communication channel. More...
 
 DataSource ()
 
const te::da::DataSourceCapabilitiesgetCapabilities () const
 It returns the known capabilities of the data source. More...
 
const std::map< std::string, std::string > & getConnectionInfo () const
 It returns the set of parameters used to set up the access channel to the underlying repository. More...
 
const te::da::SQLDialectgetDialect () const
 It returns the data source SQL dialect, if there is one. More...
 
const std::string & getId () const
 An identification value for the data source. More...
 
std::auto_ptr< te::da::DataSourceTransactorgetTransactor ()
 It returns an object that can execute transactions in the context of a data source. More...
 
std::string getType () const
 It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL. More...
 
bool isOpened () const
 It returns true if the data source is opened, otherwise it returns false. More...
 
bool isValid () const
 It checks if the data source is valid (available for using). More...
 
void open ()
 It opens the data source and makes it ready for using. More...
 
void setConnectionInfo (const std::map< std::string, std::string > &connInfo)
 It sets the connection information to be used when connecting to the data source. More...
 
void setId (const std::string &id)
 It sets the data source identification. More...
 
 ~DataSource ()
 Virtual destructor. More...
 
Dataset Metadata Retrieval

Methods for retrieving metadata about the datasets of the data source.

std::auto_ptr< te::da::DataSetTypeCapabilitiesgetCapabilities (const std::string &name)
 It gets capabilities about a data set. More...
 
virtual std::vector< std::string > getDataSetNames ()
 It gets the dataset names available in the data source. More...
 
virtual std::size_t getNumberOfDataSets ()
 It retrieves the number of data sets available in the data source. More...
 
virtual std::auto_ptr< te::da::DataSetTypegetDataSetType (const std::string &name)
 It gets information about the given dataset. More...
 
virtual boost::ptr_vector< te::dt::PropertygetProperties (const std::string &datasetName)
 It retrieves the properties of the dataset. More...
 
virtual std::auto_ptr< te::dt::PropertygetProperty (const std::string &datasetName, const std::string &name)
 It retrieves the property with the given name from the dataset. More...
 
virtual std::auto_ptr< te::dt::PropertygetProperty (const std::string &datasetName, std::size_t propertyPos)
 It retrieves the property lying in the given position from the dataset. More...
 
virtual std::vector< std::string > getPropertyNames (const std::string &datasetName)
 It gets the property names of the given dataset. More...
 
virtual std::size_t getNumberOfProperties (const std::string &datasetName)
 It gets the number of properties of the given dataset. More...
 
virtual bool propertyExists (const std::string &datasetName, const std::string &name)
 It checks if a property with the given name exists in the dataset. More...
 
virtual void addProperty (const std::string &datasetName, te::dt::Property *p)
 It adds a new property to the dataset schema. More...
 
virtual void dropProperty (const std::string &datasetName, const std::string &name)
 It removes a property from the given dataset. More...
 
virtual void renameProperty (const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
 It renames a property of the given dataset. More...
 
virtual void changePropertyDefinition (const std::string &datasetName, const std::string &propName, te::dt::Property *newProp)
 
virtual void changePropertiesDefinitions (const std::string &datasetName, const std::vector< std::string > &propsNames, const std::vector< te::dt::Property * > newProps)
 
virtual std::auto_ptr< te::da::PrimaryKeygetPrimaryKey (const std::string &datasetName)
 It retrieves the primary key of the dataset. More...
 
virtual bool primaryKeyExists (const std::string &datasetName, const std::string &name)
 It checks if a primary key exists in the dataset. More...
 
virtual void addPrimaryKey (const std::string &datasetName, PrimaryKey *pk)
 It adds a primary key constraint to the dataset schema. More...
 
virtual void dropPrimaryKey (const std::string &datasetName)
 It removes the primary key constraint from the dataset schema. More...
 
virtual std::auto_ptr< ForeignKey > getForeignKey (const std::string &datasetName, const std::string &name)
 It retrieves the foreign key from the given dataset. More...
 
virtual std::vector< std::string > getForeignKeyNames (const std::string &datasetName)
 It gets the foreign key names of the given dataset. More...
 
virtual 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. More...
 
virtual void addForeignKey (const std::string &datasetName, ForeignKey *fk)
 It adds a foreign key constraint to a dataset. More...
 
virtual void dropForeignKey (const std::string &datasetName, const std::string &fkName)
 It removes the foreign key constraint from the dataset schema. More...
 
virtual std::auto_ptr< te::da::UniqueKeygetUniqueKey (const std::string &datasetName, const std::string &name)
 It gets the unique key in the dataset with the given name. More...
 
virtual std::vector< std::string > getUniqueKeyNames (const std::string &datasetName)
 It gets the unique key names of the given dataset. More...
 
virtual bool uniqueKeyExists (const std::string &datasetName, const std::string &name)
 It checks if a unique key with the given name exists in the dataset. More...
 
virtual void addUniqueKey (const std::string &datasetName, UniqueKey *uk)
 It adds a unique key constraint to the dataset. More...
 
virtual void dropUniqueKey (const std::string &datasetName, const std::string &name)
 It removes the unique key constraint from the dataset. More...
 
virtual std::auto_ptr< te::da::CheckConstraintgetCheckConstraint (const std::string &datasetName, const std::string &name)
 It gets the check constraint of the dataset with the given name. More...
 
virtual std::vector< std::string > getCheckConstraintNames (const std::string &datasetName)
 It gets the check constraint names of the given dataset. More...
 
virtual 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. More...
 
virtual void addCheckConstraint (const std::string &datasetName, CheckConstraint *cc)
 It adds a check constraint to the dataset. More...
 
virtual void dropCheckConstraint (const std::string &datasetName, const std::string &name)
 It removes the check constraint from the dataset. More...
 
virtual std::auto_ptr< te::da::IndexgetIndex (const std::string &datasetName, const std::string &name)
 It gets the index with the given name from the dataset. More...
 
virtual std::vector< std::string > getIndexNames (const std::string &datasetName)
 It gets the index names of the given dataset. More...
 
virtual bool indexExists (const std::string &datasetName, const std::string &name)
 It checks if an index with the given name exists in the dataset. More...
 
virtual void addIndex (const std::string &datasetName, Index *idx, const std::map< std::string, std::string > &options)
 It adds an index to the dataset. More...
 
virtual void dropIndex (const std::string &datasetName, const std::string &idxName)
 It removes the index from the given dataset. More...
 
virtual std::auto_ptr< Sequence > getSequence (const std::string &name)
 It gets the sequence with the given name in the data source. More...
 
virtual std::vector< std::string > getSequenceNames ()
 It gets the sequence names available in the data source. More...
 
virtual bool sequenceExists (const std::string &name)
 It checks if a sequence with the given name exists in the data source. More...
 
virtual void addSequence (Sequence *sequence)
 It adds a new sequence in the data source. More...
 
virtual void dropSequence (const std::string &name)
 It removes the sequence from the data source. More...
 
virtual std::auto_ptr< te::gm::EnvelopegetExtent (const std::string &datasetName, const std::string &propertyName)
 It retrieves the bounding rectangle of the spatial property for the given dataset. More...
 
virtual std::auto_ptr< te::gm::EnvelopegetExtent (const std::string &datasetName, std::size_t propertyPos)
 It retrieves the bounding rectangle for the spatial property lying in the given position in the dataset. More...
 
virtual std::size_t getNumberOfItems (const std::string &datasetName)
 It retrieves the number of items of the given dataset. More...
 
virtual bool hasDataSets ()
 It checks if the data source has any dataset. More...
 
virtual bool dataSetExists (const std::string &name)
 It checks if a dataset with the given name exists in the data source. More...
 
Data Retrieval

Methods for retrieving data from the data source.

virtual std::auto_ptr< DataSet > getDataSet (const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It gets the dataset identified by the given name. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
virtual std::auto_ptr< DataSet > getDataSet (const std::string &name, const std::string &propertyName, const te::gm::Envelope *e, te::gm::SpatialRelation r, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It gets the dataset identified by the given name using a spatial filter over the specified property. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
virtual std::auto_ptr< DataSet > getDataSet (const std::string &name, const std::string &propertyName, const te::gm::Geometry *g, te::gm::SpatialRelation r, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It gets the dataset identified by the given name using a spatial filter over the given geometric property. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
std::auto_ptr< te::da::DataSetgetDataSet (const std::string &name, const te::da::ObjectIdSet *oids, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It gets the dataset identified by the given name using the identification of the objects. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
virtual std::auto_ptr< DataSet > query (const Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It executes a query that may return some data using a generic query. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
virtual std::auto_ptr< DataSet > query (const std::string &query, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
 It executes a query that may return some data using the data source native language. This method always returns a disconnected dataset, that is, a dataset that is no more dependent of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released. More...
 
Command Execution Methods

Methods for executing commands against the data source.

virtual void execute (const Query &command)
 It executes the specified command using a generic query representation. More...
 
virtual void execute (const std::string &command)
 It executes the specified command in the data source native language. More...
 
Auxiliary Methods for Commands and Queries

Auxiliary methods for commands and queries.

virtual std::string escape (const std::string &value)
 It escapes a string for using in commands and queries. More...
 
virtual bool isDataSetNameValid (const std::string &datasetName)
 It checks if the given dataset name is valid. More...
 
virtual bool isPropertyNameValid (const std::string &propertyName)
 It checks if the given property name is valid. More...
 
Dataset Schema Persistence Methods

Methods for dealing with datasource and dataset schema changes.

virtual void createDataSet (DataSetType *dt, const std::map< std::string, std::string > &options)
 It creates the dataset schema definition in the target data source. More...
 
virtual 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. More...
 
virtual void dropDataSet (const std::string &name)
 It removes the dataset schema from the data source. More...
 
virtual void renameDataSet (const std::string &name, const std::string &newName)
 It renames a dataset. More...
 
Dataset Persistence Methods

Methods for dealing with the persistence of data in a data source.

virtual void add (const std::string &datasetName, 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. More...
 
virtual te::common::CharEncoding getEncoding ()
 It return the DataSource current encoding. More...
 
virtual void remove (const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
 It removes all the informed items from the dataset. More...
 
virtual void update (const std::string &datasetName, 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. More...
 
virtual void update (const std::string &datasetName, DataSet *dataset, const std::vector< std::set< int > > &properties, const std::vector< size_t > &ids)
 It updates the contents of a dataset. More...
 

Static Public Member Functions

static void set (te::da::DataSourceCapabilities *capabilities)
 
static void set (te::da::SQLDialect *dialect)
 
Data Source static methods

Data Source static methods

static std::auto_ptr< DataSourcecreate (const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
 It creates a new repository for a data source. More...
 
static void drop (const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
 It removes a data source identified by its connection information and the driver type. More...
 
static bool exists (const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
 It checks if the data source exists with the connection information and the driver type. More...
 
static std::vector< std::string > getDataSourceNames (const std::string &dsType, const std::map< std::string, std::string > &info)
 It returns the data source names available in the driver. More...
 
static std::vector< te::common::CharEncodinggetEncodings (const std::string &dsType, const std::map< std::string, std::string > &info)
 It gets the encoding names of the data source. More...
 

Protected Member Functions

void create (const std::map< std::string, std::string > &dsInfo)
 It creates a new data source. More...
 
void drop (const std::map< std::string, std::string > &dsInfo)
 It removes the data source with the connection information from a driver. More...
 
bool exists (const std::map< std::string, std::string > &dsInfo)
 Check the existence of a data source in a driver. More...
 
std::vector< std::string > getDataSourceNames (const std::map< std::string, std::string > &dsInfo)
 It gets the data source names available in a driver. More...
 
std::vector< std::string > getEncodings (const std::map< std::string, std::string > &dsInfo)
 It gets the encodings for the data source. More...
 

Protected Attributes

std::string m_id
 The data source identification. More...
 

Private Attributes

Impl * m_pImpl
 

Detailed Description

Definition at line 36 of file DataSource.h.

Constructor & Destructor Documentation

te::sqlite::DataSource::DataSource ( )
te::sqlite::DataSource::~DataSource ( )
virtual

Virtual destructor.

Reimplemented from te::da::DataSource.

Member Function Documentation

virtual void te::da::DataSource::add ( const std::string &  datasetName,
DataSet d,
const std::map< std::string, std::string > &  options,
std::size_t  limit = 0 
)
virtualinherited

It adds data items to the dataset in the data source.

Parameters
datasetNameThe target dataset name.
dThe data items to be added to the dataset.
optionsA list of optional modifiers (driver specific).
limitThe number of items to be used from the input dataset. If set to 0 (default), all items are used.
Exceptions
ExceptionAn exception can be thrown, if the input dataset items could not be added to the given dataset.
Note
The dataset reading will start in the current position. So, keep in mind that it is the caller responsability to inform the right position(and a valid one) in the dataset 'd', to start the inserting process.
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual void te::da::DataSource::addCheckConstraint ( const std::string &  datasetName,
CheckConstraint cc 
)
virtualinherited

It adds a check constraint to the dataset.

Parameters
datasetNameThe dataset where the constraint will be added.
ccThe check constraint to be added.
Exceptions
ExceptionAn exception can be thrown, if the check constraint could not be added to the dataset schema.
Note
Don't delete the given check constraint, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::addForeignKey ( const std::string &  datasetName,
ForeignKey fk 
)
virtualinherited

It adds a foreign key constraint to a dataset.

Parameters
datasetNameThe dataset where the foreign key constraint will be added.
fkThe foreign key constraint.
Exceptions
ExceptionAn exception can be thrown, if the foreign key could not be added to the dataset schema.
Note
Don't delete the given foreign key, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::addIndex ( const std::string &  datasetName,
Index idx,
const std::map< std::string, std::string > &  options 
)
virtualinherited

It adds an index to the dataset.

Parameters
datasetNameThe dataset where the index will be added.
idxThe index to be added.
optionsA list of optional modifiers (driver specific).
Exceptions
ExceptionAn exception can be thrown, if the index could not be added to the dataset schema.
Note
Don't delete the given index, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::addPrimaryKey ( const std::string &  datasetName,
PrimaryKey pk 
)
virtualinherited

It adds a primary key constraint to the dataset schema.

Parameters
datasetNameThe name of the dataset where the primary key will be added.
pkThe primary key constraint.
Exceptions
ExceptionAn exception can be thrown, if the primary key could not be added to the dataset schema.
Note
Don't delete the given primary key, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::addProperty ( const std::string &  datasetName,
te::dt::Property p 
)
virtualinherited

It adds a new property to the dataset schema.

Parameters
datasetNameThe dataset where the property will be added.
pThe new property to be added.
Exceptions
ExceptionAn exception can be thrown, if the property could not be added to the dataset schema.
Note
Don't delete the given property, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual void te::da::DataSource::addSequence ( Sequence sequence)
virtualinherited

It adds a new sequence in the data source.

Exceptions
ExceptionAn exception can be thrown, if the sequence could not be added to the data source.
Note
Don't delete the given sequence, because the data source will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::addUniqueKey ( const std::string &  datasetName,
UniqueKey uk 
)
virtualinherited

It adds a unique key constraint to the dataset.

Parameters
datasetNameThe dataset where the unique key will be added.
ukThe unique key constraint.
Exceptions
ExceptionAn exception can be thrown, if the unique key could not be added to the dataset schema.
Note
Don't delete the given unique key, because the schema will take the ownership of it.
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::changePropertiesDefinitions ( const std::string &  datasetName,
const std::vector< std::string > &  propsNames,
const std::vector< te::dt::Property * >  newProps 
)
virtualinherited
virtual void te::da::DataSource::changePropertyDefinition ( const std::string &  datasetName,
const std::string &  propName,
te::dt::Property newProp 
)
virtualinherited
virtual bool te::da::DataSource::checkConstraintExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if a check-constraint with the given name exists in the data source.

Parameters
datasetNameThe dataset name.
nameThe check-constraint name.
Exceptions
ExceptionAn exception can be thrown, if the existence of the check constraint could not be determined.
Returns
True, if the check-constraint exists in the dataset; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::cloneDataSet ( const std::string &  name,
const std::string &  cloneName,
const std::map< std::string, std::string > &  options 
)
virtualinherited

It clones the dataset in the data source.

Parameters
nameThe dataset to be cloned.
cloneNameThe name of the cloned dataset.
optionsA list of optional modifiers. It is driver specific.
Exceptions
ExceptionAn exception can be thrown, if the dataset schema could not be cloned.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

void te::sqlite::DataSource::close ( )
virtual

It closes the data source and clears all the resources used by its internal communication channel.

This method closes any connection, any opened file, and releases any other resources.

Exceptions
ExceptionAn exception can be thrown, if the data source cannot be closed.
Note
Not thread-safe!

Implements te::da::DataSource.

void te::sqlite::DataSource::create ( const std::map< std::string, std::string > &  dsInfo)
protectedvirtual

It creates a new data source.

Parameters
dsInfoThe information for creating a new data source.
Exceptions
ExceptionAn exception can be thrown, if the data source could not be created.
Note
Not thread-safe!

Implements te::da::DataSource.

static std::auto_ptr<DataSource> te::da::DataSource::create ( const std::string &  dsType,
const std::map< std::string, std::string > &  dsInfo 
)
staticinherited

It creates a new repository for a data source.

Parameters
dsTypeThe type of data source to be created (example: POSTGIS, ORACLE, SQLITE).
dsInfoThe information for creating a new data source.
Exceptions
ExceptionAn exception can be thrown, if the data source could not be created.
Returns
A data source for the new data repository.
Note
Thread-safe!
virtual void te::da::DataSource::createDataSet ( DataSetType dt,
const std::map< std::string, std::string > &  options 
)
virtualinherited

It creates the dataset schema definition in the target data source.

If a dataset schema with the same name already exists in the target data source, this may throw an exception.

After calling this method, the dataset schema may be updated.

Parameters
dtThe dataset schema to be created. It may be changed during the operation.
optionsA list of optional modifiers (driver specific).
Precondition
The schema of a related dataset in a foreign key must be already in the data source.
Postcondition
In some data sources, this method may output implicit indexes, sequences or constraints. The method, if necessary, will create and adjust the dataset schema.
The caller of this method will take the ownership of the given schema.
Note
If you want to create a new schema based on an already existing one, you must create a fresh copy of the DataSetType with the clone() method.
Thread-safe!

Reimplemented in te::mem::DataSource, te::ogr::DataSource, and te::gpkg::DataSource.

virtual bool te::da::DataSource::dataSetExists ( const std::string &  name)
virtualinherited

It checks if a dataset with the given name exists in the data source.

Parameters
nameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the existence of a dataset in the data source could not be determined.
Returns
True, if the dataset exists in the data source; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

void te::sqlite::DataSource::drop ( const std::map< std::string, std::string > &  dsInfo)
protectedvirtual

It removes the data source with the connection information from a driver.

Parameters
dsInfoThe information for removing a data source from a driver.
Exceptions
ExceptionAn exception can be thrown, if the data source could not be removed.
Note
Not thread-safe!

Implements te::da::DataSource.

static void te::da::DataSource::drop ( const std::string &  dsType,
const std::map< std::string, std::string > &  dsInfo 
)
staticinherited

It removes a data source identified by its connection information and the driver type.

Parameters
dsTypeThe data source type name (example: POSTGIS, ORACLE, SQLITE).
dsInfoThe connection information for removing the data source.
Exceptions
ExceptionAn exception can be thrown, if the data source could not be removed.
Note
No other instance of the data source to be removed can be opened, when calling this method.
Thread-safe!
virtual void te::da::DataSource::dropCheckConstraint ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It removes the check constraint from the dataset.

Parameters
datasetNameThe dataset from where the check constraint will be removed.
nameThe check constraint to be removed.
Exceptions
ExceptionAn exception can be thrown, if the check constraint could not be removed from the dataset schema.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::dropDataSet ( const std::string &  name)
virtualinherited

It removes the dataset schema from the data source.

Parameters
nameThe dataset name whose schema will be removed from the data source.
Exceptions
ExceptionAn exception can be thrown, if the dataset could not be removed from the data source.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual void te::da::DataSource::dropForeignKey ( const std::string &  datasetName,
const std::string &  fkName 
)
virtualinherited

It removes the foreign key constraint from the dataset schema.

Parameters
datasetNameThe dataset where the foreign key will be removed.
fkNameThe foreign key to be removed.
Exceptions
ExceptionAn exception can be thrown, if the foreign key could not be removed from the dataset schema.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::dropIndex ( const std::string &  datasetName,
const std::string &  idxName 
)
virtualinherited

It removes the index from the given dataset.

Parameters
datasetNameThe dataset where the index will be removed.
idxNameThe index to be removed.
Exceptions
ExceptionAn exception can be thrown, if the index could not be removed from the dataset schema.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::dropPrimaryKey ( const std::string &  datasetName)
virtualinherited

It removes the primary key constraint from the dataset schema.

Parameters
datasetNameThe dataset from where the primary key will be removed.
Exceptions
ExceptionAn exception can be thrown, if the primary key could not be dropped from the dataset schema.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::dropProperty ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It removes a property from the given dataset.

Parameters
datasetNameThe dataset from where the given property will be removed.
nameThe property to be removed from the dataset.
Exceptions
ExceptionAn exception can be thrown, if the dataset property could not be removed.
Note
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual void te::da::DataSource::dropSequence ( const std::string &  name)
virtualinherited

It removes the sequence from the data source.

Parameters
nameThe sequence that will be removed.
Exceptions
ExceptionAn exception can be thrown, if the sequence could not be removed from the data source.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::dropUniqueKey ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It removes the unique key constraint from the dataset.

Parameters
datasetNameThe dataset from where the unique key will be removed.
nameThe unique key constraint name.
Exceptions
ExceptionAn exception can be thrown, if the unique key could not be removed from the dataset schema.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::string te::da::DataSource::escape ( const std::string &  value)
virtualinherited

It escapes a string for using in commands and queries.

Parameters
valueAny string.
Returns
A valid escaped string.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::execute ( const Query command)
virtualinherited

It executes the specified command using a generic query representation.

Parameters
commandA query like: CREATE, DROP, ALTER, INSERT, UPDATE, DELETE.
Exceptions
ExceptionAn exception can be thrown if the query cannot be performed.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::execute ( const std::string &  command)
virtualinherited

It executes the specified command in the data source native language.

Parameters
commandA query string in the data source native language (like: CREATE, DROP, ALTER, INSERT, UPDATE, DELETE).
Exceptions
ExceptionAn exception can be thrown if the query can not be performed.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

bool te::sqlite::DataSource::exists ( const std::map< std::string, std::string > &  dsInfo)
protectedvirtual

Check the existence of a data source in a driver.

Parameters
dsInfoThe data source information.
Exceptions
ExceptionAn exception can be thrown, if the existence of a data source in a driver could not be determined.
Returns
True, if the data source exists, or false, otherwise.
Note
Thread-safe!

Implements te::da::DataSource.

static bool te::da::DataSource::exists ( const std::string &  dsType,
const std::map< std::string, std::string > &  dsInfo 
)
staticinherited

It checks if the data source exists with the connection information and the driver type.

Parameters
dsTypeThe data source type name (example: POSTGIS, ORACLE, SQLITE).
dsInfoThe data source information.
Exceptions
ExceptionAn exception can be thrown, if the data source exists in the driver.
Returns
True, if the data source exists; otherwise, it returns false.
Note
Thread-safe!
virtual bool te::da::DataSource::foreignKeyExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if a foreign key with the given name exists in the data source.

Parameters
datasetNameThe dataset name.
nameThe foreign key name.
Exceptions
ExceptionAn exception can be thrown, if the existence of the foreign key could not be obtained.
Returns
True, if the foreign key exists in the dataset; otherwise, it returns false.

Reimplemented in te::gdal::DataSource.

const te::da::DataSourceCapabilities& te::sqlite::DataSource::getCapabilities ( ) const
virtual

It returns the known capabilities of the data source.

The returned object has all the information about the operations the data source can perform. Here you will find if the data source implementation supports primary keys, foreign keys, if it can be used in a thread environment and much more information.

Parameters
capabilitiesThe known capabilities of the data source.
Note
Thread-safe!

Implements te::da::DataSource.

std::auto_ptr<te::da::DataSetTypeCapabilities> te::da::DataSource::getCapabilities ( const std::string &  name)
inherited

It gets capabilities about a data set.

Parameters
nameName of the dataset.
Returns
The capabilities of the data set.
virtual std::auto_ptr<te::da::CheckConstraint> te::da::DataSource::getCheckConstraint ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It gets the check constraint of the dataset with the given name.

Parameters
datasetNameThe dataset name.
nameThe check constraint name.
Exceptions
ExceptionAn exception can be thrown, if the check constraint could not be retrieved.
Returns
The check constraint with the given name.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::vector<std::string> te::da::DataSource::getCheckConstraintNames ( const std::string &  datasetName)
virtualinherited

It gets the check constraint names of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the check constraint names could not be retrieved.
Returns
The check constraint names of the dataset.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

const std::map<std::string, std::string>& te::sqlite::DataSource::getConnectionInfo ( ) const
virtual

It returns the set of parameters used to set up the access channel to the underlying repository.

This is the connection information used by a data source in order to enter in an operational mode, when the open method is called.

The key-value-pairs (kvp) may contain information about: maximum number of accepted connections, user name and password required for establishing a connection, the url of a service, or any other information needed by the data source to operate. This information is dependent on the data source driver, so check the driver documentation for any additional information about the kvp.

Returns
An associative container (key-value-pair) with information about the data source.
Note
Thread-safe!

Implements te::da::DataSource.

virtual std::auto_ptr<DataSet> te::da::DataSource::getDataSet ( const std::string &  name,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
virtualinherited

It gets the dataset identified by the given name. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

Parameters
nameThe dataset name.
accessPolicyAccess policy.
travTypeThe traverse type associated to the returned dataset.
Exceptions
ExceptionIt can throw an exception if:
  • something goes wrong during the data retrieval
  • if the data source driver doesn't support the traversal type
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<DataSet> te::da::DataSource::getDataSet ( const std::string &  name,
const std::string &  propertyName,
const te::gm::Envelope e,
te::gm::SpatialRelation  r,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
virtualinherited

It gets the dataset identified by the given name using a spatial filter over the specified property. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

Parameters
nameThe dataset name.
propertyNameThe name of the spatial property used to apply the spatial filter.
eA rectangle used as a spatial filter when retrieving the dataset.
rThe spatial relation used during the filtering.
accessPolicyAccess policy.
travTypeThe traversal type associated to the returned dataset.
Exceptions
ExceptionIt can throw an exception if:
  • something goes wrong during the data retrieval
  • if the data source driver doesn't support the traversal type
Note
The envelope coordinates should be in the same coordinate system as the dataset.
Thread-safe!
virtual std::auto_ptr<DataSet> te::da::DataSource::getDataSet ( const std::string &  name,
const std::string &  propertyName,
const te::gm::Geometry g,
te::gm::SpatialRelation  r,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
virtualinherited

It gets the dataset identified by the given name using a spatial filter over the given geometric property. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

Parameters
nameThe dataset name.
propertyNameThe name of the spatial property used to apply the spatial filter.
gThe geometry used as a spatial filter when retrieving the dataset.
rThe spatial relation used during the filtering.
accessPolicyAccess policy.
travTypeThe traverse type associated to the returned dataset.
Note
The geometry coordinates should be in the same coordinate system as the dataset.
Thread-safe!
std::auto_ptr<te::da::DataSet> te::da::DataSource::getDataSet ( const std::string &  name,
const te::da::ObjectIdSet oids,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
inherited

It gets the dataset identified by the given name using the identification of the objects. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

Parameters
nameThe dataset name.
oidsA pointer to the set of objects. Do not pass a null pointer nor an empty set.
accessPolicyAccess policy.
travTypeThe traverse type associated to the returned dataset.
Exceptions
ExceptionIt can throw an exception if:
  • something goes wrong during data retrieval
  • if the data source driver doesn't support the traversal type
Note
Thread-safe!
virtual std::vector<std::string> te::da::DataSource::getDataSetNames ( )
virtualinherited

It gets the dataset names available in the data source.

Returns
The dataset names available in the data source.
Exceptions
ExceptionAn exception can be thrown, if the dataset names could not be retrieved.
Note
Each dataset in the data source must have a unique name. For example, in a DBMS the name may contain the schema name before the table name separated by a dot notation (".").
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<te::da::DataSetType> te::da::DataSource::getDataSetType ( const std::string &  name)
virtualinherited

It gets information about the given dataset.

This method can provide the following information about a dataset:

  • the list of properties, including: name, data type, size, if the value is required or not, if it is an autoincrement
  • primary key
  • foreign keys
  • unique keys
  • check constraints
  • indexes
Parameters
nameThe name of the dataset we are looking information for.
Exceptions
ExceptionAn exception can be thrown, if the information about the dataset could not be retrieved.
Returns
The dataset schema.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

std::vector<std::string> te::sqlite::DataSource::getDataSourceNames ( const std::map< std::string, std::string > &  dsInfo)
protectedvirtual

It gets the data source names available in a driver.

Parameters
dsInfoThe data source information.
Exceptions
ExceptionAn exception can be thrown, if the data source names could not be retrieved.
Returns
The data source names available in the driver.
Note
Not thread-safe!

Implements te::da::DataSource.

static std::vector<std::string> te::da::DataSource::getDataSourceNames ( const std::string &  dsType,
const std::map< std::string, std::string > &  info 
)
staticinherited

It returns the data source names available in the driver.

Parameters
dsTypeThe type name of the data source(example: PostGIS, Oracle, WFS).
dsInfoThe information about the data sources.
Exceptions
ExceptionAn exception can be thrown, if the data source names could not be retrieved.
Returns
The data source names available.
Exceptions
ExceptionAn exception can be thrown, if the list of data source names could not be retrieved.
const te::da::SQLDialect* te::sqlite::DataSource::getDialect ( ) const
virtual

It returns the data source SQL dialect, if there is one.

Returns
The data source SQL dialect.
Note
Thread-safe!

Implements te::da::DataSource.

virtual te::common::CharEncoding te::da::DataSource::getEncoding ( )
virtualinherited

It return the DataSource current encoding.

Returns
The DataSource current encoding.
std::vector<std::string> te::sqlite::DataSource::getEncodings ( const std::map< std::string, std::string > &  dsInfo)
protectedvirtual

It gets the encodings for the data source.

Parameters
dsInfoThe data source information.
Exceptions
ExceptionAn exception can be thrown, if the encoding names could not be retrieved.
Returns
The encoding types for the data source.

Implements te::da::DataSource.

static std::vector<te::common::CharEncoding> te::da::DataSource::getEncodings ( const std::string &  dsType,
const std::map< std::string, std::string > &  info 
)
staticinherited

It gets the encoding names of the data source.

Parameters
dsTypeThe data source type name (example: PostGIS, Oracle, WFS).
dsInfoThe data source information.
Exceptions
ExceptionAn exception can be thrown, if the encoding names could not be retrieved.
Returns
The encoding types of the data source.
virtual std::auto_ptr<te::gm::Envelope> te::da::DataSource::getExtent ( const std::string &  datasetName,
const std::string &  propertyName 
)
virtualinherited

It retrieves the bounding rectangle of the spatial property for the given dataset.

Parameters
datasetNameThe dataset name.
propertyNameThe spatial property name.
Exceptions
ExceptionAn exception can be thrown, if the extent of the geometry property could not be retrieved.
Returns
The spatial property bounding rectangle, or NULL, if none can be retrieved.
Note
Thread-safe!
virtual std::auto_ptr<te::gm::Envelope> te::da::DataSource::getExtent ( const std::string &  datasetName,
std::size_t  propertyPos 
)
virtualinherited

It retrieves the bounding rectangle for the spatial property lying in the given position in the dataset.

Parameters
datasetNameThe dataset name.
propertyPosThe spatial property position.
Exceptions
ExceptionAn exception can be thrown, if the extent of the geometry property lying in the given position could not be retrieved.
Returns
The spatial property bounding rectangle, or NULL, if none can be retrieved.
Note
Thread-safe!
virtual std::auto_ptr<ForeignKey> te::da::DataSource::getForeignKey ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It retrieves the foreign key from the given dataset.

Parameters
datasetNameThe dataset name.
nameThe foreign key name.
Exceptions
ExceptionAn exception can be thrown, if the foreign key could not be retrieved.
Returns
If the foreign key exists in the dataset, it is returned; otherwise, a NULL is returned.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::vector<std::string> te::da::DataSource::getForeignKeyNames ( const std::string &  datasetName)
virtualinherited

It gets the foreign key names of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the foreign key names could not be retrieved.
Returns
The foreign key names of the dataset.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

const std::string& te::da::DataSource::getId ( ) const
inherited

An identification value for the data source.

Returns
The data source identification.
virtual std::auto_ptr<te::da::Index> te::da::DataSource::getIndex ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It gets the index with the given name from the dataset.

Parameters
datasetNameThe dataset name.
nameThe index name.
Exceptions
ExceptionAn exception can be thrown, if the index could not be retrieved.
Returns
The index from the given dataset.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::vector<std::string> te::da::DataSource::getIndexNames ( const std::string &  datasetName)
virtualinherited

It gets the index names of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the index names could not be retrieved.
Returns
The index names of the given dataset.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::size_t te::da::DataSource::getNumberOfDataSets ( )
virtualinherited

It retrieves the number of data sets available in the data source.

Exceptions
ExceptionAn exception can be thrown, if the number of datasets could not be retrieved.
Returns
The number of data sets available in the data source.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::size_t te::da::DataSource::getNumberOfItems ( const std::string &  datasetName)
virtualinherited

It retrieves the number of items of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the number of items of the dataset could not be retrieved.
Returns
The number of items of the given dataset.
Note
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual std::size_t te::da::DataSource::getNumberOfProperties ( const std::string &  datasetName)
virtualinherited

It gets the number of properties of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the number of dataset properties could not be retrieved.
Returns
The number of dataset properties.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<te::da::PrimaryKey> te::da::DataSource::getPrimaryKey ( const std::string &  datasetName)
virtualinherited

It retrieves the primary key of the dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the primary key could not be retrieved.
Returns
If a primary key exists in the dataset, it is returned; otherwise, a NULL is returned.
Note
Thread-safe!
virtual boost::ptr_vector<te::dt::Property> te::da::DataSource::getProperties ( const std::string &  datasetName)
virtualinherited

It retrieves the properties of the dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the dataset properties could not be retrieved.
Returns
The dataset properties.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<te::dt::Property> te::da::DataSource::getProperty ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It retrieves the property with the given name from the dataset.

Parameters
datasetNameThe dataset name.
propertyNameThe property name.
Exceptions
ExceptionAn exception can be thrown, if the dataset property could not be retrieved.
Returns
The property with the given name from the dataset.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<te::dt::Property> te::da::DataSource::getProperty ( const std::string &  datasetName,
std::size_t  propertyPos 
)
virtualinherited

It retrieves the property lying in the given position from the dataset.

Parameters
datasetNameThe dataset name.
propertyPosThe property position.
Exceptions
ExceptionAn exception can be thrown, if the property lying in the given position could not be retrieved.
Returns
The property in the given position.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::vector<std::string> te::da::DataSource::getPropertyNames ( const std::string &  datasetName)
virtualinherited

It gets the property names of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the property names of the dataset could not be retrieved.
Returns
The property names of the dataset.
Note
Each dataset in the data source must have a unique name. For example, in a DBMS the name may contain the schema name before the table name separated by a dot notation (".").
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<Sequence> te::da::DataSource::getSequence ( const std::string &  name)
virtualinherited

It gets the sequence with the given name in the data source.

Parameters
nameThe sequence name.
Exceptions
ExceptionAn exception can be thrown, if the sequence could not be retrieved from the data source.
Returns
The sequence with the given name.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::vector<std::string> te::da::DataSource::getSequenceNames ( )
virtualinherited

It gets the sequence names available in the data source.

Note
Each sequence in the data source must have a unique name. For example, in a DBMS the name may contain the schema name before the sequence name separated by a dot notation (".").
Exceptions
ExceptionAn exception can be thrown, if the sequence names could not be retrieved.
Returns
The sequence names of the data source.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

std::auto_ptr<te::da::DataSourceTransactor> te::sqlite::DataSource::getTransactor ( )
virtual

It returns an object that can execute transactions in the context of a data source.

Use this method to get an object that allows to retrieve a dataset, to insert or update data, or to modify dataset types(schemas). You don't need to cache this kind of object because each driver in TerraLib already keeps a connection pooling. So, as soon as you finish using the transactor, destroy it.

Returns
A pointer to an object that can execute transactions in the context of a data source.
Exceptions
ExceptionAn exception can be thrown, if it is not possible to get a transactor; for example, if there is no available connection.
Note
Thread-safe!

Implements te::da::DataSource.

std::string te::sqlite::DataSource::getType ( ) const
virtual

It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.

Returns
The data source type name. Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
Note
Each data source driver must have a unique name.
Thread-safe!

Implements te::da::DataSource.

virtual std::auto_ptr<te::da::UniqueKey> te::da::DataSource::getUniqueKey ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It gets the unique key in the dataset with the given name.

Parameters
datasetNameThe dataset name.
nameThe unique key name.
Exceptions
ExceptionAn exception can be thrown, if the unique key could not be retrieved.
Returns
The unique key with the given name in the dataset.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual std::vector<std::string> te::da::DataSource::getUniqueKeyNames ( const std::string &  datasetName)
virtualinherited

It gets the unique key names of the given dataset.

Parameters
datasetNameThe dataset name.
Exceptions
ExceptionAn exception can be thrown, if the unique key names could not be obtained.
Returns
The unique key names of the dataset.
Note
Thread-safe!
virtual bool te::da::DataSource::hasDataSets ( )
virtualinherited

It checks if the data source has any dataset.

Exceptions
ExceptionAn exception can be thrown, if it is not possible to check if the data source has datasets .
Returns
True, if the data source has datasets; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual bool te::da::DataSource::indexExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if an index with the given name exists in the dataset.

Parameters
datasetNameThe dataset name.
nameThe index name.
Exceptions
ExceptionAn exception can be thrown, if the index existence could not be determined.
Returns
True, if the index exists in the dataset; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual bool te::da::DataSource::isDataSetNameValid ( const std::string &  datasetName)
virtualinherited

It checks if the given dataset name is valid.

Parameters
datasetNameA dataset name whose validity will be checked.
Returns
True, if the name is valid according to the data source rules.
Note
Thread-safe!
bool te::sqlite::DataSource::isOpened ( ) const
virtual

It returns true if the data source is opened, otherwise it returns false.

This method will not check if the data source is available for using; it will just answer if the data source has already been opened. If you want to know if the data source is available for using, check the isValid() method.

Returns
It returns true if the data source is opened; otherwise, it returns false.
Note
Not thread-safe!

Implements te::da::DataSource.

virtual bool te::da::DataSource::isPropertyNameValid ( const std::string &  propertyName)
virtualinherited

It checks if the given property name is valid.

Parameters
propertyNameA property name whose validity will be checked.
Returns
True, if the name is valid according to the data source rules.
Note
Thread-safe!
bool te::sqlite::DataSource::isValid ( ) const
virtual

It checks if the data source is valid (available for using).

For a DBMS, it will check the opened connections. For a WFS client, it will check if the server is reachable. For a file, it will check if it can be read.

Returns
It returns true if the data source is available; otherwise, it returns false.
Note
Not thread-safe!

Implements te::da::DataSource.

void te::sqlite::DataSource::open ( )
virtual

It opens the data source and makes it ready for using.

If the subclass needs to open a connection to a database server, to open a file, or to get information from a Web Service, this method can do this kind of job to prepare the data source to be in an operational mode. It will use the connection information provided by the setConnectionInfo methods.

Exceptions
ExceptionAn exception can be thrown, if the data source cannot be opened.
Note
Not thread-safe!

Implements te::da::DataSource.

virtual bool te::da::DataSource::primaryKeyExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if a primary key exists in the dataset.

Parameters
datasetNameThe dataset name.
nameThe primary key name.
Exceptions
ExceptionAn exception can be thrown, if the existence of the primary key could not be determined.
Returns
True, if a primary key exists in the dataset; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual bool te::da::DataSource::propertyExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if a property with the given name exists in the dataset.

Parameters
datasetNameThe dataset name.
nameThe property name.
Exceptions
ExceptionAn exception can be thrown, if the existence of the dataset property could not be obtained.
Returns
True, if the property exists in the dataset; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual std::auto_ptr<DataSet> te::da::DataSource::query ( const Select q,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
virtualinherited

It executes a query that may return some data using a generic query. This method always returns a disconnected dataset, that is, a dataset that no more depends of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

This method is different of the method that accepts a dataset name and a spatial filter; this method allows the retrieving of only a subset of the attributes, since a query can include a property list.

Parameters
qA valid query object.
travTypeThe traverse type associated to the returned dataset.
accessPolicyAccess policy.
Exceptions
ExceptionIt can throw an exception if:
  • something goes wrong during data retrieval
  • if the data source driver doesn't support the traversal type
Note
Thread-safe!
virtual std::auto_ptr<DataSet> te::da::DataSource::query ( const std::string &  query,
te::common::TraverseType  travType = te::common::FORWARDONLY,
const te::common::AccessPolicy  accessPolicy = te::common::RAccess 
)
virtualinherited

It executes a query that may return some data using the data source native language. This method always returns a disconnected dataset, that is, a dataset that is no more dependent of the data source that provided the connection for its creation. Therefore, the disconnected dataset continues to live after the connection given by the data source has been released.

Parameters
queryA query string in the data source native language.
travTypeThe traverse type associated to the returned dataset.
accessPolicyAccess policy.
Exceptions
ExceptionIt can throw an exception if:
  • something goes wrong during data retrieval
  • if the data source driver doesn't support the traversal type
Note
Don't use this method, if you want portability for your application.
Thread-safe!
virtual void te::da::DataSource::remove ( const std::string &  datasetName,
const te::da::ObjectIdSet oids = 0 
)
virtualinherited

It removes all the informed items from the dataset.

It removes all the data items from a dataset which are identified by a set of object identifiers. If this set is not informed, all items will be removed.

Parameters
datasetNameThe dataset name.
oidsA set of object identifiers used used to remove data from the dataset, or NULL, for removing all.
Exceptions
ExceptionAn exception can be thrown, if the data items could not be removed.
Note
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual void te::da::DataSource::renameDataSet ( const std::string &  name,
const std::string &  newName 
)
virtualinherited

It renames a dataset.

Parameters
nameThe name of the dataset to be renamed.
newNameThe new dataset name.
Exceptions
ExceptionAn exception can be thrown, if the dataset could not be renamed.
Note
Thread-safe!

Reimplemented in te::mem::DataSource.

virtual void te::da::DataSource::renameProperty ( const std::string &  datasetName,
const std::string &  propertyName,
const std::string &  newPropertyName 
)
virtualinherited

It renames a property of the given dataset.

Parameters
datasetNameThe dataset containing the property to be renamed.
propertyNameThe property to be renamed from the dataset.
newPropertyNameThe new property name.
Exceptions
ExceptionAn exception can be thrown, if the dataset property could not be renamed.
Note
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual bool te::da::DataSource::sequenceExists ( const std::string &  name)
virtualinherited

It checks if a sequence with the given name exists in the data source.

Parameters
nameThe sequence name.
Exceptions
ExceptionAn exception can be thrown, if the index existence could not be determined.
Returns
True, if the sequence exists in the data source; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

static void te::sqlite::DataSource::set ( te::da::DataSourceCapabilities capabilities)
static
static void te::sqlite::DataSource::set ( te::da::SQLDialect dialect)
static
void te::sqlite::DataSource::setConnectionInfo ( const std::map< std::string, std::string > &  connInfo)
virtual

It sets the connection information to be used when connecting to the data source.

Parameters
connInfoKey-value-pairs (kvp) with the connection information.

Implements te::da::DataSource.

void te::da::DataSource::setId ( const std::string &  id)
inherited

It sets the data source identification.

Parameters
idAn identification value.
virtual bool te::da::DataSource::uniqueKeyExists ( const std::string &  datasetName,
const std::string &  name 
)
virtualinherited

It checks if a unique key with the given name exists in the dataset.

Parameters
datasetNameThe dataset name.
nameThe unique key name.
Exceptions
ExceptionAn exception can be thrown, if the existence of the unique key could not be determined.
Returns
True, if the unique key exists in the dataset; otherwise, it returns false.
Note
Thread-safe!

Reimplemented in te::gdal::DataSource.

virtual void te::da::DataSource::update ( const std::string &  datasetName,
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 
)
virtualinherited

It updates the contents of a dataset for the set of data items.

Parameters
datasetNameThe target dataset name.
datasetThe list of data items to be updated.
propertiesThe list of properties of the dataset to be updated.
oidsThe list of objects to be updated.
optionsA list of optional modifiers. It is driver specific.
limitThe number of items to be used from the input dataset. If set to 0 (default) all items are used.
Exceptions
ExceptionAn exception can be thrown, if the dataset could not be updated.
Note
The dataset reading will start in the current position. So, keep in mind that it is the caller responsability to inform the right position(and a valid one) for the dataset 'd', to start the updating process.
Thread-safe!

Reimplemented in te::mem::DataSource, and te::gdal::DataSource.

virtual void te::da::DataSource::update ( const std::string &  datasetName,
DataSet dataset,
const std::vector< std::set< int > > &  properties,
const std::vector< size_t > &  ids 
)
virtualinherited

It updates the contents of a dataset.

All rows are edited. The third parameter tells wich columns are edited for each row.

Parameters
datasetNameName pf the dataset.
datasetDataset with editions.
propertiesColumns edited for each row. Note that the size of properties must be the same of the dataset.
idsList of positions of the columns that identifies rows.
Exceptions
te::da::ExceptionAn exception can be thrown, if the dataset could not be updated.

Member Data Documentation

std::string te::da::DataSource::m_id
protectedinherited

The data source identification.

Definition at line 1432 of file DataSource.h.

Impl* te::sqlite::DataSource::m_pImpl
private

Definition at line 82 of file DataSource.h.


The documentation for this class was generated from the following file: