Wt  3.3.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions
Wt::Dbo::backend::Postgres Class Reference

A PostgreSQL connection. More...

#include <Wt/Dbo/backend/Postgres>

Inheritance diagram for Wt::Dbo::backend::Postgres:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Postgres ()
 Creates new PostgreSQL backend connection.
 Postgres (const std::string &db)
 Opens a new PostgreSQL backend connection.
 Postgres (const Postgres &other)
 Copies a PostgreSQL connection.
 ~Postgres ()
 Destructor.
virtual Postgresclone () const
 Clones the connection.
bool connect (const std::string &db)
 Tries to connect.
PGconn * connection ()
 Returns the underlying connection.
virtual void executeSql (const std::string &sql)
 Executes an SQL statement.
virtual void startTransaction ()
 Starts a transaction.
virtual void commitTransaction ()
 Commits a transaction.
virtual void rollbackTransaction ()
 Rolls back a transaction.
virtual SqlStatementprepareStatement (const std::string &sql)
 Prepares a statement.
Methods that return dialect information
virtual std::string autoincrementSql () const
 Returns the 'autoincrement' SQL type modifier.
virtual std::vector< std::string > autoincrementCreateSequenceSql (const std::string &table, const std::string &id) const
 Returns the SQL statement(s) required to create an id sequence.
virtual std::vector< std::string > autoincrementDropSequenceSql (const std::string &table, const std::string &id) const
 Returns the SQL statement(s) required to drop an id sequence.
virtual std::string autoincrementType () const
 Returns the 'autoincrement' SQL type.
virtual std::string autoincrementInsertSuffix (const std::string &id) const
 Returns the suffix for an 'autoincrement' insert statement.
virtual const char * dateTimeType (SqlDateTimeType type) const
 Returns the date/time type.
virtual const char * blobType () const
 Returns the blob type.
virtual bool supportAlterTable () const
 Returns true if the backend support Alter Table.
virtual bool supportDeferrableFKConstraint () const
 Returns true if the backend supports "deferrable initially deferred" foreign key constraints.
virtual bool requireSubqueryAlias () const
 Returns the true if the database require subquery alias.

Detailed Description

A PostgreSQL connection.

This class provides the backend implementation for PostgreSQL databases.

When applicable, exceptions from the backend will return the five-character SQLSTATE error codes, as in http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html, in Exception::code().


Constructor & Destructor Documentation

Creates new PostgreSQL backend connection.

The connection is not yet open, and requires a connect() before it can be used.

Wt::Dbo::backend::Postgres::Postgres ( const std::string &  db)

Opens a new PostgreSQL backend connection.

The db may be any of the values supported by PQconnectdb().

Copies a PostgreSQL connection.

This creates a new connection with the same settings as another connection.

See also:
clone()

Destructor.

Closes the connection.


Member Function Documentation

std::vector< std::string > Wt::Dbo::backend::Postgres::autoincrementCreateSequenceSql ( const std::string &  table,
const std::string &  id 
) const [virtual]

Returns the SQL statement(s) required to create an id sequence.

This is used by Session::createTables() to create the id sequence for a table. The table's name and primary key are passed as arguments to this function and can be used to construct an SQL sequence that is unique for the table.

Implements Wt::Dbo::SqlConnection.

std::vector< std::string > Wt::Dbo::backend::Postgres::autoincrementDropSequenceSql ( const std::string &  table,
const std::string &  id 
) const [virtual]

Returns the SQL statement(s) required to drop an id sequence.

This is used by Session::dropTables() to drop the id sequence for a table. The table's name and primary key are passed as arguments to this function and can be used to construct an SQL sequence that is unique for the table.

Implements Wt::Dbo::SqlConnection.

std::string Wt::Dbo::backend::Postgres::autoincrementInsertSuffix ( const std::string &  id) const [virtual]

Returns the suffix for an 'autoincrement' insert statement.

This is appended to the insert statement, since some back-ends need to be indicated that they should return the autoincrement id.

Implements Wt::Dbo::SqlConnection.

std::string Wt::Dbo::backend::Postgres::autoincrementSql ( ) const [virtual]

Returns the 'autoincrement' SQL type modifier.

This is used by Session::createTables() to create the id column.

Implements Wt::Dbo::SqlConnection.

std::string Wt::Dbo::backend::Postgres::autoincrementType ( ) const [virtual]

Returns the 'autoincrement' SQL type.

This is used by Session::createTables() to create the id column.

Implements Wt::Dbo::SqlConnection.

const char * Wt::Dbo::backend::Postgres::blobType ( ) const [virtual]

Clones the connection.

Returns a new connection object that is configured like this object. This is used by connection pool implementations to create its connections.

Implements Wt::Dbo::SqlConnection.

Commits a transaction.

This function commits a transaction.

Implements Wt::Dbo::SqlConnection.

bool Wt::Dbo::backend::Postgres::connect ( const std::string &  db)

Tries to connect.

Throws an exception if there was a problem, otherwise true. An example connecion string could be: "host=127.0.0.1 user=test password=test port=5432 dbname=test"

const char * Wt::Dbo::backend::Postgres::dateTimeType ( SqlDateTimeType  type) const [virtual]
void Wt::Dbo::backend::Postgres::executeSql ( const std::string &  sql) [virtual]

Executes an SQL statement.

This is a convenience method for preparing a statement, executing it, and deleting it.

Reimplemented from Wt::Dbo::SqlConnection.

SqlStatement * Wt::Dbo::backend::Postgres::prepareStatement ( const std::string &  sql) [virtual]

Prepares a statement.

Returns the prepared statement.

Implements Wt::Dbo::SqlConnection.

Returns the true if the database require subquery alias.

This method will return false by default.

Reimplemented from Wt::Dbo::SqlConnection.

Rolls back a transaction.

This function rolls back a transaction.

Implements Wt::Dbo::SqlConnection.

Starts a transaction.

This function starts a transaction.

Implements Wt::Dbo::SqlConnection.

Returns true if the backend support Alter Table.

This method will return false by default.

Reimplemented from Wt::Dbo::SqlConnection.

Returns true if the backend supports "deferrable initially deferred" foreign key constraints.

This method will return false by default.

Reimplemented from Wt::Dbo::SqlConnection.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Tue Mar 22 2016 for the C++ Web Toolkit (Wt) by doxygen 1.7.6.1