21 #include "../../../../core/translator/Translator.h" 22 #include "../../../../dataaccess/dataset/ObjectId.h" 23 #include "../../../../dataaccess/dataset/ObjectIdSet.h" 24 #include "../../../../dataaccess/query/DataSetName.h" 25 #include "../../../../dataaccess/query/Query.h" 26 #include "../../../../dataaccess/query/Select.h" 27 #include "../../../../dataaccess/utils/Utils.h" 28 #include "../../../../datatype/ByteArray.h" 29 #include "../../../../datatype/Date.h" 30 #include "../../../../datatype/TimeInstant.h" 31 #include "../../../../geometry/Envelope.h" 32 #include "../../../../geometry/GeometryProperty.h" 33 #include "../../../../srs/SpatialReferenceSystemManager.h" 34 #include "../../../../srs/Config.h" 42 #include <ogrsf_frmts.h> 120 return std::auto_ptr<te::da::DataSet>();
122 GDALDataset *poDS = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_READONLY | GDAL_OF_VECTOR, NULL, NULL, NULL);
124 std::string sql =
"SELECT FID, * FROM \"" + name +
"\"";
125 OGRLayer* l = poDS->ExecuteSQL(sql.c_str(), 0, 0);
128 throw Exception(
TE_TR(
"The informed data set could not be found in the data source."));
130 return std::auto_ptr<te::da::DataSet>(
new DataSet(poDS, l));
142 return std::auto_ptr<te::da::DataSet>();
144 GDALDataset *
ds = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_READONLY | GDAL_OF_VECTOR, NULL, NULL, NULL);
147 return std::auto_ptr<te::da::DataSet>();
149 std::string sql =
"SELECT FID, * FROM \"" + name +
"\"";
150 OGRLayer* layer = ds->ExecuteSQL(sql.c_str(), 0, 0);
153 throw Exception(
TE_TR(
"The informed data set could not be found in the data source."));
157 return std::auto_ptr<te::da::DataSet>(
new DataSet(ds, layer));
169 return std::auto_ptr<te::da::DataSet>();
171 GDALDataset *
ds = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_READONLY | GDAL_OF_VECTOR, NULL, NULL, NULL);
174 return std::auto_ptr<te::da::DataSet>();
176 std::string sql =
"SELECT FID, * FROM \"" + name +
"\"";
177 OGRLayer* layer = ds->ExecuteSQL(sql.c_str(), 0, 0);
180 throw Exception(
TE_TR(
"The informed data set could not be found in the data source."));
184 layer->SetSpatialFilter(ogrg);
186 OGRGeometryFactory::destroyGeometry(ogrg);
188 return std::auto_ptr<te::da::DataSet>(
new DataSet(ds, layer));
197 return std::auto_ptr<te::da::DataSet>();
199 GDALDataset*
ds = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_UPDATE, NULL, NULL, NULL);
209 OGRLayer* layer = ds->ExecuteSQL(sql.c_str(), 0, 0);
212 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
219 return std::auto_ptr<te::da::DataSet>(
new DataSet(ds, layer));
228 return std::auto_ptr<te::da::DataSet>();
231 GDALDataset*
ds = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_UPDATE, NULL, NULL, NULL);
234 std::string queryCopy =
query;
235 std::size_t pos = queryCopy.find(
"*");
236 if(pos != std::string::npos)
238 std::string fid =
"FID, *";
239 queryCopy.replace(pos, 1, fid);
242 OGRLayer* layer = ds->ExecuteSQL(queryCopy.c_str(), 0, 0);
245 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
247 return std::auto_ptr<te::da::DataSet>(
new DataSet(ds, layer));
273 return std::auto_ptr<te::da::PreparedQuery>(0);
278 return std::auto_ptr<te::da::BatchExecutor>(0);
297 std::vector<std::string> names;
319 return std::auto_ptr<te::da::DataSetType>();
321 GDALDataset *poDS = (GDALDataset*)GDALOpenEx(
m_ogrDs->
getOGRDataSource()->GetDescription(), GDAL_OF_READONLY | GDAL_OF_VECTOR, NULL, NULL, NULL);
323 std::string sql(
"SELECT FID, * FROM \"");
329 return std::auto_ptr<te::da::DataSetType>();
331 const char* colIdName = l->GetFIDColumn();
333 if (colIdName == 0 || colIdName[0] ==
'\0')
336 int pos = l->GetLayerDefn()->GetFieldIndex(colIdName);
338 std::auto_ptr<te::da::DataSetType> type(
Convert2TerraLib(l->GetLayerDefn()));
345 pk->
add(type->getProperty(pos));
368 cap->setSupportAddColumn((l->TestCapability(OLCCreateField) == 0) ?
false :
true);
369 cap->setSupportRemoveColumn((l->TestCapability(OLCDeleteField) == 0) ?
false :
true);
370 cap->setSupportDataEdition((l->TestCapability(OLCRandomWrite) == 0) ?
false :
true);
378 boost::ptr_vector<te::dt::Property> ps;
383 std::string sql(
"SELECT FID, * FROM \"");
384 sql += datasetName +
"\"";
392 std::vector<te::dt::Property*> props = dt->getProperties();
393 std::vector<te::dt::Property*>::iterator it;
395 for(it=props.begin(); it!=props.end(); ++it)
396 ps.push_back((*it)->clone());
407 return std::auto_ptr<te::dt::Property>();
410 std::string sql(
"SELECT FID, * FROM \"");
411 sql += datasetName +
"\"";
416 idx = l->GetLayerDefn()->GetFieldIndex(name.c_str());
428 return std::auto_ptr<te::dt::Property>();
430 std::auto_ptr<te::dt::Property> res;
431 std::string sql(
"SELECT FID, * FROM \"");
432 sql += datasetName +
"\"";
434 OGRLayer* l = ogrds->ExecuteSQL(sql.c_str(), 0, 0);
438 OGRFeatureDefn* def = l->GetLayerDefn();
439 OGRFieldDefn* fdef = def->GetFieldDefn(propertyPos);
455 return std::vector<std::string>();
457 std::vector<std::string> res;
458 std::string sql(
"SELECT FID, * FROM \"");
459 sql += datasetName +
"\"";
461 OGRLayer* l = ogrds->ExecuteSQL(sql.c_str(), 0, 0);
465 OGRFeatureDefn* def = l->GetLayerDefn();
467 for(
int i=0; i<def->GetFieldCount(); i++)
468 res.push_back(def->GetFieldDefn(i)->GetNameRef());
471 ogrds->ReleaseResultSet(l);
483 std::string sql(
"SELECT FID, * FROM \"");
484 sql += datasetName +
"\"";
486 OGRLayer* l = ogrds->ExecuteSQL(sql.c_str(), 0, 0);
492 res = l->GetLayerDefn()->GetFieldCount();
493 ogrds->ReleaseResultSet(l);
506 std::string sql(
"SELECT FID, * FROM \"");
507 sql += datasetName +
"\"";
510 OGRLayer* l = ogrds->ExecuteSQL(sql.c_str(), 0, 0);
514 res = (l->GetLayerDefn()->GetFieldIndex(name.c_str()) != -1);
515 ogrds->ReleaseResultSet(l);
536 OGRErr error = l->CreateField(nField);
540 if(error != OGRERR_NONE)
543 error = l->SyncToDisk();
545 if(error != OGRERR_NONE)
557 if(!l->TestCapability(OLCDeleteField))
558 throw Exception(
TE_TR(
"This dataset do not support remove properties operation."));
560 int fPos = l->GetLayerDefn()->GetFieldIndex(name.c_str());
565 OGRErr error = l->DeleteField(fPos);
567 if(error != OGRERR_NONE)
568 throw Exception(
TE_TR(
"Error when attempting remove the property."));
570 error = l->SyncToDisk();
572 if(error != OGRERR_NONE)
578 const std::string& propertyName,
579 const std::string& newPropertyName)
588 int idx = l->GetLayerDefn()->GetFieldIndex(propertyName.c_str());
593 OGRFieldDefn* df = l->GetLayerDefn()->GetFieldDefn(idx);
595 OGRFieldDefn* dfn =
new OGRFieldDefn(df);
597 dfn->SetName(newPropertyName.c_str());
599 OGRErr err = l->AlterFieldDefn(idx, dfn, ALTER_NAME_FLAG);
601 if(err != OGRERR_NONE)
611 std::auto_ptr<te::dt::Property>
p;
619 if(!l->TestCapability(OLCAlterFieldDefn))
620 throw Exception(
TE_TR(
"This data source do not support the operation of alter columns type."));
622 int idx = l->GetLayerDefn()->GetFieldIndex(propName.c_str());
627 OGRFieldDefn* dfn =
new OGRFieldDefn(l->GetLayerDefn()->GetFieldDefn(idx));
631 OGRErr err = l->AlterFieldDefn(idx, dfn, ALTER_TYPE_FLAG);
633 if(err != OGRERR_NONE)
639 err = l->SyncToDisk();
646 return std::auto_ptr<te::da::PrimaryKey>();
648 std::auto_ptr<te::da::PrimaryKey> res;
649 std::string sql(
"SELECT FID, * FROM \"");
650 sql += datasetName +
"\"";
656 const char* colIdName = layer->GetFIDColumn();
658 if(colIdName == 0 || colIdName[0] ==
'\0')
661 int pos = layer->GetLayerDefn()->GetFieldIndex(colIdName);
690 return std::auto_ptr<te::da::ForeignKey>();
695 return std::vector<std::string>();
713 return std::auto_ptr<te::da::UniqueKey>();
718 return std::vector<std::string>();
736 return std::auto_ptr<te::da::CheckConstraint>();
741 return std::vector<std::string>();
759 return std::auto_ptr<te::da::Index>();
764 return std::vector<std::string>();
773 const std::map<std::string, std::string>& )
783 return std::auto_ptr<te::da::Sequence>();
788 return std::vector<std::string>();
805 const std::string& propertyName)
808 return std::auto_ptr<te::gm::Envelope>();
810 std::auto_ptr<te::gm::Envelope> res;
811 std::string sql(
"SELECT ");
812 sql += propertyName +
" FROM \"";
813 sql += datasetName +
"\"";
819 std::auto_ptr<OGREnvelope> env(
new OGREnvelope);
821 if(l->GetExtent(env.get()) != OGRERR_NONE)
838 return getExtent(datasetName,
"OGR_GEOMETRY");
849 return l->GetFeatureCount();
876 throw Exception(
TE_TR(
"This driver does not support dataset creation."));
878 OGRwkbGeometryType geomType = wkbUnknown;
879 OGRSpatialReference* srs = 0;
890 char** papszOptions = 0;
894 if(it->first ==
"URI" || it->first ==
"SOURCE" || it->first ==
"DRIVER")
899 papszOptions = CSLSetNameValue(papszOptions, it->first.c_str(), it->second.c_str());
906 CSLDestroy(papszOptions);
909 throw Exception(
TE_TR(
"Error when attempting create the dataset type."));
911 dt->
setName(newLayer->GetName());
914 for(
size_t i = 0; i < dt->
size(); ++i)
919 const std::string& cloneName,
920 const std::map<std::string, std::string>& )
926 throw Exception(
TE_TR(
"This driver does not support creates a dataset."));
931 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
936 throw Exception(
TE_TR(
"Error when attempting clone the dataset."));
945 throw Exception(
TE_TR(
"This driver does not support remove a dataset."));
954 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
957 throw Exception(
TE_TR(
"Error when attempting to remove the dataset."));
966 const std::map<std::string, std::string>& options,
970 limit = std::string::npos;
978 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
986 std::size_t nProcessedRows = 0;
988 while(d->
moveNext() && (nProcessedRows != limit))
990 OGRFeature* feat = OGRFeature::CreateFeature(layer->GetLayerDefn());
992 std::size_t currfield = 0;
994 for(std::size_t i = 0; i != nproperties; ++i)
1010 feat->SetField(currfield, d->
getInt16(i));
1015 feat->SetField(currfield, d->
getInt32(i));
1020 feat->SetField(currfield, d->
getAsString(i).c_str());
1025 feat->SetField(currfield, d->
getDouble(i));
1030 feat->SetField(currfield, atof(d->
getNumeric(i).c_str()));
1036 std::auto_ptr<te::dt::ByteArray> ba(d->
getByteArray(i));
1037 feat->SetField(currfield, ba->bytesUsed(),
reinterpret_cast<unsigned char*
>(ba->getData()));
1044 std::auto_ptr<te::dt::DateTime> dtm(d->
getDateTime(i));
1050 feat->SetField(currfield,
1051 static_cast<int>(dtime->getYear()),
1052 static_cast<int>(dtime->getMonth()),
1053 static_cast<int>(dtime->getDay()));
1062 feat->SetField(currfield, 0, 0, 0,
1063 static_cast<int>(tduration->
getHours()),
1074 feat->SetField(currfield,
1075 static_cast<int>(dtime->getYear()),
1076 static_cast<int>(dtime->getMonth()),
1077 static_cast<int>(dtime->getDay()),
1078 static_cast<int>(tduration->
getHours()),
1085 throw Exception (
TE_TR(
"Unsupported date and time type by OGR."));
1091 std::auto_ptr<te::gm::Geometry> geom(d->
getGeometry(i));
1093 feat->SetGeometryDirectly(OGRgeom);
1102 if(layer->CreateFeature(feat) != OGRERR_NONE)
1104 OGRFeature::DestroyFeature(feat);
1108 m_fid = feat->GetFID();
1110 OGRFeature::DestroyFeature(feat);
1131 throw Exception(
TE_TR(
"Could not retrieve the DataSet from data source."));
1133 if(!l->TestCapability(OLCDeleteFeature))
1134 throw Exception(
TE_TR(
"Driver does not support removal of features."));
1136 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it = oids->
begin();
1140 while(it != oids->
end())
1142 std::string
id = (*it)->getValueAsString();
1144 if(l->DeleteFeature(atoi(
id.c_str())) != OGRERR_NONE)
1147 throw Exception(
TE_TR(
"Error when attempting to remove the feature."));
1163 const std::vector<std::size_t>& properties,
1165 const std::map<std::string, std::string>& ,
1171 const std::vector<size_t>& ids)
1186 size_t id_pos = ids[0];
1187 int id = dataset->
getInt32(id_pos);
1189 OGRFeature* feat = l->GetFeature(
id)->Clone();
1191 std::set<int> ls = properties[i];
1192 std::set<int>::iterator it;
1194 for(it = ls.begin(); it != ls.end(); ++it)
1197 int fpos_o = fpos - 1;
1202 feat->SetField(fpos_o, dataset->
getInt32(fpos));
1207 feat->SetField(fpos_o, dataset->
getDouble(fpos));
1211 feat->SetField(fpos_o, dataset->
getString(fpos).c_str());
1216 std::auto_ptr<te::gm::Geometry> gm = dataset->
getGeometry(fpos);
1222 l->SetFeature(feat);
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
Transactor(DataSource *ds)
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.
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.
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
Property * getProperty(std::size_t i) const
It returns the i-th property.
void DataSourceTransactor()
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value.
void rollBack()
It aborts the transaction. Any changes will be rolled-back.
A class that informs what kind of constraint and index is supported by a given data source...
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
virtual std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const =0
Method for retrieving a byte array.
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
void dropSequence(const std::string &name)
It removes the sequence from the data source.
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
bool hasGeom() const
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false...
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
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.
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command.
Base exception class for plugin module.
A class that models the description of a dataset.
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value.
long getSeconds() const
It returns the seconds of a minute - from 0 to 59.
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
std::auto_ptr< te::da::DataSet > query(const te::da::Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. A dataset can be connected or di...
bool hasDataSets()
It checks if the data source has any dataset.
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
const std::map< std::string, std::string > & getConnectionInfo() const
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.
double m_urx
Upper right corner x-coordinate.
SpatialRelation
Spatial relations between geometric objects.
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
It describes a sequence (a number generator).
virtual ReturnType accept(VisitorType &guest) const =0
It call the visit method from the guest object.
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
static te::dt::Date ds(2010, 01, 01)
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
A class that describes a check constraint.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
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.
GDALDataset * getOGRDataSource()
#define TE_TR(message)
It marks a string in order to get translated.
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
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.
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation.
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
It models a property definition.
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
A class to represent time instant.
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
EncodingType
Supported character encodings.
std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
AccessPolicy
Supported data access policies (can be used as bitfield).
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
TraverseType
A dataset can be traversed in two ways:
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source.
te::core::EncodingType getEncoding()
void setName(const std::string &name)
It sets the property name.
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
double m_llx
Lower left corner x-coordinate.
bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset.
virtual boost::int16_t getInt16(std::size_t i) const =0
Method for retrieving a 16-bit integer attribute value (2 bytes long).
int getSRID() const
It returns the spatial reference system identifier associated to this property.
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
An Envelope defines a 2D rectangular region.
A base class for date data types.
std::auto_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long).
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
static te::dt::TimeDuration dt(20, 30, 50, 11)
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.
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
std::auto_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
std::auto_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
TERRAMOBILEPLUGINSDLLEXPORT OGRGeometry * Convert2OGR(const te::gm::Geometry *teGeom)
It converts the TerraLib Geometry to OGR Geometry.
std::auto_ptr< te::da::PreparedQuery > getPrepared(const std::string &qName=std::string(""))
It creates a prepared query object that may be used for query commands (select, insert, update and delete) that are used repeatedly.
It models a foreign key constraint for a DataSetType.
virtual std::string getAsString(std::size_t i, int precision=0) const
Method for retrieving a data value as a string plain representation.
TERRAMOBILEPLUGINSDLLEXPORT std::string RemoveSpatialSql(const std::string &sql)
TERRAMOBILEPLUGINSDLLEXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry.
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema.
std::auto_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source.
void cancel()
It requests that the data source stop the processing of the current command.
void optimize(const std::map< std::string, std::string > &opInfo)
For some data access drivers, this method will perform some operations to optimize the data storage...
It describes a unique key (uk) constraint.
std::size_t size() const
It returns the number of properties of the CompositeProperty.
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0)
Utility functions for the data access module.
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.
void changePropertyDefinition(const std::string &datasetName, const std::string &propName, te::dt::Property *newProp)
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
void commit()
It commits the transaction.
double m_lly
Lower left corner y-coordinate.
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
int getType() const
It returns the property data type.
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset.
virtual std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const =0
Method for retrieving a date and time attribute value.
A dataset is the unit of information manipulated by the data access module of TerraLib.
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset.
std::auto_ptr< te::da::DataSetTypeCapabilities > getCapabilities(const std::string &name)
It gets capabilities about a data set.
std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
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.
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
double m_ury
Upper right corner y-coordinate.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const
Returns an iterator for the object ids in container.
A class to represent time duration with nano-second/micro-second resolution.
It describes a primary key (pk) constraint.
void update(const std::string &datasetName, te::da::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 isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
TERRAMOBILEPLUGINSDLLEXPORT int Convert2TerraLibProjection(OGRSpatialReference *osrs)
It converts the OGR Projection to TerraLib Projection.
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
TERRAMOBILEPLUGINSDLLEXPORT OGRSpatialReference * Convert2OGRProjection(int srid)
It converts the TerraLib Projection to OGR Projection.
void begin()
It starts a new transaction.
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset.
long getMinutes() const
It returns the minutes of a hour - from 0 to 59.
OGRFieldType GetOGRType(int te_type)
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.
virtual bool moveFirst()=0
It moves the internal pointer to the first item in the collection.
void addIndex(const std::string &datasetName, te::da::Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset.
bool isInTransaction() const
It returns true if a transaction is in progress, otherwise, it returns false.
A Query is independent from the data source language/dialect.
It describes an index associated to a DataSetType.
long getHours() const
It returns the hours of a day - from 0 to 23.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
The OGR data source provider.
te::da::DataSource * getDataSource() const
It returns the parent data source of the transactor.
const std::string & getName() const
It returns the property name.
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.