/usr/include/Wt/Dbo/backend/Postgres is in libwtdbo-dev 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*
* Contributed by: Hilary Cheng
*/
#ifndef WT_DBO_BACKEND_POSTGRES_H_
#define WT_DBO_BACKEND_POSTGRES_H_
#include <Wt/Dbo/SqlConnection>
#include <Wt/Dbo/SqlStatement>
#include <Wt/Dbo/backend/WDboPostgresDllDefs.h>
struct pg_conn;
typedef struct pg_conn PGconn;
namespace Wt {
namespace Dbo {
namespace backend {
/*! \class Postgres Wt/Dbo/backend/Postgres Wt/Dbo/backend/Postgres
* \brief 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().
*
* \ingroup dbo
*/
class WTDBOPOSTGRES_API Postgres : public SqlConnection
{
public:
/*! \brief Creates new PostgreSQL backend connection.
*
* The connection is not yet open, and requires a connect() before it
* can be used.
*/
Postgres();
/*! \brief Opens a new PostgreSQL backend connection.
*
* The \p db may be any of the values supported by PQconnectdb().
*/
Postgres(const std::string& db);
/*! \brief Copies a PostgreSQL connection.
*
* This creates a new connection with the same settings as another
* connection.
*
* \sa clone()
*/
Postgres(const Postgres& other);
/*! \brief Destructor.
*
* Closes the connection.
*/
~Postgres();
virtual Postgres *clone() const;
/*! \brief 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"
*/
bool connect(const std::string& db);
/*! \brief Returns the underlying connection.
*/
PGconn *connection() { return conn_; }
virtual void executeSql(const std::string &sql);
virtual void startTransaction();
virtual void commitTransaction();
virtual void rollbackTransaction();
virtual SqlStatement *prepareStatement(const std::string& sql);
/** @name Methods that return dialect information
*/
//@{
virtual std::string autoincrementSql() const;
virtual std::vector<std::string>
autoincrementCreateSequenceSql(const std::string &table,
const std::string &id) const;
virtual std::vector<std::string>
autoincrementDropSequenceSql(const std::string &table,
const std::string &id) const;
virtual std::string autoincrementType() const;
virtual std::string autoincrementInsertSuffix() const;
virtual const char *dateTimeType(SqlDateTimeType type) const;
virtual const char *blobType() const;
virtual bool supportAlterTable() const;
//@}
private:
std::string connInfo_;
PGconn *conn_;
};
}
}
}
#endif // WT_DBO_BACKEND_POSTGRES_H_
|