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"
51 #include <boost/ptr_container/ptr_vector.hpp>
52 #include <boost/cstdint.hpp>
53 #include <boost/noncopyable.hpp>
54 #include <boost/shared_ptr.hpp>
60 namespace dt {
class Property; }
61 namespace gm {
class Envelope;
class Geometry; }
111 virtual void begin() = 0;
120 virtual void commit() = 0;
129 virtual void rollBack() = 0;
136 virtual bool isInTransaction()
const = 0;
165 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
167 bool connected =
false,
196 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
197 const std::string& propertyName,
201 bool connected =
false,
230 virtual std::auto_ptr<DataSet> getDataSet(
const std::string& name,
231 const std::string& propertyName,
235 bool connected =
false,
258 std::auto_ptr<te::da::DataSet> getDataSet(
const std::string& name,
261 bool connected =
false,
288 virtual std::auto_ptr<DataSet> query(
const Select& q,
290 bool connected =
false,
316 virtual std::auto_ptr<DataSet> query(
const std::string& query,
318 bool connected =
false,
337 virtual void execute(
const Query& command) = 0;
348 virtual void execute(
const std::string& command) = 0;
364 virtual std::auto_ptr<PreparedQuery> getPrepared(
const std::string& qName = std::string(
"")) = 0;
373 virtual std::auto_ptr<BatchExecutor> getBatchExecutor() = 0;
386 virtual void cancel() = 0;
397 virtual boost::int64_t getLastGeneratedId() = 0;
408 virtual std::string escape(
const std::string& value) = 0;
419 virtual bool isDataSetNameValid(
const std::string& datasetName) = 0;
430 virtual bool isPropertyNameValid(
const std::string& propertyName) = 0;
450 virtual std::vector<std::string> getDataSetNames() = 0;
461 virtual std::size_t getNumberOfDataSets() = 0;
484 virtual std::auto_ptr<te::da::DataSetType> getDataSetType(
const std::string& name) = 0;
497 virtual boost::ptr_vector<te::dt::Property> getProperties(
const std::string& datasetName) = 0;
511 virtual std::auto_ptr<te::dt::Property> getProperty(
const std::string& datasetName,
const std::string& name) = 0;
525 virtual std::auto_ptr<te::dt::Property> getProperty(
const std::string& datasetName, std::size_t propertyPos) = 0;
541 virtual std::vector<std::string> getPropertyNames(
const std::string& datasetName) = 0;
554 virtual std::size_t getNumberOfProperties(
const std::string& datasetName) = 0;
568 virtual bool propertyExists(
const std::string& datasetName,
const std::string& name) = 0;
581 virtual void addProperty(
const std::string& datasetName,
te::dt::Property* p) = 0;
593 virtual void dropProperty(
const std::string& datasetName,
const std::string& name) = 0;
606 virtual void renameProperty(
const std::string& datasetName,
607 const std::string& propertyName,
608 const std::string& newPropertyName) = 0;
621 virtual std::auto_ptr<te::da::PrimaryKey> getPrimaryKey(
const std::string& datasetName) = 0;
635 virtual bool primaryKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
648 virtual void addPrimaryKey(
const std::string& datasetName,
PrimaryKey* pk) = 0;
659 virtual void dropPrimaryKey(
const std::string& datasetName) = 0;
673 virtual std::auto_ptr<ForeignKey> getForeignKey(
const std::string& datasetName,
const std::string& name) = 0;
686 virtual std::vector<std::string> getForeignKeyNames(
const std::string& datasetName) = 0;
698 virtual bool foreignKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
711 virtual void addForeignKey(
const std::string& datasetName,
ForeignKey* fk) = 0;
723 virtual void dropForeignKey(
const std::string& datasetName,
const std::string& fkName) = 0;
737 virtual std::auto_ptr<te::da::UniqueKey> getUniqueKey(
const std::string& datasetName,
const std::string& name) = 0;
750 virtual std::vector<std::string> getUniqueKeyNames(
const std::string& datasetName) = 0;
764 virtual bool uniqueKeyExists(
const std::string& datasetName,
const std::string& name) = 0;
777 virtual void addUniqueKey(
const std::string& datasetName,
UniqueKey* uk) = 0;
789 virtual void dropUniqueKey(
const std::string& datasetName,
const std::string& name) = 0;
803 virtual std::auto_ptr<te::da::CheckConstraint> getCheckConstraint(
const std::string& datasetName,
const std::string& name) = 0;
816 virtual std::vector<std::string> getCheckConstraintNames(
const std::string& datasetName) = 0;
830 virtual bool checkConstraintExists(
const std::string& datasetName,
const std::string& name) = 0;
843 virtual void addCheckConstraint(
const std::string& datasetName,
CheckConstraint* cc) = 0;
855 virtual void dropCheckConstraint(
const std::string& datasetName,
const std::string& name) = 0;
869 virtual std::auto_ptr<te::da::Index> getIndex(
const std::string& datasetName,
const std::string& name) = 0;
882 virtual std::vector<std::string> getIndexNames(
const std::string& datasetName) = 0;
896 virtual bool indexExists(
const std::string& datasetName,
const std::string& name) = 0;
910 virtual void addIndex(
const std::string& datasetName,
Index* idx,
911 const std::map<std::string, std::string>& options) = 0;
923 virtual void dropIndex(
const std::string& datasetName,
const std::string& idxName) = 0;
936 virtual std::auto_ptr<Sequence> getSequence(
const std::string& name) = 0;
950 virtual std::vector<std::string> getSequenceNames() = 0;
963 virtual bool sequenceExists(
const std::string& name) = 0;
973 virtual void addSequence(
Sequence* sequence) = 0;
984 virtual void dropSequence(
const std::string& name) = 0;
998 virtual std::auto_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
999 const std::string& propertyName) = 0;
1013 virtual std::auto_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
1014 std::size_t propertyPos) = 0;
1027 virtual std::size_t getNumberOfItems(
const std::string& datasetName) = 0;
1038 virtual bool hasDataSets() = 0;
1051 virtual bool dataSetExists(
const std::string& name) = 0;
1082 virtual void createDataSet(
DataSetType* dt,
const std::map<std::string, std::string>& options) = 0;
1094 virtual void cloneDataSet(
const std::string& name,
1095 const std::string& cloneName,
1096 const std::map<std::string, std::string>& options) = 0;
1107 virtual void dropDataSet(
const std::string& name) = 0;
1119 virtual void renameDataSet(
const std::string& name,
const std::string& newName) = 0;
1143 virtual void add(
const std::string& datasetName,
1145 const std::map<std::string, std::string>& options,
1146 std::size_t limit = 0) = 0;
1161 virtual void remove(
const std::string& datasetName,
const ObjectIdSet* oids = 0) = 0;
1181 virtual void update(
const std::string& datasetName,
1183 const std::vector<std::size_t>& properties,
1185 const std::map<std::string, std::string>& options,
1186 std::size_t limit = 0) = 0;
1203 virtual void optimize(
const std::map<std::string, std::string>& opInfo) = 0;
1212 #endif // __TERRALIB_DATAACCESS_INTERNAL_DATASOURCETRANSACTOR_H
boost::shared_ptr< DataSourceTransactor > DataSourceTransactorPtr
It describes an index associated to a DataSetType.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
A Select models a query to be used when retrieving data from a DataSource.
It describes a primary key (pk) constraint.
It describes a sequence (a number generator).
SpatialRelation
Spatial relations between geometric objects.
It models a foreign key constraint for a DataSetType.
AccessPolicy
Supported data access policies (can be used as bitfield).
A class that models an object that submits commands in batch to the data source.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
A class that models a prepared query.
A Query is independent from the data source language/dialect.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
It describes a unique key (uk) constraint.
TraverseType
A dataset can be traversed in two ways:
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
A class that models the description of a dataset.
It models a property definition.
A class that describes a check constraint.
An Envelope defines a 2D rectangular region.
A dataset is the unit of information manipulated by the data access module of TerraLib.
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...