pg_async
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
common.hpp File Reference
#include <string>
#include <iosfwd>
#include <vector>
#include <functional>
#include <memory>
#include <map>
#include <boost/integer.hpp>
#include <boost/optional.hpp>
#include <tip/util/streambuf.hpp>
#include <tip/db/pg/pg_types.hpp>
Include dependency graph for common.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tip::db::pg::bytea
 Binary data, matches PostgreSQL bytea type. More...
 
struct  tip::db::pg::dbalias
 Short unique string to refer a database. Signature structure, to pass instead of connection string. More...
 
struct  tip::db::pg::connection_options
 Postgre connection options. More...
 
struct  tip::db::pg::field_description
 Description of a field returned by the backend. More...
 

Namespaces

 tip
 
 tip::db
 
 tip::db::pg
 
 tip::db::pg::error
 
 tip::db::pg::options
 

Typedefs

typedef boost::int_t< 16 >::exact tip::db::pg::smallint
 2-byte integer, to match PostgreSQL smallint and smallserial types More...
 
typedef boost::uint_t< 16 >::exact tip::db::pg::usmallint
 2-byte unsigned integer More...
 
typedef boost::int_t< 32 >::exact tip::db::pg::integer
 4-byte integer, to match PostgreSQL integer and serial types More...
 
typedef boost::uint_t< 32 >::exact tip::db::pg::uinteger
 4-byte unsigned integer More...
 
typedef boost::int_t< 64 >::exact tip::db::pg::bigint
 8-byte integer, to match PostgreSQL bigint and bigserial types More...
 
typedef boost::uint_t< 64 >::exact tip::db::pg::ubigint
 8-byte unsigned integer More...
 
typedef char tip::db::pg::byte
 1-byte char or byte type. More...
 
template<typename T >
using tip::db::pg::nullable = boost::optional< T >
 Nullable data type. More...
 
typedef
tip::util::input_iterator_buffer 
tip::db::pg::field_buffer
 
typedef std::vector
< field_description > 
tip::db::pg::row_description_type
 Result set's row description. More...
 
typedef std::map< std::string,
std::string > 
tip::db::pg::client_options_type
 
typedef std::vector
< oids::type::oid_type > 
tip::db::pg::type_oid_sequence
 
typedef std::function< void() > tip::db::pg::simple_callback
 
typedef std::function< void(error::db_error
const &) > 
tip::db::pg::error_callback
 Callback for error handling. More...
 
typedef std::function< void(transaction_ptr) > tip::db::pg::transaction_callback
 Callback for starting a transaction. More...
 
typedef std::function< void(transaction_ptr,
resultset, bool) > 
tip::db::pg::query_result_callback
 Callback for query results. More...
 
typedef std::function< void(error::query_error
const &) > 
tip::db::pg::query_error_callback
 Callback for a query error. More...
 
Pointer types
typedef std::shared_ptr
< transaction > 
tip::db::pg::transaction_ptr
 
typedef std::shared_ptr
< basic_connection > 
tip::db::pg::connection_ptr
 

Enumerations

enum  tip::db::pg::protocol_data_format { tip::db::pg::TEXT_DATA_FORMAT = 0, tip::db::pg::BINARY_DATA_FORMAT = 1 }
 

Functions

bool tip::db::pg::operator== (dbalias const &lhs, std::string const &rhs)
 
std::ostream & tip::db::pg::operator<< (std::ostream &out, dbalias const &)
 
tip::db::pg::dbalias operator""_db (const char *, size_t n)
 
tip::db::pg::connection_options operator""_pg (const char *, size_t)
 

Variables

const integer tip::db::pg::PROTOCOL_VERSION = (3 << 16)
 PostgreSQL protocol version. More...
 
const std::string tip::db::pg::options::HOST = "host"
 
const std::string tip::db::pg::options::PORT = "port"
 
const std::string tip::db::pg::options::USER = "user"
 
const std::string tip::db::pg::options::DATABASE = "database"
 
const std::string tip::db::pg::options::CLIENT_ENCODING = "client_encoding"
 
const std::string tip::db::pg::options::APPLICATION_NAME = "application_name"
 

Detailed Description

Date
Jul 11, 2015
Author
zmij

Definition in file common.hpp.

Function Documentation

tip::db::pg::dbalias operator""_db ( const char *  ,
size_t  n 
)
tip::db::pg::connection_options operator""_pg ( const char *  ,
size_t   
)

User-defined literal for a PostgreSQL connection string

// Full options for a TCP connection
connection_options opts = "aliasname=tcp://user:password@localhost:5432[database]"_pg;
// SSL connection over TCP
opts = "ssl://localhost:5432[database]"_pg;
// Connection via UNIX socket
opts = "socket:///tmp/.s.PGSQL.5432[database]"_pg;