26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
30 #include "../../common/Enums.h"
31 #include "../../geometry/Enums.h"
32 #include "../dataset/CheckConstraint.h"
33 #include "../dataset/DataSetType.h"
34 #include "../dataset/DataSet.h"
35 #include "../dataset/ForeignKey.h"
36 #include "../dataset/Index.h"
37 #include "../dataset/PrimaryKey.h"
38 #include "../dataset/Sequence.h"
39 #include "../dataset/UniqueKey.h"
40 #include "../Config.h"
52 #include <boost/ptr_container/ptr_vector.hpp>
53 #include <boost/cstdint.hpp>
54 #include <boost/noncopyable.hpp>
55 #include <boost/shared_ptr.hpp>
61 namespace dt {
class Property; }
62 namespace gm {
class Envelope;
class Geometry; }
67 class DataSetTypeCapabilities;
101 virtual DataSource* getDataSource()
const = 0;
113 virtual void begin() = 0;
122 virtual void commit() = 0;
131 virtual void rollBack() = 0;
138 virtual bool isInTransaction()
const = 0;
167 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
169 bool connected =
false,
198 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
199 const std::string& propertyName,
203 bool connected =
false,
232 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
233 const std::string& propertyName,
237 bool connected =
false,
260 std::auto_ptr<te::da::DataSet> getDataSet(
const std::string& name,
263 bool connected =
false,
290 virtual std::auto_ptr<DataSet> query(
const Select& q,
292 bool connected =
false,
318 virtual std::auto_ptr<DataSet> query(
const std::string& query,
320 bool connected =
false,
339 virtual void execute(
const Query& command) = 0;
350 virtual void execute(
const std::string& command) = 0;
366 virtual std::auto_ptr<PreparedQuery> getPrepared(
const std::string& qName = std::string(
"")) = 0;
375 virtual std::auto_ptr<BatchExecutor> getBatchExecutor() = 0;
388 virtual void cancel() = 0;
399 virtual boost::int64_t getLastGeneratedId() = 0;
410 virtual std::string escape(
const std::string& value) = 0;
421 virtual bool isDataSetNameValid(
const std::string& datasetName);
432 virtual bool isPropertyNameValid(
const std::string& propertyName);
452 virtual std::vector<std::string> getDataSetNames() = 0;
463 virtual std::size_t getNumberOfDataSets() = 0;
486 virtual std::auto_ptr<te::da::DataSetType> getDataSetType(
const std::string& name) = 0;
497 virtual std::auto_ptr<te::da::DataSetTypeCapabilities> getCapabilities(
const std::string& name);
510 virtual boost::ptr_vector<te::dt::Property> getProperties(
const std::string& datasetName) = 0;
524 virtual std::auto_ptr<te::dt::Property> getProperty(
const std::string& datasetName,
const std::string& name) = 0;
538 virtual std::auto_ptr<te::dt::Property> getProperty(
const std::string& datasetName, std::size_t propertyPos) = 0;
554 virtual std::vector<std::string> getPropertyNames(
const std::string& datasetName) = 0;
567 virtual std::size_t getNumberOfProperties(
const std::string& datasetName) = 0;
581 virtual bool propertyExists(
const std::string& datasetName,
const std::string& name) = 0;
594 virtual void addProperty(
const std::string& datasetName,
te::dt::Property* p) = 0;
606 virtual void dropProperty(
const std::string& datasetName,
const std::string& name) = 0;
619 virtual void renameProperty(
const std::string& datasetName,
620 const std::string& propertyName,
621 const std::string& newPropertyName) = 0;
623 virtual void changePropertyDefinition(
const std::string& datasetName,
const std::string& propName,
te::dt::Property* newProp);
636 virtual std::auto_ptr<te::da::PrimaryKey> getPrimaryKey(
const std::string& datasetName) = 0;
650 virtual bool primaryKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
663 virtual void addPrimaryKey(
const std::string& datasetName,
PrimaryKey* pk) = 0;
674 virtual void dropPrimaryKey(
const std::string& datasetName) = 0;
688 virtual std::auto_ptr<ForeignKey> getForeignKey(
const std::string& datasetName,
const std::string& name) = 0;
701 virtual std::vector<std::string> getForeignKeyNames(
const std::string& datasetName) = 0;
713 virtual bool foreignKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
726 virtual void addForeignKey(
const std::string& datasetName,
ForeignKey* fk) = 0;
738 virtual void dropForeignKey(
const std::string& datasetName,
const std::string& fkName) = 0;
752 virtual std::auto_ptr<te::da::UniqueKey> getUniqueKey(
const std::string& datasetName,
const std::string& name) = 0;
765 virtual std::vector<std::string> getUniqueKeyNames(
const std::string& datasetName) = 0;
779 virtual bool uniqueKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
792 virtual void addUniqueKey(
const std::string& datasetName,
UniqueKey* uk) = 0;
804 virtual void dropUniqueKey(
const std::string& datasetName,
const std::string& name) = 0;
818 virtual std::auto_ptr<te::da::CheckConstraint> getCheckConstraint(
const std::string& datasetName,
const std::string& name) = 0;
831 virtual std::vector<std::string> getCheckConstraintNames(
const std::string& datasetName) = 0;
845 virtual bool checkConstraintExists(
const std::string& datasetName,
const std::string& name) = 0;
858 virtual void addCheckConstraint(
const std::string& datasetName,
CheckConstraint* cc) = 0;
870 virtual void dropCheckConstraint(
const std::string& datasetName,
const std::string& name) = 0;
884 virtual std::auto_ptr<te::da::Index> getIndex(
const std::string& datasetName,
const std::string& name) = 0;
897 virtual std::vector<std::string> getIndexNames(
const std::string& datasetName) = 0;
911 virtual bool indexExists(
const std::string& datasetName,
const std::string& name) = 0;
925 virtual void addIndex(
const std::string& datasetName,
Index* idx,
926 const std::map<std::string, std::string>& options) = 0;
938 virtual void dropIndex(
const std::string& datasetName,
const std::string& idxName) = 0;
951 virtual std::auto_ptr<Sequence> getSequence(
const std::string& name) = 0;
965 virtual std::vector<std::string> getSequenceNames() = 0;
978 virtual bool sequenceExists(
const std::string& name) = 0;
988 virtual void addSequence(
Sequence* sequence) = 0;
999 virtual void dropSequence(
const std::string& name) = 0;
1013 virtual std::auto_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
1014 const std::string& propertyName) = 0;
1028 virtual std::auto_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
1029 std::size_t propertyPos) = 0;
1042 virtual std::size_t getNumberOfItems(
const std::string& datasetName) = 0;
1053 virtual bool hasDataSets() = 0;
1066 virtual bool dataSetExists(
const std::string& name) = 0;
1098 virtual void createDataSet(
DataSetType* dt,
const std::map<std::string, std::string>& options) = 0;
1110 virtual void cloneDataSet(
const std::string& name,
1111 const std::string& cloneName,
1112 const std::map<std::string, std::string>& options) = 0;
1123 virtual void dropDataSet(
const std::string& name) = 0;
1135 virtual void renameDataSet(
const std::string& name,
const std::string& newName) = 0;
1159 virtual void add(
const std::string& datasetName,
1161 const std::map<std::string, std::string>& options,
1162 std::size_t limit = 0) = 0;
1177 virtual void remove(
const std::string& datasetName,
const ObjectIdSet* oids = 0) = 0;
1197 virtual void update(
const std::string& datasetName,
1199 const std::vector<std::size_t>& properties,
1201 const std::map<std::string, std::string>& options,
1202 std::size_t limit = 0) = 0;
1216 virtual void update(
const std::string& datasetName,
1218 const std::vector< std::set<int> >& properties,
1219 const std::vector<size_t>& ids);
1236 virtual void optimize(
const std::map<std::string, std::string>& opInfo) = 0;
1245 #endif // __TERRALIB_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
A class that models the description of a dataset.
boost::shared_ptr< DataSourceTransactor > DataSourceTransactorPtr
SpatialRelation
Spatial relations between geometric objects.
It describes a sequence (a number generator).
A class that describes a check constraint.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
It models a property definition.
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
An Envelope defines a 2D rectangular region.
A class that models an object that submits commands in batch to the data source.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
It models a foreign key constraint for a DataSetType.
A class that models a prepared query.
It describes a unique key (uk) constraint.
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
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.
A dataset is the unit of information manipulated by the data access module of TerraLib.
It describes a primary key (pk) constraint.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
A Query is independent from the data source language/dialect.
It describes an index associated to a DataSetType.