Namespaces | Data Structures | Functions
psql Namespace Reference

Namespaces

namespace  cptypes

Data Structures

class  BindTypes
class  BindTypes< Head, Tail...>
class  BindTypes<>
class  CopyTypes
class  ICursor
class  Cursor
 Represents a server side cursor. More...
class  Database
 Represents a connection to PostgreSQL database. More...
class  PgSqlException
 Exceptions of this type are thrown from inside the psql namespace to indicate problem with database interface. More...
class  PqTypeWrap
class  PqTypeWrap< double >
class  PqTypeWrap< int >
class  PqTypeWrap< int64_t >
class  PqTypeWrap< std::vector< char > >
class  PqTypeWrap< std::string >
class  RetTypes
class  RetTypes< Head, Tail...>
class  RetTypes<>
class  IStatement
class  Statement
 Class representing an executable sql statement. More...

Functions

template<typename BTypes , typename RTypes >
Cursor< BTypes, RTypes > make_cursor (Database &db, std::string const &name, Statement< BTypes, RTypes > const &st)
 Crates a cursor from a statement.
void noticeReceiver (void *arg, const PGresult *res)
void zero_get_check (int i)
void zero_put_check (int i)
void execute_sql (Database &db, std::string const &sql)
 Utility function which constructs a Statement with no arguments and executes it.
template<typename... Types>
std::vector< std::tuple
< Types...> > 
query_sql (Database &db, std::string const &sql)
template<typename... BTypes, typename... RTypes>
std::vector< std::tuple
< RTypes...> > 
exec_statement (psql::Statement< psql::BindTypes< BTypes...>, psql::RetTypes< RTypes...> > &st, BTypes...bvs)
 Wrapper which calls execute on a Statement and aggregates rows into a std::vector.
template<unsigned int Col = 0, typename... BTypes, typename... RTypes>
auto exec_statement_col (psql::Statement< psql::BindTypes< BTypes...>, psql::RetTypes< RTypes...> > &st, BTypes...bvs)-> std
 Wrapper which extracts a column from Statement results.
template<>
PGresult * execBT< BindTypes<> > (PGconn *conn, PGparam *, std::string const &sql)
template<>
PGresult * execPrepBT< BindTypes<> > (PGconn *conn, PGparam *, std::string const &name)
template<typename BindTypes >
PGresult * execBT (PGconn *conn, PGparam *param, std::string const &sql)
template<typename BindTypes >
PGresult * execPrepBT (PGconn *conn, PGparam *param, std::string const &name)

Function Documentation

template<typename... BTypes, typename... RTypes>
std::vector<std::tuple<RTypes...> > psql::exec_statement ( psql::Statement< psql::BindTypes< BTypes...>, psql::RetTypes< RTypes...> > &  st,
BTypes...  bvs 
)

Wrapper which calls execute on a Statement and aggregates rows into a std::vector.

Parameters:
ststatement to execute
bvsarguments to supply to execute
Returns:
std::vector of rows

Definition at line 42 of file psql.h.

template<unsigned int Col = 0, typename... BTypes, typename... RTypes>
auto psql::exec_statement_col ( psql::Statement< psql::BindTypes< BTypes...>, psql::RetTypes< RTypes...> > &  st,
BTypes...  bvs 
)

Wrapper which extracts a column from Statement results.

Parameters:
st
bvs
Returns:
vector of values in column Col after executing statement st with parameters bvs

Definition at line 61 of file psql.h.

template<typename BindTypes >
PGresult* psql::execBT ( PGconn *  conn,
PGparam *  param,
std::string const &  sql 
)

Definition at line 20 of file Statement.h.

template<>
PGresult * psql::execBT< BindTypes<> > ( PGconn *  conn,
PGparam *  ,
std::string const &  sql 
)

Definition at line 7 of file Statement.cpp.

template<typename BindTypes >
PGresult* psql::execPrepBT ( PGconn *  conn,
PGparam *  param,
std::string const &  name 
)

Definition at line 32 of file Statement.h.

template<>
PGresult * psql::execPrepBT< BindTypes<> > ( PGconn *  conn,
PGparam *  ,
std::string const &  name 
)

Definition at line 18 of file Statement.cpp.

void psql::execute_sql ( Database &  db,
std::string const &  sql 
)

Utility function which constructs a Statement with no arguments and executes it.

Parameters:
dbdatabase connection to use
sqlsql query to execute

Definition at line 15 of file psql.cpp.

template<typename BTypes , typename RTypes >
Cursor<BTypes, RTypes> psql::make_cursor ( Database &  db,
std::string const &  name,
Statement< BTypes, RTypes > const &  st 
)

Crates a cursor from a statement.

This is a utility function which saves you from specifying BTypes and RTypes to Cursor constructor.

Parameters:
dbdatabase connection
namecursor name
ststatement
Returns:
Cursor for st

Definition at line 151 of file Cursor.h.

void psql::noticeReceiver ( void *  arg,
const PGresult *  res 
)

Definition at line 89 of file Database.cpp.

template<typename... Types>
std::vector<std::tuple<Types...> > psql::query_sql ( Database &  db,
std::string const &  sql 
)

Definition at line 23 of file psql.h.

void psql::zero_get_check ( int  i)

Definition at line 14 of file PqTypeWrap.cpp.

void psql::zero_put_check ( int  i)

Definition at line 20 of file PqTypeWrap.cpp.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines