I'm using libpqxx version 7.7.0. I want to use the stream_to features. When I follow the examples found on https://libpqxx.readthedocs.io/en/7.7.0/a01429.html I get a warning saying that the stream_to function is deprecated and I should be using table or raw_table. Although I'm really struggling to get those static functions to work, and I can't find any examples anywhere of how they are used. I've read the docs for the functions found at https://libpqxx.readthedocs.io/en/7.7.0/a01176.html#a34d7ca93963c0b5733a9ebcc10f2429b. Has anybody figured how to use that functionality?
I was able to figure out how to use the raw_table function. It appeared to be much simpler than the table command.
std::vector<std::tuple<float, std::string>> data = testData();
pqxx::work transaction{ conn };
pqxx::stream_to stream = pqxx::stream_to::raw_table(transaction, "<schema>.<table>", "<col1>, <col2>,...");
for (auto &tuple : data) {
stream << tuple;
}
stream.complete();
transaction.commit();