26 #ifndef __TERRALIB_POSTGIS_INTERNAL_TRANSACTOR_H 27 #define __TERRALIB_POSTGIS_INTERNAL_TRANSACTOR_H 30 #include "../dataaccess/datasource/DataSourceTransactor.h" 42 namespace dt {
class Property; }
43 namespace gm {
class Envelope;
class Geometry; }
54 class ScopedConnection;
87 Connection* getConnection(
const int&
id = -1)
const;
96 int getConnectionID()
const;
104 bool isInTransaction()
const;
106 std::unique_ptr<te::da::DataSet> getDataSet(
const std::string& name,
108 bool isConnected =
false,
111 std::unique_ptr<te::da::DataSet> getDataSet(
const std::string& name,
112 const std::string& propertyName,
116 bool isConnected =
false,
119 std::unique_ptr<te::da::DataSet> getDataSet(
const std::string& name,
120 const std::string& propertyName,
124 bool isConnected =
false,
129 bool connected =
false,
133 std::unique_ptr<te::da::DataSet> query(
const std::string& query,
135 bool connected =
false,
140 void execute(
const std::string& command);
142 std::unique_ptr<te::da::PreparedQuery> getPrepared(
const std::string& qName = std::string(
""));
144 std::unique_ptr<te::da::BatchExecutor> getBatchExecutor();
148 boost::int64_t getLastGeneratedId();
150 std::string escape(
const std::string& value);
152 std::vector<std::string> getDataSetNames();
154 std::size_t getNumberOfDataSets();
156 std::unique_ptr<te::da::DataSetType> getDataSetType(
const std::string& name);
158 boost::ptr_vector<te::dt::Property> getProperties(
const std::string& datasetName);
160 std::unique_ptr<te::dt::Property> getProperty(
const std::string& datasetName,
const std::string& name);
162 std::unique_ptr<te::dt::Property> getProperty(
const std::string& datasetName, std::size_t propertyPos);
164 std::vector<std::string> getPropertyNames(
const std::string& datasetName);
166 std::size_t getNumberOfProperties(
const std::string& datasetName);
168 bool propertyExists(
const std::string& datasetName,
const std::string& name);
172 void dropProperty(
const std::string& datasetName,
const std::string& name);
174 void renameProperty(
const std::string& datasetName,
175 const std::string& propertyName,
176 const std::string& newPropertyName);
179 void changePropertyDefinition(
const std::string& datasetName,
const std::string& propName,
te::dt::Property* newProp);
184 std::unique_ptr<te::da::PrimaryKey> getPrimaryKey(
const std::string& datasetName);
186 bool primaryKeyExists(
const std::string& datasetName,
const std::string& name);
190 void dropPrimaryKey(
const std::string& datasetName);
192 std::unique_ptr<te::da::ForeignKey> getForeignKey(
const std::string& datasetName,
const std::string& name);
194 std::vector<std::string> getForeignKeyNames(
const std::string& datasetName);
196 bool foreignKeyExists(
const std::string& datasetName,
const std::string& name);
200 void dropForeignKey(
const std::string& datasetName,
const std::string& fkName);
202 std::unique_ptr<te::da::UniqueKey> getUniqueKey(
const std::string& datasetName,
const std::string& name);
204 std::vector<std::string> getUniqueKeyNames(
const std::string& datasetName);
206 bool uniqueKeyExists(
const std::string& datasetName,
const std::string& name);
210 void dropUniqueKey(
const std::string& datasetName,
const std::string& name);
212 std::unique_ptr<te::da::CheckConstraint> getCheckConstraint(
const std::string& datasetName,
const std::string& name);
214 std::vector<std::string> getCheckConstraintNames(
const std::string& datasetName);
216 bool checkConstraintExists(
const std::string& datasetName,
const std::string& name);
220 void dropCheckConstraint(
const std::string& datasetName,
const std::string& name);
222 std::unique_ptr<te::da::Index> getIndex(
const std::string& datasetName,
const std::string& name);
224 std::vector<std::string> getIndexNames(
const std::string& datasetName);
226 bool indexExists(
const std::string& datasetName,
const std::string& name);
228 void addIndex(
const std::string& datasetName,
te::da::Index* idx,
229 const std::map<std::string, std::string>& options);
231 void dropIndex(
const std::string& datasetName,
const std::string& idxName);
233 std::unique_ptr<te::da::Sequence> getSequence(
const std::string& name);
235 std::vector<std::string> getSequenceNames();
237 bool sequenceExists(
const std::string& name);
241 void dropSequence(
const std::string& name);
243 std::unique_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
244 const std::string& propertyName);
246 std::unique_ptr<te::gm::Envelope> getExtent(
const std::string& datasetName,
247 std::size_t propertyPos);
249 std::size_t getNumberOfItems(
const std::string& datasetName);
253 bool dataSetExists(
const std::string& name);
255 void createDataSet(
te::da::DataSetType* dt,
const std::map<std::string, std::string>& options);
257 void cloneDataSet(
const std::string& name,
258 const std::string& cloneName,
259 const std::map<std::string, std::string>& options);
261 void dropDataSet(
const std::string& name);
263 void renameDataSet(
const std::string& name,
const std::string& newName);
265 void add(
const std::string& datasetName,
267 const std::map<std::string, std::string>& options,
268 std::size_t limit = 0,
269 bool enableProgress =
true);
273 void update(
const std::string& datasetName,
275 const std::vector<std::size_t>& properties,
277 const std::map<std::string, std::string>& options,
278 std::size_t limit = 0);
280 void update(
const std::string& datasetName,
282 const std::vector< std::set<int> >& properties,
283 const std::vector<size_t>& ids);
285 void optimize(
const std::map<std::string, std::string>& opInfo);
296 unsigned int getGeomTypeId();
307 unsigned int getRasterTypeId();
318 void getDatabaseInfo(std::string& currentSchema);
347 std::string getFullName(
const std::string& name);
360 unsigned int getDataSetId(
const std::string& datasetName);
373 std::string getDataSetName(
unsigned int id);
398 std::unique_ptr<te::da::DataSet> getPropertiesInfo(
const std::string& datasetName);
421 std::unique_ptr<te::dt::Property> getProperty(
unsigned int pid,
const std::string& datasetName);
448 std::unique_ptr<te::da::DataSet> getConstraints(
const std::string& datasetName,
char conType =
'\0');
477 std::vector<te::da::Sequence*> getSequences();
493 #endif // __TERRALIB_POSTGIS_INTERNAL_TRANSACTOR_H
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
A class that models the description of a dataset.
SpatialRelation
Spatial relations between geometric objects.
It describes a sequence (a number generator).
A class that implements a connection to a PostgreSQL database.
A class that describes a check constraint.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
int m_connectionId
The connection id used by this transactor.
bool m_getConstraints
Flag that defines if the method getConstraints must be called.
It models a property definition.
#define TEPGISEXPORT
You can use this macro in order to export/import classes and functions from this module.
The transactor class for the PostGIS driver.
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.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Configuration flags for the PostGIS Driver Implementation of TerraLib.
It models a foreign key constraint for a DataSetType.
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.
Implementation of the data source for the PostGIS driver.
int m_transactionCount
Counter used to control the number of begin transaction called.
boost::shared_ptr< Transactor > TransactorPtr
A dataset is the unit of information manipulated by the data access module of TerraLib.
It describes a primary key (pk) constraint.
const int m_fetchSize
The size of cursor fetch.
A Query is independent from the data source language/dialect.
It describes an index associated to a DataSetType.
DataSource * m_ds
The PostGIS data source associated to this transactor.