Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pqxx Namespace Reference


Classes

class  asyncconnection
 Asynchronous connection class; connects "in the background". More...

class  basic_ilostream
 Input stream that gets its data from a large object. More...

class  basic_lostream
 Stream that reads and writes a large object. More...

class  basic_olostream
 Output stream that writes data back to a large object. More...

class  basic_robusttransaction
class  basic_transaction
class  binarystring
 Reveals "unescaped" version of PostgreSQL bytea string. More...

class  broken_connection
 Exception class for lost backend connection. More...

class  cachedresult
class  connection
 Connection class; represents an immediate connection to a database. More...

class  connection_base
 connection_base abstract base class; represents a connection to a database. More...

class  Cursor
 SQL cursor class. More...

struct  Cursor::unknown_position
 Exception thrown when cursor position is requested, but is unknown. More...

class  dbtransaction
 Abstract base class responsible for bracketing a backend transaction. More...

class  in_doubt_error
 "Help, I don't know whether transaction was committed successfully!" More...

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  largeobject_streambuf
 Streambuf to use large objects in standard I/O streams. More...

class  largeobjectaccess
 Accessor for large object's contents. More...

class  lazyconnection
 Lazy connection class; represents a deferred connection to a database. More...

class  nontransaction
 Simple "transaction" class offering no transactional integrity. More...

struct  noticer
 Base class for user-definable error/warning message processor. More...

class  PQAlloc
 Keep track of a libpq-allocated pointer to be free()d automatically. More...

class  result
 Query or command result set. More...

class  result::const_iterator
 Iterator for rows (tuples) in a query result set. More...

class  result::field
 Reference to a field in a result set. More...

class  result::tuple
 Reference to one row in a result. More...

class  robusttransaction
 Slightly slower, better-fortified version of transaction. More...

class  sql_error
 Exception class for failed queries. 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  tablewriter::fieldconverter
class  transaction
 Standard back-end transaction, templatized on isolation level. More...

class  transaction_base
 Interface definition (and common code) for "transaction" classes. More...

class  transactor
 Wrapper for transactions that automatically restarts them on failure. More...

class  trigger
 "Observer" base class for trigger notifications. More...

class  unique
 Ensure proper opening/closing of GUEST objects related to a "host" object. More...


Typedefs

typedef cachedresult CachedResult
typedef connection Connection
typedef lazyconnection LazyConnection
typedef connection_base ConnectionItf
typedef largeobject LargeObject
typedef largeobjectaccess LargeObjectAccess
typedef basic_ilostream< char > ilostream
typedef basic_olostream< char > olostream
typedef basic_lostream< char > lostream
typedef nontransaction NonTransaction
typedef binarystring BinaryString
typedef result Result
typedef robusttransaction<
read_committed > 
RobustTransaction
typedef tablereader TableReader
typedef tablestream TableStream
typedef tablewriter TableWriter
typedef transaction< read_committed > Transaction
typedef transaction work
 Bog-standard, default transaction type.

typedef transaction_base TransactionItf
typedef transactor< transaction<
read_committed > > 
Transactor
typedef trigger Trigger
typedef long result_size_type
typedef int tuple_size_type
typedef Oid oid
 PostgreSQL row identifier 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.

template<> PGSTD::string Classname (const transaction_base *)
 Human-readable class names for use by unique template.

template<> PGSTD::string Classname (const dbtransaction *)
 Human-readable class name for use by unique.

template<> PGSTD::string Classname (const nontransaction *)
 Human-readable class names for use by unique template.

template<typename STREAM> STREAM & operator<< (STREAM &S, const pqxx::result::field &F)
 Write a result field to any type of stream.

result::const_iterator operator+ (result::const_iterator::difference_type o, result::const_iterator i)
template<> PGSTD::string Classname (const basic_robusttransaction *)
 Human-readable class names for use by unique template.

template<isolation_level ISOLATIONLEVEL> PGSTD::string Classname (const robusttransaction< ISOLATIONLEVEL > *)
 Human-readable class names for use by unique template.

template<> PGSTD::string Classname (const basic_transaction *)
 Human-readable class name for use by unique.

template<isolation_level ISOLATIONLEVEL> PGSTD::string Classname (const transaction< ISOLATIONLEVEL > *)
 Human-readable class names for use by unique template.

template<> PGSTD::string Classname (const tablestream *)
 User-readable class name for use by unique.

template<typename T> void error_unsupported_type_in_string_conversion (T)
 Dummy name, used by libpqxx in deliberate link errors.

template<typename T> const char * FmtString (T t)
 C-style format strings for various built-in types.

template<> const char * FmtString (short)
template<> const char * FmtString (unsigned short)
template<> const char * FmtString (int)
template<> const char * FmtString (long)
template<> const char * FmtString (float)
template<> const char * FmtString (double)
template<> const char * FmtString (char)
template<typename T> PGSTD::string ToString (const T &Obj)
 Convert object of built-in type to string.

template<> PGSTD::string ToString (const PGSTD::string &Obj)
template<> PGSTD::string ToString (const char *const &Obj)
template<> PGSTD::string ToString (char *const &Obj)
template<> PGSTD::string ToString (const unsigned char *const &Obj)
template<> PGSTD::string ToString (const bool &Obj)
template<> PGSTD::string ToString (const short &Obj)
template<> PGSTD::string ToString (const unsigned short &Obj)
template<typename T> void FromString (const char Str[], T &Obj)
 Convert string to object of built-in type.

void FromString_string (const char Str[], PGSTD::string &Obj)
 For libpqxx internal use only: convert C string to C++ string.

template<> void FromString (const char Str[], PGSTD::string &Obj)
template<> void FromString (const char Str[], const char *&Obj)
void FromString_ucharptr (const char Str[], const unsigned char *&Obj)
template<> void FromString (const char Str[], const unsigned char *&Obj)
void FromString_bool (const char Str[], bool &Obj)
 For libpqxx internal use only: convert string to bool.

template<> void FromString (const char Str[], bool &Obj)
template<typename T> PGSTD::string Quote (const T &Obj, bool EmptyIsNull)
 Quote string for use in SQL.

PGSTD::string Quote_string (const PGSTD::string &Obj, bool EmptyIsNull)
 For libpqxx internal use only: quote std::string.

template<> PGSTD::string Quote (const PGSTD::string &Obj, bool EmptyIsNull)
 std::string version, on which the other versions are built

PGSTD::string Quote_charptr (const char Obj[], bool EmptyIsNull)
 For libpqxx internal use only: quote const char *.

template<> PGSTD::string Quote (const char *const &Obj, bool EmptyIsNull)
 Special case for const char *, accepting null pointer as null value.

template<int LEN> PGSTD::string Quote (const char(&Obj)[LEN], bool EmptyIsNull)
 Specialization for string constants.

template<typename T> PGSTD::string Quote (T Obj)
 Quote string for use in SQL.

template<typename T> PGSTD::string Classname (const T *)
 Return user-readable name for a class. Specialize this whereever used.

PGSTD::string UniqueRegisterError (const void *New, const void *Old, const PGSTD::string &ClassName, const PGSTD::string &NewName)
 For libpqxx internal use only: compose error message.

PGSTD::string UniqueUnregisterError (const void *New, const void *Old, const PGSTD::string &ClassName, const PGSTD::string &NewName, const PGSTD::string &OldName)
 For libpqxx internal use only: compose error message.


Variables

const oid oid_none = InvalidOid
 The "null" oid.


Typedef Documentation

typedef binarystring pqxx::BinaryString
 

Deprecated:
For compatibility with old BinaryString class

typedef cachedresult pqxx::CachedResult
 

Deprecated:
For compatibility with the old CachedResult class

typedef connection pqxx::Connection
 

Deprecated:
For compatibility with old Connection class

typedef connection_base pqxx::ConnectionItf
 

What is now connection_base used to be called ConnectionItf. This was changed to convey its role in a way more consistent with the C++ standard library.

typedef basic_ilostream<char> pqxx::ilostream
 

typedef largeobject pqxx::LargeObject
 

Deprecated:
For compatibility with old LargeObject class

typedef largeobjectaccess pqxx::LargeObjectAccess
 

Deprecated:
For compatibility with old LargeObjectAccess class

typedef lazyconnection pqxx::LazyConnection
 

Deprecated:
For compatibility with old LazyConnection class

typedef basic_lostream<char> pqxx::lostream
 

typedef nontransaction pqxx::NonTransaction
 

Deprecated:
For compatibility with the old NonTransaction class

typedef Oid pqxx::oid
 

PostgreSQL row identifier type.

typedef basic_olostream<char> pqxx::olostream
 

typedef result pqxx::Result
 

Deprecated:
For compatibility with old Result class

typedef long pqxx::result_size_type
 

typedef robusttransaction<read_committed> pqxx::RobustTransaction
 

Deprecated:
For compatibility with old RobustTransaction class

typedef tablereader pqxx::TableReader
 

Deprecated:
For compatibility with the old TableReader class

typedef tablestream pqxx::TableStream
 

Deprecated:
For compatibility with the old TableStream class

typedef tablewriter pqxx::TableWriter
 

Deprecated:
For compatibility with the old TableWriter class

typedef transaction<read_committed> pqxx::Transaction
 

Deprecated:
Compatibility with the old Transaction class

typedef transaction_base pqxx::TransactionItf
 

What is now transaction_base used to be called TransactionItf. This was changed to convey its role in a way more consistent with the C++ standard library.

typedef transactor<transaction<read_committed> > pqxx::Transactor
 

Deprecated:
For compatibility with the old Transactor class

typedef trigger pqxx::Trigger
 

Deprecated:
For compatibility with the old Trigger class

typedef int pqxx::tuple_size_type
 

typedef transaction pqxx::work
 

Bog-standard, default transaction type.


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.

Enumeration values:
read_committed 
serializable 


Function Documentation

template<typename T>
PGSTD::string Classname const T *   ) 
 

Return user-readable name for a class. Specialize this whereever used.

template<>
PGSTD::string Classname const tablestream *   ) 
 

User-readable class name for use by unique.

template<isolation_level ISOLATIONLEVEL>
PGSTD::string Classname const transaction< ISOLATIONLEVEL > *   ) 
 

Human-readable class names for use by unique template.

template<>
PGSTD::string Classname const basic_transaction *   ) 
 

Human-readable class name for use by unique.

template<isolation_level ISOLATIONLEVEL>
PGSTD::string Classname const robusttransaction< ISOLATIONLEVEL > *   ) 
 

Human-readable class names for use by unique template.

template<>
PGSTD::string Classname const basic_robusttransaction *   ) 
 

Human-readable class names for use by unique template.

template<>
PGSTD::string Classname const nontransaction *   ) 
 

Human-readable class names for use by unique template.

template<>
PGSTD::string Classname const dbtransaction *   ) 
 

Human-readable class name for use by unique.

template<>
PGSTD::string Classname const transaction_base *   ) 
 

Human-readable class names for use by unique template.

template<typename T>
void error_unsupported_type_in_string_conversion  ) 
 

Dummy name, used by libpqxx in deliberate link errors.

If you get an error involving this function while building your program, this means that the program contains an unsupported string conversion.

In other words, the program tries to convert an object to a string, or a string to an object, of a type for which libpqxx does not implement this conversion. A notable example is "long long," which is supported by many compilers but does not exist in Standard C++.

In the case of "long long" and similar types, if your implementation of the standard C++ library supports it, you may use a stringstream to perform the conversion. For other types, you may have to write the conversion routine yourself.

string pqxx::escape_binary const unsigned char  bin[],
size_t  len
 

Escape binary string for inclusion in SQL.

string pqxx::escape_binary const unsigned char  bin[]  ) 
 

Escape binary string for inclusion in SQL.

string pqxx::escape_binary const char  bin[],
size_t  len
 

Escape binary string for inclusion in SQL.

string pqxx::escape_binary const char  bin[]  ) 
 

Escape binary string for inclusion in SQL.

string pqxx::escape_binary const PGSTD::string &  bin  ) 
 

Escape binary string for inclusion in SQL.

template<>
const char* FmtString char   ) 
 

template<>
const char* FmtString double   ) 
 

template<>
const char* FmtString float   ) 
 

template<>
const char * pqxx::FmtString long  double  ) 
 

template<>
const char* FmtString int   ) 
 

template<>
const char * pqxx::FmtString unsigned  char  ) 
 

template<>
const char* FmtString short   ) 
 

template<typename T>
const char* FmtString t  ) 
 

C-style format strings for various built-in types.

Only allowed for certain types, for which this function is explicitly specialized. When attempting to use the template for an unsupported type, the generic version will be instantiated. This will result in a link error for the symbol error_unsupported_type_in_string_conversion(), with a template argument describing the unsupported input type.

template<>
void FromString const char  Str[],
bool &  Obj
 

template<>
void FromString const char  Str[],
const unsigned char *&  Obj
 

template<>
void FromString const char  Str[],
const char *&  Obj
 

template<>
void FromString const char  Str[],
PGSTD::string &  Obj
 

template<typename T>
void FromString const char  Str[],
T &  Obj
 

Convert string to object of built-in type.

Caution: the conversion is done using the currently active locale, whereas PostgreSQL delivers values in the "default" (C) locale. This means that if you intend to use this function from a locale that doesn't understand the data types in question (particularly numeric types like float and int) in default C format, you'll need to switch back to the C locale before the call. This should be fixed at some point in the future.

void pqxx::FromString_bool const char  Str[],
bool &  Obj
 

For libpqxx internal use only: convert string to bool.

void pqxx::FromString_string const char  Str[],
PGSTD::string &  Obj
 

For libpqxx internal use only: convert C string to C++ string.

void pqxx::FromString_ucharptr const char  Str[],
const unsigned char *&  Obj
 

result::const_iterator operator+ result::const_iterator::difference_type  o,
result::const_iterator  i
 

template<typename STREAM>
STREAM& 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 "long long" 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<typename T>
PGSTD::string Quote Obj  ) 
 

Quote string for use in SQL.

This version of the function never generates null values.

template<int LEN>
PGSTD::string Quote const char &  Obj[LEN],
bool  EmptyIsNull
 

Specialization for string constants.

This specialization is a little complicated, because string constants are of the type char[], not of type const char * as one might expect. Note that the size of the array is part of the type, for which reason we need it in our template here.

template<>
PGSTD::string Quote const char *const &  Obj,
bool  EmptyIsNull
 

Special case for const char *, accepting null pointer as null value.

template<>
PGSTD::string Quote const PGSTD::string &  Obj,
bool  EmptyIsNull
 

std::string version, on which the other versions are built

template<typename T>
PGSTD::string pqxx::Quote const T &  Obj,
bool  EmptyIsNull
 

Quote string for use in SQL.

Generate SQL-quoted version of string. If EmptyIsNull is set, an empty string will generate the null value rather than an empty string.

string pqxx::Quote_charptr const char  Obj[],
bool  EmptyIsNull
 

For libpqxx internal use only: quote const char *.

string pqxx::Quote_string const PGSTD::string &  Obj,
bool  EmptyIsNull
 

For libpqxx internal use only: quote std::string.

template<>
PGSTD::string ToString const unsigned short &  Obj  ) 
 

template<>
PGSTD::string ToString const short &  Obj  ) 
 

template<>
PGSTD::string ToString const bool &  Obj  ) 
 

template<>
PGSTD::string ToString const unsigned char *const &  Obj  ) 
 

template<>
PGSTD::string ToString char *const &  Obj  ) 
 

template<>
PGSTD::string ToString const char *const &  Obj  ) 
 

template<>
PGSTD::string ToString const PGSTD::string &  Obj  ) 
 

template<typename T>
PGSTD::string ToString const T &  Obj  ) 
 

Convert object of built-in type to string.

Caution: the conversion is done using the currently active locale, whereas PostgreSQL expects values in the "default" (C) locale. This means that if you intend to use this function from a locale that renders the data types in question (particularly numeric types like float and int) differently from the C default, you'll need to switch back to the C locale before the call. This should be fixed at some point in the future.

string pqxx::UniqueRegisterError const void *  New,
const void *  Old,
const PGSTD::string &  ClassName,
const PGSTD::string &  NewName
 

For libpqxx internal use only: compose error message.

string pqxx::UniqueUnregisterError const void *  New,
const void *  Old,
const PGSTD::string &  ClassName,
const PGSTD::string &  NewName,
const PGSTD::string &  OldName
 

For libpqxx internal use only: compose error message.


Variable Documentation

const oid pqxx::oid_none = InvalidOid
 

The "null" oid.


Generated on Fri Nov 14 19:37:18 2003 for libpqxx by doxygen 1.3.4