13 #ifndef PQXX_H_TABLEWRITER
14 #define PQXX_H_TABLEWRITER
18 #include "pqxx/compiler-public.hxx"
19 #include "pqxx/compiler-internal-pre.hxx"
21 #include "pqxx/tablestream.hxx"
36 const std::string &WName,
37 const std::string &Null=std::string{});
38 template<
typename ITER>
41 const std::string &WName,
44 template<
typename ITER>
47 const std::string &WName,
50 const std::string &Null);
52 template<
typename IT>
void insert(IT Begin, IT End);
53 template<
typename TUPLE>
void insert(
const TUPLE &);
54 template<
typename IT>
void push_back(IT Begin, IT End);
55 template<
typename TUPLE>
void push_back(
const TUPLE &);
56 template<
typename SIZE>
void reserve(SIZE) {}
59 template<
typename IT> std::string generate(IT Begin, IT End)
const;
60 template<
typename TUPLE> std::string generate(
const TUPLE &)
const;
61 virtual void complete()
override;
62 void write_raw_line(
const std::string &);
66 const std::string &WName,
67 const std::string &Columns = std::string{});
68 PQXX_PRIVATE
void writer_close();
76 class back_insert_iterator<
pqxx::tablewriter>
84 back_insert_iterator &
87 m_writer = rhs.m_writer;
91 template<
typename TUPLE>
112 const std::string &WName,
115 namedclass{
"tablewriter", WName},
118 set_up(T, WName, columnlist(begincolumns, endcolumns));
124 const std::string &WName,
127 const std::string &Null) :
128 namedclass{
"tablewriter", WName},
131 set_up(T, WName, columnlist(begincolumns, endcolumns));
137 PQXX_LIBEXPORT std::string
escape(
138 const std::string &s,
139 const std::string &
null);
142 const std::string &s,
143 const std::string &
null)
144 {
return escape(s,
null); }
148 const std::string &
null)
149 {
return s ?
escape(std::string{s},
null) :
"\\N"; }
153 const std::string &
null)
159 const std::string &m_null;
161 explicit Escaper(
const std::string &
null) : m_null{
null} {}
167 template<
typename IT>
172 template<
typename TUPLE>
175 return generate(std::begin(T), std::end(T));
185 insert(std::begin(T), std::end(T));
188 template<
typename IT>
194 template<
typename TUPLE>
197 insert(std::begin(T), std::end(T));
200 template<
typename TUPLE>
208 #include "pqxx/compiler-internal-post.hxx"
Definition: tablewriter.hxx:157
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
const std::string & NullStr() const
Definition: tablestream.hxx:36
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const field &F)
Write a result field to any type of stream.
Definition: field.hxx:355
bool get_raw_line(std::string &Line)
Definition: tablereader.cxx:55
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
Private namespace for libpqxx's internal use; do not access.
Definition: connection_base.hxx:43
Definition: tablewriter.hxx:31
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
void reserve(SIZE)
Definition: tablewriter.hxx:56
~tablewriter() noexcept
Definition: tablewriter.cxx:33
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:26
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
virtual void complete() override
Definition: tablewriter.cxx:75
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a string, joined by a given separator.
Definition: util.hxx:95
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
constexpr char number_to_digit(int i) noexcept
Definition: strconv.hxx:324
std::string escape(const std::string &s, const std::string &null)
Definition: tablewriter.cxx:131
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
Helper base class: object descriptions for error messages and such.
Definition: util.hxx:233
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:451
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
Definition: tablereader.hxx:29
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:136
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22