27 #include "../common/ByteSwapUtils.h" 
   28 #include "../common/Exception.h" 
   29 #include "../common/Globals.h" 
   30 #include "../common/StringUtils.h" 
   31 #include "../common/Translator.h" 
   32 #include "../dataaccess/dataset/DataSetType.h" 
   33 #include "../datatype/Array.h" 
   34 #include "../datatype/ByteArray.h" 
   35 #include "../datatype/DateTimeProperty.h" 
   36 #include "../datatype/SimpleData.h" 
   37 #include "../datatype/TimeInstant.h" 
   38 #include "../geometry/Envelope.h" 
   39 #include "../geometry/Geometry.h" 
   40 #include "../geometry/WKBReader.h" 
   52 #include <boost/dynamic_bitset.hpp> 
   53 #include <boost/lexical_cast.hpp> 
   57   if( FAILED(hr) ) _com_issue_error( hr );
 
   72   FieldsPtr fields = 
m_result->GetFields();
 
   74   for(
int i = 0; i != 
m_ncols; ++i)
 
   76     FieldPtr field = fields->GetItem((
long)i);
 
   78     std::string columnName = field->GetName();
 
   87       std::string tableName = (LPCSTR)(_bstr_t)field->GetProperties()->GetItem(
"BASETABLENAME")->GetValue();
 
  130   return m_datatypes[i];
 
  135   return m_colNames[i];
 
  150   return (m_size == 0);
 
  166     TESTHR(m_result->MoveNext());
 
  169   bool teste = (m_i < m_size);
 
  170   return (m_i < m_size);
 
  176     m_result->MovePrevious();
 
  184   if(m_result->BOF != 0)
 
  187   TESTHR(m_result->MoveFirst());
 
  195   m_result->MoveFirst();
 
  202   TESTHR(m_result->MoveLast());
 
  204   return (m_i < m_size);
 
  215   long p = 
static_cast<long>(i-m_i);
 
  217   TESTHR(m_result->Move(p));
 
  220   return (m_i < m_size);
 
  235   return m_i == (m_size - 1);
 
  240   return m_i >= m_size;
 
  253     ival = (char)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  265   return (
unsigned char)getChar(i);
 
  278     ival = (int16_t)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  298     ival = (int32_t)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  318     ival = (int64_t)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  338     ival = (bool)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  358     value = (float)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  378     value = (double)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  403     ival = (LPCSTR)(_bstr_t)m_result->GetFields()->GetItem(vtIndex)->GetValue();
 
  428     if(m_result->MoveNext() == S_OK)
 
  429       m_result->MovePrevious();
 
  430     else if(m_result->MovePrevious() == S_OK)
 
  431       m_result->MoveNext();
 
  434       _RecordsetPtr copy = m_result->Clone(adLockReadOnly);
 
  436       field = copy->GetFields()->GetItem(vtIndex);
 
  439     field = m_result->GetFields()->GetItem(vtIndex);
 
  441     size = field->ActualSize;
 
  444       VariantInit(&varBLOB);
 
  446       varBLOB = field->GetChunk(size);
 
  448       if(varBLOB.vt == (VT_ARRAY | VT_UI1))
 
  450         SafeArrayAccessData(varBLOB.parray,(
void **)&cdata);
 
  451         data = 
new char[size];
 
  452         memcpy(data, cdata, size);
 
  453         SafeArrayUnaccessData(varBLOB.parray);
 
  467   std::auto_ptr<te::dt::ByteArray> ba(getByteArray(i));
 
  471   std::size_t wkb_size = geom->getWkbSize();
 
  473   if(ba->bytesUsed() - wkb_size >= 4)
 
  474     geom->setSRID(*((
int*)(ba->getData() + wkb_size)));
 
  497     value = m_result->GetFields()->GetItem(vtIndex)->Value;
 
  504   if(value.vt == VT_NULL)
 
  505     return std::auto_ptr<te::dt::DateTime>(0);
 
  507   strDate = (LPCSTR)(_bstr_t)value;
 
  531   std::string propertyName = getPropertyName(i);
 
  535     value = m_result->GetFields()->GetItem(static_cast<long>(i))->GetValue();
 
  543   if(value.vt == VT_NULL)
 
The transactor class for the Microsoft Access driver. 
 
DataSet class implementation for Microsoft Access driver. 
 
bool moveNext()
It moves the internal pointer to the next item of the collection. 
 
int m_ncols
The number of properties in the collection. 
 
CharEncoding
Supported charsets (character encoding). 
 
te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const 
It returns the property character encoding at position pos. 
 
bool moveFirst()
It moves the internal pointer to the first item in the collection. 
 
int Convert2Terralib(ADOX::DataTypeEnum adoType)
Bind ADOX Type to TerraLib Type. 
 
bool move(std::size_t i)
It moves the dataset internal pointer to a given position. 
 
DataSet()
Default constructor. 
 
double getDouble(std::size_t i) const 
Method for retrieving a double attribute value. 
 
bool movePrevious()
It moves the internal pointer to the previous item of the collection. 
 
std::vector< int > m_datatypes
A vector of data types. 
 
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection. 
 
float getFloat(std::size_t i) const 
Method for retrieving a float attribute value. 
 
std::string GetSystemDateTimeFormat(std::string &indAM, std::string &indPM, std::string &sepD, std::string &sepT)
It gets the system Date and Time format. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
bool isAfterEnd() const 
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
 
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const 
Method for retrieving an array. 
 
std::size_t size() const 
It returns the collection size, if it is known. 
 
boost::int16_t getInt16(std::size_t i) const 
Method for retrieving a 16-bit integer attribute value (2 bytes long). 
 
int m_size
The number of datasets in the collection. 
 
AccessPolicy
Supported data access policies (can be used as bitfield). 
 
TraverseType
A dataset can be traversed in two ways: 
 
bool getBool(std::size_t i) const 
Method for retrieving a boolean attribute value. 
 
bool isEmpty() const 
It returns true if the collection is empty. 
 
std::vector< std::string > m_colNames
A vector of columns names. 
 
~DataSet()
The destructor will clear the internal ADO _RecordsetPtr. 
 
std::string getNumeric(std::size_t i) const 
Method for retrieving a numeric attribute value. 
 
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const 
Method for retrieving a date and time attribute value. 
 
int getPropertyDataType(std::size_t i) const 
It returns the underlying data type of the property at position pos. 
 
unsigned char getUChar(std::size_t i) const 
Method for retrieving an unsigned character attribute value (1 byte long). 
 
bool isConnected() const 
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
 
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const 
Method for retrieving a raster attribute value. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
char getChar(std::size_t i) const 
Method for retrieving a signed character attribute value (1 byte long). 
 
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const 
Method for retrieving a byte array. 
 
Implementation of the data source class for the ADO driver. 
 
DataSourceTransactor class implementation for Microsoft Access driver. 
 
DataSource * getAdoDataSource() const 
 
te::common::TraverseType getTraverseType() const 
It returns the traverse type associated to the dataset. 
 
bool isGeometryColumn(const std::string &datasetName, const std::string &colName) const 
 
bool moveLast()
It sets the dataset internal pointer to the last item in the collection. 
 
std::string getString(std::size_t i) const 
Method for retrieving a string value attribute. 
 
bool isBeforeBegin() const 
It tells if the dataset internal pointer is in a position before the first element of the collection ...
 
Utility functions for ADO. 
 
Transactor * m_t
The DataSet Transactor. 
 
std::size_t getNumProperties() const 
It returns the number of properties that composes an item of the dataset. 
 
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset. 
 
A class that implements a connection to a ADO database. 
 
boost::int64_t getInt64(std::size_t i) const 
Method for retrieving a 64-bit integer attribute value (8 bytes long). 
 
_RecordsetPtr m_result
The internal buffer with the result query. 
 
std::string getDatasetNameOfProperty(std::size_t i) const 
It returns the underlying dataset name of the property at position pos. 
 
bool isNull(std::size_t i) const 
It checks if the attribute value is NULL. 
 
te::common::AccessPolicy getAccessPolicy() const 
It returns the read and write permission associated to the dataset. 
 
boost::int32_t getInt32(std::size_t i) const 
Method for retrieving a 32-bit integer attribute value (4 bytes long). 
 
bool isAtBegin() const 
It tells if the dataset internal pointer is on the first element of the collection or not...
 
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const 
Method for retrieving a geometric attribute value. 
 
std::auto_ptr< te::dt::DateTime > GetDateTime(std::string &value, std::string &mask, std::string &sepD, std::string &sepT)
It gets the DateTime TerraLib 5 from string. 
 
std::string getPropertyName(std::size_t i) const 
It returns the property name at position pos. 
 
A class for representing binary data. 
 
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB. 
 
bool isAtEnd() const 
It tells if the dataset internal pointer is on the last element of the collection.