I read the Poco::Data User Manual and there is mentioned that the library has support for multiple result sets. There is example for this support in Multiple Data Sets section of the manual.
typedef Tuple<std::string, std::string, std::string, int> Person; Person pHomer, pLisa; int aHomer(42), aLisa(10), aBart(0); session << "SELECT * FROM Person WHERE Age = ?; " "SELECT Age FROM Person WHERE FirstName = 'Bart'; " "SELECT * FROM Person WHERE Age = ?", into(pHomer, 0), use(aHomer), into(aBart, 1), into(pLisa, 2), use(aLisa), now;
But this example in only for one of the supported ways for fetching data with the library. There is second way for fetching data in the RecordSets, Iterators and Rows section.
Statement select(session); // we need a Statement for later RecordSet creation select << "SELECT * FROM Person", now; // create a RecordSet RecordSet rs(select); std::size_t cols = rs.columnCount(); // print all column names for (std::size_t col = 0; col < cols; ++col) std::cout << rs.columnName(col) << std::endl; // iterate over all rows and columns for (RecordSet::Iterator it = rs.begin(); it != rs.end(); ++it) std::cout << *it << " ";
I have a wrapper around Poco::Data which uses the second way for fetching data and I have to extend it to support multiple result sets. I wonder is it possible and how to fetch multiple result sets with RecordSet interface?
The multiple result sets are result of stored procedure call and because of this, it is not possible just to use multiple Statement objects for each select.</div