19 #ifndef PQXX_H_TABLEWRITER 20 #define PQXX_H_TABLEWRITER 21 #include "pqxx/compiler-public.hxx" 22 #include "pqxx/compiler-internal-pre.hxx" 23 #include "pqxx/tablestream" 36 const PGSTD::string &WName,
37 const PGSTD::string &Null=PGSTD::string());
39 const PGSTD::string &WName,
43 const PGSTD::string &WName,
46 const PGSTD::string &Null);
48 template<typename IT>
void insert(IT Begin, IT End);
49 template<typename TUPLE>
void insert(const TUPLE &);
50 template<typename IT>
void push_back(IT Begin, IT End);
51 template<typename TUPLE>
void push_back(const TUPLE &);
52 void reserve(size_type) {}
55 template<
typename IT> PGSTD::string generate(IT Begin, IT End)
const;
56 template<
typename TUPLE> PGSTD::string generate(
const TUPLE &)
const;
57 virtual void complete();
58 void write_raw_line(
const PGSTD::string &);
61 const PGSTD::string &WName,
62 const PGSTD::string &Columns = PGSTD::string());
63 void PQXX_PRIVATE writer_close();
69 class back_insert_iterator<
pqxx::tablewriter> :
70 public iterator<output_iterator_tag, void,void,void,void>
75 back_insert_iterator &
78 m_Writer = rhs.m_Writer;
81 template<
typename TUPLE>
97 const PGSTD::string &WName,
100 namedclass(
"tablewriter", WName),
103 setup(T, WName,
columnlist(begincolumns, endcolumns));
106 const PGSTD::string &WName,
109 const PGSTD::string &Null) :
113 setup(T, WName,
columnlist(begincolumns, endcolumns));
117 PGSTD::string PQXX_LIBEXPORT Escape(
118 const PGSTD::string &s,
119 const PGSTD::string &null);
121 const PGSTD::string &s,
122 const PGSTD::string &null)
123 {
return Escape(s, null); }
126 const PGSTD::string &null)
127 {
return s ? Escape(PGSTD::string(s), null) :
"\\N"; }
130 const PGSTD::string &null)
134 const PGSTD::string &m_null;
136 explicit Escaper(
const PGSTD::string &null) : m_null(null) {}
140 template<
typename IT>
145 template<
typename TUPLE>
148 return generate(T.begin(), T.end());
156 insert(T.begin(), T.end());
158 template<
typename IT>
163 template<
typename TUPLE>
166 insert(T.begin(), T.end());
168 template<
typename TUPLE>
175 #include "pqxx/compiler-internal-post.hxx" std::basic_ostream< CHAR > & operator<<(std::basic_ostream< CHAR > &S, const pqxx::field &F)
Write a result field to any type of stream.
Definition: result.hxx:452
std::string operator()(IT i) const
Definition: tablewriter.hxx:137
tablewriter(transaction_base &, const std::string &WName, const std::string &Null=std::string())
Definition: tablewriter.cxx:34
Definition: tablereader.hxx:31
back_insert_iterator & operator=(const TUPLE &T)
Definition: tablewriter.hxx:82
std::string EscapeAny(const std::string &s, const std::string &null)
Definition: tablewriter.hxx:120
Definition: tablewriter.hxx:31
back_insert_iterator(pqxx::tablewriter &W)
Definition: tablewriter.hxx:73
unsigned size_type
Definition: tablewriter.hxx:34
const std::string & NullStr() const
Definition: tablestream.hxx:37
std::string generate(IT Begin, IT End) const
Definition: tablewriter.hxx:141
back_insert_iterator & operator++(int)
Definition: tablewriter.hxx:88
std::string separated_list(const std::string &sep, ITER begin, ITER end, ACCESS access)
Access iterators using ACCESS functor, returning separator-separated list.
Definition: util.hxx:417
back_insert_iterator & operator++()
Definition: tablewriter.hxx:87
Escaper(const std::string &null)
Definition: tablewriter.hxx:136
void insert(IT Begin, IT End)
Definition: tablewriter.hxx:150
std::string to_string(const field &Obj)
Convert a field to a string.
Definition: result.hxx:467
static std::string columnlist(ITER colbegin, ITER colend)
Definition: tablestream.hxx:50
void write_raw_line(const std::string &)
Definition: tablewriter.cxx:78
tablewriter & operator<<(const TUPLE &)
Definition: tablewriter.hxx:169
void push_back(IT Begin, IT End)
Definition: tablewriter.hxx:159
Definition: tablewriter.hxx:132
Definition: tablestream.hxx:28
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
Definition: transaction_base.hxx:133
back_insert_iterator & operator*()
Definition: tablewriter.hxx:89
namedclass(const std::string &Classname, const std::string &Name="")
Definition: util.hxx:675
back_insert_iterator & operator=(const back_insert_iterator &rhs)
Definition: tablewriter.hxx:76