27 #include "../common/ByteSwapUtils.h"
28 #include "../common/Globals.h"
29 #include "../common/StringUtils.h"
30 #include "../common/Translator.h"
31 #include "../dataaccess/dataset/DataSetType.h"
32 #include "../datatype/Array.h"
33 #include "../datatype/ByteArray.h"
34 #include "../datatype/DateTimeInstant.h"
35 #include "../datatype/DateTimeProperty.h"
36 #include "../datatype/SimpleData.h"
37 #include "../datatype/TimeInstant.h"
38 #include "../memory/DataSet.h"
39 #include "../memory/DataSetItem.h"
40 #include "../geometry/Envelope.h"
41 #include "../geometry/Geometry.h"
42 #include "../geometry/GeometryProperty.h"
43 #include "../geometry/WKBReader.h"
51 #include <terralib4/kernel/TeAttribute.h>
52 #include <terralib4/kernel/TeDatabase.h>
53 #include <terralib4/kernel/TeLayer.h>
60 #include <boost/lexical_cast.hpp>
76 for(
int i = 0; i !=
m_nCols; ++i)
78 TeAttributeList attrList = table.attributeList();
79 TeAttribute attr = attrList[i];
88 TeDatabasePortal* portal =
m_db->getPortal();
89 portal->query(
"SELECT * FROM " +
m_table.name());
91 m_size = portal->numRows();
93 while(portal->fetchRow())
97 for(
int i = 0; i !=
m_nCols; ++i)
99 int pType =
m_table.attributeList()[i].rep_.type_;
108 item->
setDouble(i, portal->getDouble(i));
112 item->
setInt32(i, portal->getInt(i));
117 TeTime date = portal->getDate(i);
120 int m = date.month();
123 int min = date.minute();
124 int s = date.second();
132 dateTime =
new te::dt::Date((
unsigned short)y, (
unsigned short)m, (
unsigned short)d);
159 item->
setChar(i, (
char)portal->getData(i));
163 item->
setInt32(i, portal->getInt(i));
167 item->
setBool(i, portal->getBool(i));
210 return m_dt->getProperty(i)->getType();
231 return !(size() > 0);
246 return m_data->moveNext();
306 return m_data->getInt16(i);
311 return m_data->getInt32(i);
316 return m_data->getInt64(i);
321 return m_portal->getBool(i);
326 return m_data->getFloat(i);
331 return m_data->getDouble(i);
336 return m_data->getNumeric(i);
341 return m_data->getString(i);
373 return std::auto_ptr<te::dt::Array>(0);
380 std::string val = m_portal->getData(i);
Property * getProperty(std::size_t i) const
It returns the i-th property.
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
te::da::DataSetType * m_dt
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
CharEncoding
Supported charsets (character encoding).
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not...
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
A class that models the description of a dataset.
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
Implements the DataSource class for the TerraLib 4.x Data Access Driver.
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
void setChar(std::size_t i, char value)
It sets the value of the i-th property.
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
It models a property definition.
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
A class to represent time instant.
std::auto_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
bool isEmpty() const
It returns true if the collection is empty.
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
A base class for date data types.
void setDateTime(std::size_t i, te::dt::DateTime *value)
It sets the value of the i-th property.
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
std::string getPropertyName(std::size_t i) const
It returns the property name at position pos.
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
bool moveNext()
It moves the internal pointer to the next item of the collection.
void add(Constraint *c)
It adds a new constraint.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
void setByteArray(std::size_t i, te::dt::ByteArray *value)
It sets the value of the i-th property.
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
A class to represent time duration with nano-second/micro-second resolution.
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
int getPropertyDataType(std::size_t i) const
It returns the underlying data type of the property at position pos.
void setBool(std::size_t i, bool value)
It sets the value of the i-th property.
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const
It returns the property character encoding at position pos.
DateTimeType
The subtype of date and time type, based on ISO 8621.
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
An utility class for converting a TerraLib 4.x geometry to a TerraLib 5.
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
Utilitary functions for dealing with TerraLib 5 and 4.x conversion.
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
TableDataSet(TeDatabase *db, TeTable table)
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
std::string getDatasetNameOfProperty(std::size_t i) const
It returns the underlying dataset name of the property at position pos.
bool moveFirst()
It moves the internal pointer to the first item in the collection.
A class for representing binary data.
std::size_t size() const
It returns the collection size, if it is known.
const std::string & getName() const
It returns the property name.
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.