pqxx Namespace Reference

The home of all libpqxx classes, functions, templates, etc. More...


Classes

class  basic_connection
 The ultimate template that defines a connection type. More...
class  binarystring
class  cachedresult
class  connect_direct
 Connection policy; creates an immediate connection to a database. More...
class  connect_lazy
 Lazy connection policy; causes connection to be deferred until first use. More...
class  connect_async
 Asynchronous connection policy; connects "in the background". More...
class  connect_null
 Nonfunctional, always-down connection policy for debugging purposes. More...
struct  noticer
 Base class for user-definable error/warning message processor. More...
struct  nonnoticer
 No-op message noticer; produces no output. More...
class  connection_base
 connection_base abstract base class; represents a connection to a database. More...
class  scoped_noticer
 Temporarily set different noticer for connection, then restore old one. More...
class  disable_noticer
 Temporarily disable the notice processor. More...
class  connectionpolicy
class  Cursor
 SQL cursor class. More...
class  cursor_base
 Common definitions for cursor types. More...
class  basic_cursor
 The simplest form of cursor, with no concept of position or stride. More...
class  absolute_cursor
 Cursor that knows its position. More...
class  icursorstream
 Simple read-only cursor represented as a stream of results. More...
class  icursor_iterator
 Approximate istream_iterator for icursorstream. More...
class  dbtransaction
class  broken_connection
 Exception class for lost or failed backend connection. More...
class  sql_error
 Exception class for failed queries. More...
class  in_doubt_error
 "Help, I don't know whether transaction was committed successfully!" More...
class  internal_error
 Internal error in libpqxx library. More...
class  feature_not_supported
 Database feature not supported in current setup. More...
class  data_exception
 Error in data provided to SQL statement. More...
class  integrity_constraint_violation
class  invalid_cursor_state
class  invalid_sql_statement_name
class  invalid_cursor_name
class  syntax_error
class  undefined_column
class  undefined_function
class  undefined_table
class  insufficient_privilege
class  insufficient_resources
 Resource shortage on the server. More...
class  disk_full
class  out_of_memory
class  too_many_connections
struct  isolation_traits
 Traits class to describe an isolation level; primarly for libpqxx's own use. More...
class  largeobject
 Identity of a large object. More...
class  largeobjectaccess
 Accessor for large object's contents. More...
class  largeobject_streambuf
 Streambuf to use large objects in standard I/O streams. More...
class  basic_ilostream
 Input stream that gets its data from a large object. More...
class  basic_olostream
 Output stream that writes data back to a large object. More...
class  basic_lostream
 Stream that reads and writes a large object. More...
class  nontransaction
class  pipeline
 Processes several queries in FIFO manner, optimized for high throughput. More...
class  result
 Query or command result set. More...
class  field_streambuf
class  basic_fieldstream
 Input stream that gets its data from a result field. More...
class  basic_robusttransaction
class  robusttransaction
 Slightly slower, better-fortified version of transaction. More...
class  subtransaction
 "Transaction" nested within another transaction More...
class  tablereader
 Efficiently pull data directly out of a table. More...
class  tablestream
 Base class for streaming data to/from database tables. More...
class  tablewriter
 Efficiently write data directly to a database table. More...
class  basic_transaction
class  transaction
 Standard back-end transaction, templatized on isolation level. More...
class  transaction_base
class  transactor
class  trigger
class  items
 Container of items with easy contents initialization and string rendering. More...

Namespaces

namespace  internal
 Private namespace for libpqxx's internal use; do not access.
namespace  prepare
 Dedicated namespace for helper types related to prepared statements.

Typedefs

typedef cachedresult CachedResult
typedef basic_connection<
connect_direct
connection
 The "standard" connection type: connect to database right now.
typedef basic_connection<
connect_lazy
lazyconnection
 A "lazy" connection type: connect to database only when needed.
typedef basic_connection<
connect_async
asyncconnection
 "Asynchronous" connection type: start connecting, but don't wait for it
typedef basic_connection<
connect_null
nullconnection
 A "dummy" connection type: don't connect to any database at all.
typedef basic_cursor< cursor_base::random_access,
cursor_base::read_only > 
cursor
 Convenience typedef: the most common cursor type (read-only, random access).
typedef absolute_cursor< cursor_base::random_access,
cursor_base::read_only > 
abscursor
 Convenience typedef: read-only, random-access absolutely-positioning cursor.
typedef basic_ilostream< char > ilostream
typedef basic_olostream< char > olostream
typedef basic_lostream< char > lostream
typedef unsigned int oid
 PostgreSQL database row identifier.
typedef nontransaction NonTransaction
typedef binarystring BinaryString
typedef result Result
typedef basic_fieldstream<
char > 
fieldstream
typedef robusttransaction<
read_committed > 
RobustTransaction
typedef transaction work
 Bog-standard, default transaction type.

Enumerations

enum  isolation_level { read_committed, serializable }
 Transaction isolation levels; PostgreSQL doesn't implement all SQL levels. More...

Functions

PGSTD::string PQXX_LIBEXPORT escape_binary (const PGSTD::string &bin)
 Escape binary string for inclusion in SQL.
PGSTD::string PQXX_LIBEXPORT escape_binary (const char bin[])
 Escape binary string for inclusion in SQL.
PGSTD::string PQXX_LIBEXPORT escape_binary (const char bin[], size_t len)
 Escape binary string for inclusion in SQL.
PGSTD::string PQXX_LIBEXPORT escape_binary (const unsigned char bin[])
 Escape binary string for inclusion in SQL.
PGSTD::string PQXX_LIBEXPORT escape_binary (const unsigned char bin[], size_t len)
 Escape binary string for inclusion in SQL.
PGSTD::string encrypt_password (const PGSTD::string &user, const PGSTD::string &password)
 Encrypt password for given user. Requires libpq 8.2 or better.
template<>
void cursor_base::check_displacement< cursor_base::forward_only > (difference_type) const
template<typename STREAM>
STREAM & operator<< (STREAM &S, const pqxx::result::field &F)
 Write a result field to any type of stream.
template<typename T>
void from_string (const result::field &F, T &Obj)
 Convert a field's string contents to another type.
template<>
PGSTD::string to_string (const result::field &Obj)
 Convert a field to a string.
template<>
bool result::field::to< PGSTD::string > (PGSTD::string &Obj) const
 Specialization: to(string &).
result::const_iterator operator+ (result::const_iterator::difference_type o, result::const_iterator i)
result::const_reverse_iterator operator+ (result::const_reverse_iterator::difference_type n, const result::const_reverse_iterator &i)
result::const_fielditerator operator+ (result::const_fielditerator::difference_type o, result::const_fielditerator i)
template<typename T>
void error_unsupported_type_in_string_conversion (T)
 Dummy name, used by libpqxx in deliberate link errors.
template<typename T>
PGSTD::string error_ambiguous_string_conversion (T)
 Dummy name, used to generate meaningful link errors.
template<typename T>
void from_string (const char Str[], T &Obj)
 Attempt to convert postgres-generated string to given built-in type.
template<typename T>
void from_string (const char Str[], T &Obj, size_t)
 Conversion with known string length (for strings that may contain nuls).
template<>
void PQXX_LIBEXPORT from_string (const char Str[], PGSTD::string &, size_t)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], long &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], unsigned long &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], int &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], unsigned int &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], short &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], unsigned short &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], float &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], double &)
template<>
void PQXX_LIBEXPORT from_string (const char Str[], bool &)
template<>
void from_string (const char Str[], PGSTD::string &Obj)
template<>
void from_string (const char Str[], PGSTD::stringstream &Obj)
template<typename T>
void from_string (const PGSTD::string &Str, T &Obj)
template<typename T>
void from_string (const PGSTD::stringstream &Str, T &Obj)
template<>
void from_string (const PGSTD::string &Str, PGSTD::string &Obj)
template<>
void from_string (const char[], char &Obj)
template<>
void from_string (const char[], signed char &Obj)
template<>
void from_string (const char[], unsigned char &Obj)
template<>
void from_string (const PGSTD::string &, char &Obj)
template<>
void from_string (const PGSTD::string &, signed char &Obj)
template<>
void from_string (const PGSTD::string &, unsigned char &Obj)
template<typename T>
PGSTD::string to_string (const T &)
 Convert built-in type to a readable string that PostgreSQL will understand.
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const short &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const unsigned short &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const int &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const unsigned int &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const long &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const unsigned long &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const float &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const double &)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const bool &)
PGSTD::string to_string (const char Obj[])
PGSTD::string to_string (const PGSTD::stringstream &Obj)
PGSTD::string to_string (const PGSTD::string &Obj)
template<>
PGSTD::string PQXX_LIBEXPORT to_string (const char &)
template<>
PGSTD::string to_string (const signed char &Obj)
template<>
PGSTD::string to_string (const unsigned char &Obj)
template<typename ITER, typename ACCESS>
PGSTD::string separated_list (const PGSTD::string &sep, ITER begin, ITER end, ACCESS access)
 Access iterators using ACCESS functor, returning separator-separated list.
template<typename ITER>
PGSTD::string separated_list (const PGSTD::string &sep, ITER begin, ITER end)
 Render sequence as a string, using given separator between items.
template<typename OBJ>
PGSTD::string separated_list (const PGSTD::string &sep, OBJ *begin, OBJ *end)
 Render array as a string, using given separator between items.
template<typename CONTAINER>
PGSTD::string separated_list (const PGSTD::string &sep, const CONTAINER &c)
 Render items in a container as a string, using given separator.
PGSTD::string PQXX_LIBEXPORT sqlesc (const char str[]) PQXX_DEPRECATED
 Escape nul-terminated string for inclusion in SQL strings.
PGSTD::string PQXX_LIBEXPORT sqlesc (const char str[], size_t maxlen) PQXX_DEPRECATED
 Escape string for inclusion in SQL strings.
PGSTD::string PQXX_LIBEXPORT sqlesc (const PGSTD::string &) PQXX_DEPRECATED
 Escape string for inclusion in SQL strings.
string escape_binary (const unsigned char bin[], size_t len)
 Escape binary string for inclusion in SQL.
string escape_binary (const unsigned char bin[])
 Escape binary string for inclusion in SQL.
string escape_binary (const char bin[], size_t len)
 Escape binary string for inclusion in SQL.
string escape_binary (const char bin[])
 Escape binary string for inclusion in SQL.
string escape_binary (const string &bin)
string sqlesc (const char str[])
 Escape nul-terminated string for inclusion in SQL strings.
string sqlesc (const char str[], size_t maxlen)
 Escape string for inclusion in SQL strings.
string sqlesc (const string &str)

Variables

const oid oid_none = 0
 The "null" oid.


Detailed Description

The home of all libpqxx classes, functions, templates, etc.

Typedef Documentation

typedef absolute_cursor<cursor_base::random_access, cursor_base::read_only> pqxx::abscursor

Convenience typedef: read-only, random-access absolutely-positioning cursor.

typedef binarystring pqxx::BinaryString

Deprecated:
For compatibility with old BinaryString class

typedef cachedresult pqxx::CachedResult

Deprecated:
For compatibility with the old CachedResult class

typedef basic_cursor<cursor_base::random_access, cursor_base::read_only> pqxx::cursor

Convenience typedef: the most common cursor type (read-only, random access).

typedef basic_fieldstream<char> pqxx::fieldstream

typedef basic_ilostream<char> pqxx::ilostream

typedef basic_lostream<char> pqxx::lostream

typedef nontransaction pqxx::NonTransaction

Deprecated:
For compatibility with the old NonTransaction class

typedef unsigned int pqxx::oid

PostgreSQL database row identifier.

typedef basic_olostream<char> pqxx::olostream

typedef result pqxx::Result

Deprecated:
For compatibility with old Result class

typedef robusttransaction<read_committed> pqxx::RobustTransaction

Deprecated:
For compatibility with old RobustTransaction class


Enumeration Type Documentation

enum pqxx::isolation_level

Transaction isolation levels; PostgreSQL doesn't implement all SQL levels.

The only levels implemented in postgres are read_committed and serializable; SQL also defines read_uncommitted and repeatable_read. Unless you're bent on using nasty tricks to communicate between ongoing transactions and such, you won't really need isolation levels for anything except performance optimization. In that case, you can safely emulate read_uncommitted by using read_committed and repeatable_read by using serializable. In general, serializable is the safest choice.

Enumerator:
read_committed 
serializable 


Function Documentation

template<>
void pqxx::cursor_base::check_displacement< cursor_base::forward_only > ( difference_type   )  const

PGSTD::string pqxx::encrypt_password ( const PGSTD::string &  user,
const PGSTD::string &  password 
)

Encrypt password for given user. Requires libpq 8.2 or better.

Use this when setting a new password for the user if password encryption is enabled. Inputs are the username the password is for, and the plaintext password.

Returns:
encrypted version of the password, suitable for encrypted PostgreSQL authentication.
Thus the password for a user can be changed with:
 void setpw(transaction_base &t, const string &user, const string &pw)
 {
   t.exec("ALTER USER " + user + " "
        "PASSWORD '" + encrypt_password(user,pw) + "'");
 }

Since:
libpq 8.2

string pqxx::escape_binary ( const string &  bin  ) 

template<typename T>
void pqxx::from_string ( const result::field &  F,
T &  Obj 
)

Convert a field's string contents to another type.

result::const_fielditerator pqxx::operator+ ( result::const_fielditerator::difference_type  o,
result::const_fielditerator  i 
)

result::const_reverse_iterator pqxx::operator+ ( result::const_reverse_iterator::difference_type  n,
const result::const_reverse_iterator &  i 
)

result::const_iterator pqxx::operator+ ( result::const_iterator::difference_type  o,
result::const_iterator  i 
)

template<typename STREAM>
STREAM& pqxx::operator<< ( STREAM &  S,
const pqxx::result::field F 
)

Write a result field to any type of stream.

This can be convenient when writing a field to an output stream. More importantly, it lets you write a field to e.g. a stringstream which you can then use to read, format and convert the field in ways that to() does not support.

Example: parse a field into a variable of the nonstandard "<tt>long long</tt>" type.

 extern result R;
 long long L;
 stringstream S;

 // Write field's string into S
 S << R[0][0];

 // Parse contents of S into L
 S >> L;

template<>
bool pqxx::result::field::to< PGSTD::string > ( PGSTD::string &  Obj  )  const

Specialization: to(string &).

template<typename ITER, typename ACCESS>
PGSTD::string pqxx::separated_list ( const PGSTD::string &  sep,
ITER  begin,
ITER  end,
ACCESS  access 
)

Access iterators using ACCESS functor, returning separator-separated list.

Parameters:
sep separator string (to be placed between items)
begin beginning of items sequence
end end of items sequence
access functor defining how to dereference sequence elements

string pqxx::sqlesc ( const string &  str  ) 

template<>
PGSTD::string pqxx::to_string ( const result::field &  Obj  ) 

Convert a field to a string.


Variable Documentation

const oid pqxx::oid_none = 0

The "null" oid.


Generated on Thu Feb 1 17:12:28 2007 for libpqxx by  doxygen 1.5.1