To convert a field's value string to some other type, e.g. to an int, use the field's as<...>() member function. To read a field efficiently just as a string, use its c_str() or its as<std::string_vview>().
Access large objects directly using the blob class.
Member pqxx::operator<< (std::basic_ostream< CHAR > &s, field const &value)
The C++ streams library is not great to work with. In particular, error handling is easy to get wrong. So you're probably better off doing this by hand.