18 #ifndef PQXX_H_BINARYSTRING
19 #define PQXX_H_BINARYSTRING
21 #include "pqxx/compiler-public.hxx"
22 #include "pqxx/compiler-internal-pre.hxx"
26 #include "pqxx/result"
62 pqxx::internal::freemallocmem_templated<unsigned char> >
66 typedef PGSTD::char_traits<char_type>::char_type
value_type;
73 #ifdef PQXX_HAVE_REVERSE_ITERATOR
74 typedef PGSTD::reverse_iterator<const_iterator> const_reverse_iterator;
80 pqxx::internal::freemallocmem_templated<unsigned char> >
97 size_type
size()
const throw () {
return m_size; }
99 size_type
length()
const throw () {
return size(); }
100 bool empty()
const throw () {
return size()==0; }
102 const_iterator
begin()
const throw () {
return data(); }
103 const_iterator
end()
const throw () {
return data()+m_size; }
105 const_reference
front()
const throw () {
return *begin(); }
106 const_reference
back()
const throw () {
return *(data()+m_size-1); }
108 #ifdef PQXX_HAVE_REVERSE_ITERATOR
109 const_reverse_iterator rbegin() const
110 {
return const_reverse_iterator(end()); }
111 const_reverse_iterator rend() const
112 {
return const_reverse_iterator(begin()); }
116 const value_type *
data()
const throw () {
return super::get();}
119 {
return data()[i]; }
121 bool PQXX_PURE operator==(
const binarystring &)
const throw ();
123 {
return !operator==(rhs); }
126 const_reference at(size_type)
const;
135 const char *
get()
const throw ()
137 return reinterpret_cast<const char *
>(super::get());
147 PGSTD::string str()
const;
165 PGSTD::string PQXX_LIBEXPORT
escape_binary(
const PGSTD::string &bin);
171 PGSTD::string PQXX_LIBEXPORT
escape_binary(
const char bin[]);
177 PGSTD::string PQXX_LIBEXPORT
escape_binary(
const char bin[],
size_t len);
183 PGSTD::string PQXX_LIBEXPORT
escape_binary(
const unsigned char bin[]);
189 PGSTD::string PQXX_LIBEXPORT
escape_binary(
const unsigned char bin[],
size_t len);
198 #include "pqxx/compiler-internal-post.hxx"
unsigned char content_type
Definition: util.hxx:564
const value_type * const_pointer
Definition: binarystring.hxx:70
Reference-counted smart pointer to libpq-allocated object.
Definition: util.hxx:559
std::string escape_binary(const std::string &bin)
Escape binary string for inclusion in SQL.
Definition: binarystring.cxx:241
const_iterator begin() const
Definition: binarystring.hxx:102
const_reference back() const
Definition: binarystring.hxx:106
const value_type * data() const
Unescaped field contents.
Definition: binarystring.hxx:116
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
Reference to a field in a result set.
Definition: field.hxx:43
size_type length() const
Size of converted string in bytes.
Definition: binarystring.hxx:99
const_reference front() const
Definition: binarystring.hxx:105
const_iterator end() const
Definition: binarystring.hxx:103
const value_type & const_reference
Definition: binarystring.hxx:69
const_pointer const_iterator
Definition: binarystring.hxx:71
long difference_type
Definition: binarystring.hxx:68
std::char_traits< char_type >::char_type value_type
Definition: binarystring.hxx:66
bool empty() const
Definition: binarystring.hxx:100
size_type size() const
Size of converted string in bytes.
Definition: binarystring.hxx:97
Definition: binarystring.hxx:59
const_reference operator[](size_type i) const
Definition: binarystring.hxx:118
size_t size_type
Definition: binarystring.hxx:67
content_type char_type
Definition: binarystring.hxx:65