pqxx::binarystring Class Reference

#include <binarystring.hxx>

Inheritance diagram for pqxx::binarystring:

Inheritance graph
[legend]

List of all members.

Public Types

typedef content_type char_type
typedef std::char_traits
< char_type >::char_type 
value_type
typedef size_t size_type
typedef long difference_type
typedef const value_typeconst_reference
typedef const value_typeconst_pointer
typedef const_pointer const_iterator

Public Member Functions

 binarystring (const result::field &F)
 Read and unescape bytea field.
size_type size () const throw ()
 Size of converted string in bytes.
size_type length () const throw ()
 Size of converted string in bytes.
bool empty () const throw ()
const_iterator begin () const throw ()
const_iterator end () const throw ()
const_reference front () const throw ()
const_reference back () const throw ()
const value_typedata () const throw ()
 Unescaped field contents.
const_reference operator[] (size_type i) const throw ()
bool operator== (const binarystring &) const throw ()
bool operator!= (const binarystring &rhs) const throw ()
const_reference at (size_type) const
 Index contained string, checking for valid index.
void swap (binarystring &)
 Swap contents with other binarystring.
const char * c_ptr () const throw ()
 Raw character buffer (no terminating zero is added).
const std::string & str () const
 Read as regular C++ string (may include null characters).

Package Attributes

 __pad0__:PQAlloc<value_type> super

Related Functions

(Note that these are not member functions.)

std::string escape_binary (const std::string &bin)
 Escape binary string for inclusion in SQL.
std::string escape_binary (const char bin[])
 Escape binary string for inclusion in SQL.
std::string escape_binary (const char bin[], size_t len)
 Escape binary string for inclusion in SQL.
std::string escape_binary (const unsigned char bin[])
 Escape binary string for inclusion in SQL.
std::string escape_binary (const unsigned char bin[], size_t len)
 Escape binary string for inclusion in SQL.


Member Typedef Documentation

typedef std ::char_traits<char_type>::char_type pqxx::binarystring::value_type


Constructor & Destructor Documentation

pqxx::binarystring::binarystring ( const result::field F  )  [explicit]

Read and unescape bytea field.

The field will be zero-terminated, even if the original bytea field isn't.

Parameters:
F the field to read; must be a bytea field

References c_ptr(), pqxx::result::result::field::c_str(), pqxx::internal::PQAlloc< unsigned char >::operator=(), and pqxx::result::result::field::size().


Member Function Documentation

pqxx::binarystring::const_reference pqxx::binarystring::at ( size_type  n  )  const

Index contained string, checking for valid index.

References data(), and pqxx::to_string().

const_reference pqxx::binarystring::back (  )  const throw ()

const_iterator pqxx::binarystring::begin (  )  const throw ()

const char* pqxx::binarystring::c_ptr (  )  const throw ()

Raw character buffer (no terminating zero is added).

Warning:
No terminating zero is added! If the binary data did not end in a null character, you will not find one here.

Reimplemented from pqxx::internal::PQAlloc< unsigned char >.

Referenced by binarystring(), and str().

const value_type* pqxx::binarystring::data (  )  const throw ()

Unescaped field contents.

Referenced by at().

bool pqxx::binarystring::empty (  )  const throw ()

const_iterator pqxx::binarystring::end (  )  const throw ()

const_reference pqxx::binarystring::front (  )  const throw ()

size_type pqxx::binarystring::length (  )  const throw ()

Size of converted string in bytes.

bool pqxx::binarystring::operator!= ( const binarystring rhs  )  const throw ()

bool pqxx::binarystring::operator== ( const binarystring rhs  )  const throw ()

const_reference pqxx::binarystring::operator[] ( size_type  i  )  const throw ()

size_type pqxx::binarystring::size (  )  const throw ()

Size of converted string in bytes.

const string & pqxx::binarystring::str (  )  const

Read as regular C++ string (may include null characters).

Caches string buffer to speed up repeated reads.

Warning:
The first invocation of this function on a given binarystring is not threadsafe; the first invocation constructs the string object and stores it in the binarystring. After it has been called once, any subsequent calls on the same binarystring are safe.

References c_ptr().

void pqxx::binarystring::swap ( binarystring rhs  ) 

Swap contents with other binarystring.

References m_size, and m_str.


Member Data Documentation


The documentation for this class was generated from the following files:

Generated on Sat Aug 15 00:16:51 2009 for libpqxx by  doxygen 1.5.8