db_bridge/include/postgresql_db.h
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:49:11 +0200
changeset 40 be3f5582b839
parent 34 4a35f239fe5b
permissions -rw-r--r--
db_bridge: * libstdc++ for g++-4.3: * cstdlib for getenv and friends... committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
/**
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
 * db_bridge/include/postgresql_db.h
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
 * Copyright 2008 (C) Markus Broeker
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#ifndef POSTGRESQL_DB_H
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
#define POSTGRESQL_DB_H
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
#include <iostream>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
#include <abstract_db.h>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
#include <postgresql/libpq-fe.h>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
class PostgreSQL_DB:public Abstract_DB {
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
  private:
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
    PGconn * conn;
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
    PGresult *res;
34
4a35f239fe5b the good, old programming error:
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 14
diff changeset
    18
    std::string conninfo;
12
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
  public:
34
4a35f239fe5b the good, old programming error:
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 14
diff changeset
    21
    PostgreSQL_DB (std::string, std::string, std::string, std::string);
4a35f239fe5b the good, old programming error:
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 14
diff changeset
    22
    virtual ~ PostgreSQL_DB ();
4a35f239fe5b the good, old programming error:
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 14
diff changeset
    23
    bool connect ();
4a35f239fe5b the good, old programming error:
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 14
diff changeset
    24
    Abstract_DB::DB_RESULT query (std::string);
12
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
};
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
#endif