13 #ifndef PQXX_H_STREAM_TO 14 #define PQXX_H_STREAM_TO 16 #include "pqxx/compiler-public.hxx" 17 #include "pqxx/internal/compiler-internal-pre.hxx" 19 #include "pqxx/separated_list.hxx" 20 #include "pqxx/transaction_base.hxx" 29 template<
typename T> std::string
operator()(T
const *t)
const 33 if constexpr (std::is_same_v<T, std::nullptr_t>)
36 return (t ==
nullptr or
is_null(*t)) ?
"\\N" :
86 stream_to(transaction_base &, std::string_view table_name);
89 template<
typename Columns>
91 transaction_base &, std::string_view table_name, Columns
const &columns);
94 template<
typename Iter>
96 transaction_base &, std::string_view table_name, Iter columns_begin,
101 [[nodiscard]]
operator bool() const noexcept {
return not m_finished; }
102 [[nodiscard]]
bool operator!() const noexcept {
return m_finished; }
131 bool m_finished =
false;
134 void write_raw_line(std::string_view);
136 void set_up(transaction_base &, std::string_view table_name);
138 transaction_base &, std::string_view table_name,
139 std::string
const &columns);
143 template<
typename Columns>
144 inline stream_to::stream_to(
145 transaction_base &tb, std::string_view table_name, Columns
const &columns) :
146 stream_to{tb, table_name, std::begin(columns), std::end(columns)}
150 template<
typename Iter>
151 inline stream_to::stream_to(
152 transaction_base &tb, std::string_view table_name, Iter columns_begin,
154 namedclass{
"stream_to", table_name},
157 set_up(tb, table_name,
separated_list(
",", columns_begin, columns_end));
161 template<
typename Tuple>
stream_to &stream_to::operator<<(Tuple
const &t)
168 #include "pqxx/internal/compiler-internal-post.hxx" bool operator!() const noexcept
Definition: stream_to.hxx:102
bool is_null(TYPE const &value)
Is value null?
Definition: strconv.hxx:286
Definition: transaction_base.hxx:42
std::string copy_string_escape(std::string_view)
Definition: stream_to.cxx:110
std::string to_string(field const &value)
Convert a field to a string.
Definition: result.cxx:478
Definition: connection.hxx:59
Definition: stream_to.hxx:27
std::string separated_list(std::string_view sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: separated_list.hxx:40
std::string operator()(T const *t) const
Definition: stream_to.hxx:29
void ignore_unused(T &&)
Suppress compiler warning about an unused item.
Definition: util.hxx:43
Dedicated namespace for helper types related to prepared statements.
Definition: array.hxx:25
Efficiently pull data directly out of a table.
Definition: stream_from.hxx:30
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &s, field const &value)
Write a result field to any type of stream.
Definition: field.hxx:347
Efficiently write data directly to a database table.
Definition: stream_to.hxx:75