Hi all,
What is the canonical way to select multi column result into a vector
(batch mode). I am trying with the code as pasted under, but that doesn't
compile. I am sure I missed something! (you must be able to do this kind
of thing):
const int BATCH_SIZE = 500;
vector<row> rs(BATCH_SIZE);
statement st = (sql.prepare <<
" SELECT domains.name AS do_name, domains.status AS do_status,"
" COALESCE(domains.ttl, 3600) AS do_ttl, domains.client_hold AS
do_client_hold,"
" COALESCE(host_domain_links.id, -1) AS hd_id,"
" COALESCE(hosts.name, '') AS ho_name,"
" COALESCE(hosts.ipv4, '') AS ho_ipv4,"
" COALESCE(hosts.ipv6, '') AS ho_ipv6,"
" COALESCE(forwardings.url, '') AS fw_url"
" FROM domains"
" LEFT JOIN forwardings ON forwardings.domain_id = domains.id"
" LEFT JOIN host_domain_links ON host_domain_links.domain_id =
domains.id"
" LEFT JOIN hosts on host_domain_links.host_id = hosts.id"
" WHERE domains.name LIKE '%.la';", into(rs));
st.execute(true);
while (st.fetch()) {
vector<row>::iterator pos;
for(pos = rs.begin(); pos != rs.end(); ++pos) {
//cout << *pos << '\n';
}
rs.resize(BATCH_SIZE);
}
Regards
--
Milos Negovanovic
[email protected]
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users