27 #include "../../common/Translator.h" 
   28 #include "../../geometry/Envelope.h" 
   29 #include "../dataset/DataSetTypeCapabilities.h" 
   30 #include "../dataset/ObjectIdSet.h" 
   31 #include "../query/DataSetName.h" 
   32 #include "../query/Field.h" 
   33 #include "../query/Fields.h" 
   34 #include "../query/From.h" 
   35 #include "../query/FromItem.h" 
   36 #include "../query/Select.h" 
   37 #include "../query/Where.h" 
   65   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
   66   return t->getDataSet(name, travType, 
false, accessPolicy);
 
   70                                                               const std::string& propertyName,
 
   76   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
   77   return t->getDataSet(name, propertyName, e, r, travType, 
false, accessPolicy);
 
   81                                                               const std::string& propertyName,
 
   87   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
   88   return t->getDataSet(name, propertyName, g, r, travType, 
false, accessPolicy);
 
   96   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
   97   return t->getDataSet(name, oids, travType, 
false, accessPolicy);
 
  103   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  104   return t->query(q, travType, 
false,accessPolicy);
 
  110   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  111   return t->query(query, travType, 
false,accessPolicy);
 
  116   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  117   return t->execute(command);
 
  122   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  123   return t->execute(command);
 
  128   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  129   return t->escape(value);
 
  134   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  135   return t->isDataSetNameValid(datasetName);
 
  140   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  141   return t->isPropertyNameValid(propertyName);
 
  146   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  147   return t->getDataSetNames();
 
  152   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  153   return t->getNumberOfDataSets();
 
  158   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  159   return t->getDataSetType(name);
 
  164   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  165   return t->getCapabilities(name);
 
  170   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  171   return t->getProperties(datasetName);
 
  176   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  177   return t->getPropertyNames(datasetName);
 
  182   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  183   return t->getNumberOfProperties(datasetName);
 
  188   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  189   return t->propertyExists(datasetName, name);
 
  194   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  195   return t->getProperty(datasetName, name);  
 
  200   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  201   return t->getProperty(datasetName, propertyPos);  
 
  206   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  207   return t->addProperty(datasetName, p);  
 
  212   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  213   return t->dropProperty(datasetName, name);  
 
  217                                         const std::string& propertyName,
 
  218                                         const std::string& newPropertyName)
 
  220   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  221   return t->renameProperty(datasetName, propertyName, newPropertyName);  
 
  226   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  227   return t->changePropertyDefinition(datasetName, propName, newProp);
 
  232   assert(propsNames.size() == newProps.size());
 
  234   for(std::size_t i = 0; i < propsNames.size(); ++i)
 
  235     changePropertyDefinition(datasetName, propsNames[i], newProps[i]);
 
  240   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  241   return t->getPrimaryKey(datasetName);
 
  246   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  247   return t->primaryKeyExists(datasetName, name);
 
  252   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  253   return t->addPrimaryKey(datasetName, pk);
 
  258   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  259   return t->dropPrimaryKey(datasetName);
 
  264   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  265   return t->getForeignKey(datasetName, name);
 
  270   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  271   return t->getForeignKeyNames(datasetName);
 
  276   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  277   return t->foreignKeyExists(datasetName, name);
 
  282   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  283   return t->addForeignKey(datasetName, fk);
 
  288   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  289   return t->dropForeignKey(datasetName, fkName);
 
  293                                                                   const std::string& name)
 
  295   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  296   return t->getUniqueKey(datasetName, name);
 
  301   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  302   return t->getUniqueKeyNames(datasetName);
 
  307   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  308   return t->uniqueKeyExists(datasetName, name);
 
  313   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  314   return t->addUniqueKey(datasetName, uk);
 
  319   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  320   return t->dropUniqueKey(datasetName, name);
 
  324                                                                               const std::string& name)
 
  326   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  327   return t->getCheckConstraint(datasetName, name);
 
  332   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  333   return t->getCheckConstraintNames(datasetName);
 
  338   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  339   return t->checkConstraintExists(datasetName, name);
 
  344   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  345   return t->addCheckConstraint(datasetName, cc);
 
  350   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  351   return t->dropCheckConstraint(datasetName, name);
 
  356   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  357   return t->getIndex(datasetName, name);
 
  362   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  363   return t->getIndexNames(datasetName);
 
  368   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  369   return t->indexExists(datasetName, name);
 
  373                                   const std::map<std::string, std::string>& options)
 
  375   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  376   return t->addIndex(datasetName, idx, options);
 
  381   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  382   return t->dropIndex(datasetName, idxName);
 
  387   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  388   return t->getSequence(name);
 
  393   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  394   return t->getSequenceNames();
 
  399   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  400   return t->sequenceExists(name);
 
  405   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  406   return t->addSequence(sequence);
 
  411   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  412   return t->dropSequence(name);
 
  417   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  418   return t->getExtent(datasetName, propertyName);
 
  423   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  424   return t->getExtent(datasetName, propertyPos);
 
  429   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  430   return t->getNumberOfItems(datasetName);
 
  435   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  436   return t->hasDataSets();
 
  441   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  442   return t->dataSetExists(name);
 
  447   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  448   return t->createDataSet(dt, options);
 
  452                                       const std::string& cloneName,
 
  453                                       const std::map<std::string, std::string>& options)
 
  455   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  456   return t->cloneDataSet(name, cloneName, options);
 
  461   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  462   return t->dropDataSet(name);
 
  467   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  468   return t->renameDataSet(name, newName);
 
  473                              const std::map<std::string, std::string>& options,
 
  476   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  477   return t->add(datasetName, d, options, limit);
 
  482   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  483   return t->getEncoding();
 
  488   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  489   return t->remove(datasetName);
 
  494                                 const std::vector<std::size_t>& properties,
 
  496                                 const std::map<std::string, std::string>& options,
 
  499   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  500   return t->update(datasetName, dataset, properties, oids, options, limit);
 
  504                                 const std::vector<size_t>& ids)
 
  506   std::auto_ptr<DataSourceTransactor> t = getTransactor();
 
  507   return t->update(datasetName, dataset, properties, ids);
 
  515     throw Exception(
TE_TR(
"Could not find the appropriate factory to create a data source instance!"));
 
  527     throw Exception(
TE_TR(
"Could not find the appropriate factory to create a data source instance!"));
 
  537     throw Exception(
TE_TR(
"Could not find the appropriate factory in order to create a data source instance!"));
 
  539   return ds->exists(dsInfo);
 
  547     throw Exception(
TE_TR(
"Could not find the appropriate factory to create a data source instance!"));
 
  549   return ds->getDataSourceNames(dsInfo);
 
  557     throw Exception(
TE_TR(
"Could not find the appropriate factory to create a data source instance!"));
 
  559   return ds->getEncodings(dsInfo);
 
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. 
 
virtual bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid. 
 
virtual void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset. 
 
virtual void execute(const Query &command)
It executes the specified command using a generic query representation. 
 
virtual std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source. 
 
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. 
 
CharEncoding
Supported charsets (character encoding). 
 
virtual boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset. 
 
virtual void changePropertyDefinition(const std::string &datasetName, const std::string &propName, te::dt::Property *newProp)
 
virtual std::auto_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset. 
 
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 dis...
 
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
 
A class that models the description of a dataset. 
 
virtual bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset. 
 
virtual bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset. 
 
virtual void createDataSet(DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source. 
 
DataSource()
Default constructor that can be called by subclasses. 
 
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. 
 
SpatialRelation
Spatial relations between geometric objects. 
 
It describes a sequence (a number generator). 
 
virtual void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset. 
 
A class that describes a check constraint. 
 
virtual void addForeignKey(const std::string &datasetName, ForeignKey *fk)
It adds a foreign key constraint to a dataset. 
 
virtual ~DataSource()
Virtual destructor. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
virtual void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset. 
 
virtual void addSequence(Sequence *sequence)
It adds a new sequence in the data source. 
 
virtual std::auto_ptr< te::da::UniqueKey > getUniqueKey(const std::string &datasetName, const std::string &name)
It gets the unique key in the dataset with the given name. 
 
It models a property definition. 
 
virtual std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset. 
 
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. 
 
virtual void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset. 
 
virtual void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema. 
 
AccessPolicy
Supported data access policies (can be used as bitfield). 
 
TraverseType
A dataset can be traversed in two ways: 
 
virtual std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset. 
 
virtual void addCheckConstraint(const std::string &datasetName, CheckConstraint *cc)
It adds a check constraint to the dataset. 
 
An Envelope defines a 2D rectangular region. 
 
virtual void addUniqueKey(const std::string &datasetName, UniqueKey *uk)
It adds a unique key constraint to the dataset. 
 
This class represents a set of unique ids created in the same context. i.e. from the same data set...
 
virtual void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the given dataset. 
 
static std::auto_ptr< DataSource > make(const std::string &dsType)
 
virtual void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema. 
 
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...
 
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
 
virtual const DataSourceCapabilities & getCapabilities() const =0
It returns the known capabilities of the data source. 
 
void setId(const std::string &id)
It sets the data source identification. 
 
virtual std::string escape(const std::string &value)
It escapes a string for using in commands and queries. 
 
It models a foreign key constraint for a DataSetType. 
 
virtual std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset. 
 
It represents the system catalog of a DataSource. 
 
virtual std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source. 
 
virtual std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset. 
 
virtual void addPrimaryKey(const std::string &datasetName, PrimaryKey *pk)
It adds a primary key constraint to the dataset schema. 
 
It describes a unique key (uk) constraint. 
 
static std::vector< te::common::CharEncoding > getEncodings(const std::string &dsType, const std::map< std::string, std::string > &info)
It gets the encoding names of the data source. 
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
A Select models a query to be used when retrieving data from a DataSource. 
 
virtual bool isDataSetNameValid(const std::string &datasetName)
It checks if the given dataset name is valid. 
 
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. 
 
virtual bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source. 
 
A dataset is the unit of information manipulated by the data access module of TerraLib. 
 
virtual bool hasDataSets()
It checks if the data source has any dataset. 
 
virtual std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset. 
 
virtual void dropSequence(const std::string &name)
It removes the sequence from the data source. 
 
virtual std::auto_ptr< te::da::CheckConstraint > getCheckConstraint(const std::string &datasetName, const std::string &name)
It gets the check constraint of the dataset with the given name. 
 
virtual bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset. 
 
A factory for data sources. 
 
virtual void dropDataSet(const std::string &name)
It removes the dataset schema from the data source. 
 
virtual std::auto_ptr< ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset. 
 
virtual void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset. 
 
It describes a primary key (pk) constraint. 
 
static std::auto_ptr< DataSource > create(const std::string &dsType, const std::map< std::string, std::string > &dsInfo)
It creates a new repository for a data source. 
 
virtual std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset. 
 
virtual void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset. 
 
virtual void addIndex(const std::string &datasetName, Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset. 
 
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::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset. 
 
virtual bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source. 
 
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...
 
virtual std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source. 
 
const std::string & getId() const 
An identification value for the data source. 
 
virtual std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset. 
 
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. 
 
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. 
 
virtual std::auto_ptr< te::gm::Envelope > getExtent(const std::string &datasetName, const std::string &propertyName)
It retrieves the bounding rectangle of the spatial property for the given dataset. 
 
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. 
 
virtual std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset. 
 
A Query is independent from the data source language/dialect. 
 
It describes an index associated to a DataSetType. 
 
virtual std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset. 
 
virtual void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema. 
 
virtual std::auto_ptr< Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source. 
 
virtual te::common::CharEncoding getEncoding()
It return the DataOurce current encoding.