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>
45 PQXX_DEPRECATED tablewriter(
47 const std::string &WName,
50 const std::string &Null);
51 ~tablewriter() noexcept;
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) {}
57 template<
typename TUPLE> tablewriter &
operator<<(
const TUPLE &);
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) :
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" std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:141
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:136
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
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
namedclass(const std::string &Classname)
Definition: util.hxx:248
Base class for obsolete tablereader/tablewriter classes.
Definition: tablestream.hxx:26
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:85
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:201
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:52
Definition: tablereader.hxx:29
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:448
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:189
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string{})
Definition: tablewriter.cxx:22
Definition: tablewriter.hxx:31
Escaper(const std::string &null)
Definition: tablewriter.hxx:161
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:168
std::string operator()(IT i) const
Definition: tablewriter.hxx:162
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:178
back_insert_iterator & operator*()
Definition: tablewriter.hxx:100
const std::string & NullStr() const
Definition: tablestream.hxx:36
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:81
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
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
back_insert_iterator & operator++()
Definition: tablewriter.hxx:98
output_iterator_tag iterator_category
Definition: tablewriter.hxx:79
void reserve(SIZE)
Definition: tablewriter.hxx:56
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:92
Definition: tablewriter.hxx:157
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:99