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" 35 const std::string &WName,
36 const std::string &Null=std::string());
39 const std::string &WName,
44 const std::string &WName,
47 const std::string &Null);
49 template<
typename IT>
void insert(IT Begin, IT End);
50 template<
typename TUPLE>
void insert(
const TUPLE &);
51 template<
typename IT>
void push_back(IT Begin, IT End);
52 template<
typename TUPLE>
void push_back(
const TUPLE &);
53 template<
typename SIZE>
void reserve(SIZE) {}
56 template<
typename IT> std::string generate(IT Begin, IT End)
const;
57 template<
typename TUPLE> std::string generate(
const TUPLE &)
const;
58 virtual void complete()
override;
59 void write_raw_line(
const std::string &);
63 const std::string &WName,
64 const std::string &Columns = std::string());
65 PQXX_PRIVATE
void writer_close();
73 class back_insert_iterator<
pqxx::tablewriter> :
74 public iterator<output_iterator_tag, void,void,void,void>
80 back_insert_iterator &
83 m_writer = rhs.m_writer;
87 template<
typename TUPLE>
108 const std::string &WName,
111 namedclass(
"tablewriter", WName),
114 setup(T, WName,
columnlist(begincolumns, endcolumns));
120 const std::string &WName,
123 const std::string &Null) :
127 setup(T, WName,
columnlist(begincolumns, endcolumns));
133 PQXX_LIBEXPORT std::string escape(
134 const std::string &s,
135 const std::string &null);
138 const std::string &s,
139 const std::string &null)
140 {
return escape(s, null); }
144 const std::string &null)
145 {
return s ? escape(std::string(s), null) :
"\\N"; }
149 const std::string &null)
155 const std::string &m_null;
157 explicit Escaper(
const std::string &null) : m_null(null) {}
163 template<
typename IT>
168 template<
typename TUPLE>
171 return generate(T.begin(), T.end());
181 insert(T.begin(), T.end());
184 template<
typename IT>
190 template<
typename TUPLE>
193 insert(T.begin(), T.end());
196 template<
typename TUPLE>
204 #include "pqxx/compiler-internal-post.hxx" Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:130
Escaper(const std::string &null)
Definition: tablewriter.hxx:157
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:65
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.cxx:434
std::string escape_any(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:137
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Represent sequence of values as a separated string.
Definition: util.hxx:99
back_insert_iterator & operator*()
Definition: tablewriter.hxx:96
back_insert_iterator(pqxx::tablewriter &W) noexcept
Definition: tablewriter.hxx:77
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:174
namedclass(const std::string &Classname)
Definition: util.hxx:173
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:345
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:185
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:197
back_insert_iterator & operator++()
Definition: tablewriter.hxx:94
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:95
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:49
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:22
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:88
Definition: tablewriter.hxx:153
Definition: tablestream.hxx:24
back_insert_iterator & operator=(const back_insert_iterator &rhs) noexcept
Definition: tablewriter.hxx:81
const std::string & NullStr() const
Definition: tablestream.hxx:34
std::string operator()(IT i) const
Definition: tablewriter.hxx:158
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string())
Definition: tablewriter.cxx:22
void reserve(SIZE)
Definition: tablewriter.hxx:53
Definition: tablereader.hxx:28
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:164
Definition: tablewriter.hxx:30