I have a table with a column name and age.
And I am trying to get all name as
soci::session& sql_session(conn->Session());
soci::rowset<std::string> rs = sql_session.prepare << select name from Person;
std::vector<std::string> plist;
std::copy(rs.begin(), rs.end(), plist.begin());
But my program crashes at std::copy. Seems like both the containers(source and destination) are not same for std::copy. can we do this using ORM, how?
If you need to read only strings it is not to use
rowset
, in that case you don't need to copy:Of course if you need to get all names without hardcoding limit you can use earlier: