27 #include "../common/ByteSwapUtils.h" 28 #include "../common/Exception.h" 29 #include "../common/Globals.h" 30 #include "../common/StringUtils.h" 31 #include "../core/translator/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();
209 long p =
static_cast<long>(i-
m_i);
246 vtIndex.lVal = (long)i;
252 ival = (char)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
264 return (
unsigned char)
getChar(i);
271 vtIndex.lVal = (long)i;
277 ival = (int16_t)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
291 vtIndex.lVal = (long)i;
297 ival = (int32_t)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
311 vtIndex.lVal = (long)i;
317 ival = (int64_t)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
331 vtIndex.lVal = (long)i;
337 ival = (
bool)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
353 vtIndex.lVal = (long)i;
357 value = (float)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
373 vtIndex.lVal = (long)i;
377 value = (double)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
396 vtIndex.lVal = (long)i;
402 ival = (LPCSTR)(_bstr_t)
m_result->GetFields()->GetItem(vtIndex)->GetValue();
416 vtIndex.lVal = (long)i;
429 else if(
m_result->MovePrevious() == S_OK)
433 _RecordsetPtr copy =
m_result->Clone(adLockReadOnly);
435 field = copy->GetFields()->GetItem(vtIndex);
438 field =
m_result->GetFields()->GetItem(vtIndex);
440 size = field->ActualSize;
443 VariantInit(&varBLOB);
445 varBLOB = field->GetChunk(size);
447 if(varBLOB.vt == (VT_ARRAY | VT_UI1))
449 SafeArrayAccessData(varBLOB.parray,(
void **)&cdata);
450 data =
new char[
size];
451 memcpy(data, cdata, size);
452 SafeArrayUnaccessData(varBLOB.parray);
470 std::size_t wkb_size = geom->getWkbSize();
472 if(ba->bytesUsed() - wkb_size >= 4)
473 geom->setSRID(*((
int*)(ba->getData() + wkb_size)));
489 vtIndex.lVal = (long)i;
494 value =
m_result->GetFields()->GetItem(vtIndex)->Value;
501 if(value.vt == VT_NULL)
502 return std::unique_ptr<te::dt::DateTime>();
504 strDate = (LPCSTR)(_bstr_t)value;
532 value =
m_result->GetFields()->GetItem(static_cast<long>(i))->GetValue();
540 if(value.vt == VT_NULL)
The transactor class for the Microsoft Access driver.
std::unique_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
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.
std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
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.
Utility functions for ADO.
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.
std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
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.
std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
bool isPositionValid() const
It tells if the dataset internal pointer is on a valid position.
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:
std::unique_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.
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.
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...
Implementation of the data source class for the ADO driver.
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).
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 ...
std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
Transactor * m_t
The DataSet Transactor.
std::size_t getNumProperties() const
It returns the number of properties that composes an item 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.
DataSourceTransactor class implementation for Microsoft Access driver.
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::unique_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
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.
int m_i
The index of the current row.
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.