42 #include <boost/test/unit_test.hpp> 46 std::unique_ptr<te::da::DataSet> dataSet;
55 std::string name =
"munic_goias";
57 std::unique_ptr<te::da::DataSourceTransactor> transactor = ds->
getTransactor();
64 catch(
const std::exception& e)
66 std::cout << std::endl
67 <<
"An exception has occurred in the PostGIS Example: " 68 << e.what() << std::endl;
72 std::cout << std::endl
73 <<
"An unexpected exception has occurred in the PostGIS Example!" 88 dataSet->moveBeforeFirst();
89 BOOST_CHECK(dataSet->isBeforeBegin());
98 BOOST_CHECK(dataSet->isAtBegin());
100 int id = dataSet->getInt32(0);
101 std::cout << std::endl
102 <<
"First ID = " << boost::lexical_cast<std::string>(id)
112 BOOST_CHECK(dataSet->isAtEnd());
114 int id = dataSet->getInt32(0);
115 std::cout << std::endl
116 <<
"Last ID = " << boost::lexical_cast<std::string>(id)
126 int id = dataSet->getInt32(0);
127 std::cout << std::endl
128 <<
"ID = " << boost::lexical_cast<std::string>(id)
133 std::cout << std::endl
138 if(dataSet->move(20))
140 int id = dataSet->getInt32(0);
141 std::cout << std::endl
142 <<
"ID = " << boost::lexical_cast<std::string>(id)
147 std::cout << std::endl
152 if(dataSet->move(5000))
154 int id = dataSet->getInt32(0);
155 std::cout << std::endl
156 <<
"ID = " << boost::lexical_cast<std::string>(id)
161 std::cout << std::endl
171 dataSet->moveBeforeFirst();
173 BOOST_CHECK(dataSet->isBeforeBegin());
175 while(dataSet->moveNext())
177 int id = dataSet->getInt32(0);
178 std::cout << std::endl
179 <<
"Current ID = " << boost::lexical_cast<std::string>(id)
190 BOOST_CHECK(dataSet->isAtEnd());
194 int id = dataSet->getInt32(0);
195 std::cout << std::endl
196 <<
"Current ID = " << boost::lexical_cast<std::string>(id)
198 }
while(dataSet->movePrevious());
201 BOOST_AUTO_TEST_SUITE_END()
This file contains include headers for the Data Type module of TerraLib.
virtual std::unique_ptr< DataSourceTransactor > getTransactor()=0
It returns the set of parameters used to set up the access channel to the underlying repository...
virtual void open()=0
It opens the data source and makes it ready for using.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
static te::dt::Date ds(2010, 01, 01)
std::unique_ptr< te::da::DataSource > GetPostGISConnection()
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
A class that informs what the dataset implementation of a given data source can perform.
A Transactor can be viewed as a connection to the data source for reading/writing things into it...
std::unique_ptr< te::da::DataSet > GetConnectedDataSet(te::da::DataSource *ds)
virtual const DataSourceCapabilities & getCapabilities() const =0
It returns the known capabilities of the data source.
BOOST_AUTO_TEST_SUITE(connectedDataSet_tests) BOOST_AUTO_TEST_CASE(moveBeforeFirst_test)
A factory for data sources.
Utility functions for the data access module.
A dataset is the unit of information manipulated by the data access module of TerraLib.
const DataSetCapabilities & getDataSetCapabilities() const
BOOST_AUTO_TEST_CASE(moveFirst_test)