mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 21:50:47 +01:00
Added support for std::tuple to Data/Typehandler.h.
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
#include <iomanip>
|
||||
#include <set>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace Poco::Data::Keywords;
|
||||
|
||||
@@ -1400,6 +1404,22 @@ void DataTest::testExternalBindingAndExtraction()
|
||||
}
|
||||
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
||||
void DataTest::testStdTuple()
|
||||
{
|
||||
using Row = std::tuple<std::string, std::string, int>;
|
||||
|
||||
Session sess(SessionFactory::instance().create("test", "cs"));
|
||||
Row person = std::make_tuple(std::string("Scott"), std::string("Washington, DC"), 42);
|
||||
sess << "INSERT INTO Person(name, address, age) VALUES (?, ?, ?)", use(person), now;
|
||||
std::vector<Row> rows;
|
||||
sess << "SELECT name, address, age FROM Person", into(rows) , now;
|
||||
}
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
|
||||
void DataTest::setUp()
|
||||
{
|
||||
}
|
||||
@@ -1430,7 +1450,11 @@ CppUnit::Test* DataTest::suite()
|
||||
CppUnit_addTest(pSuite, DataTest, testSimpleRowFormatter);
|
||||
CppUnit_addTest(pSuite, DataTest, testJSONRowFormatter);
|
||||
CppUnit_addTest(pSuite, DataTest, testDateAndTime);
|
||||
CppUnit_addTest(pSuite, DataTest, testExternalBindingAndExtraction);
|
||||
CppUnit_addTest(pSuite, DataTest, testExternalBindingAndExtraction);
|
||||
#if __cplusplus >= 201103L
|
||||
CppUnit_addTest(pSuite, DataTest, testStdTuple);
|
||||
#endif
|
||||
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user