db_bridge/include/postgresql_db.h
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 17:58:05 +0100
changeset 12 9f0ce4eaa1ce
child 14 862d63715611
permissions -rw-r--r--
I added a small db_bridge to the repository 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 <cstdlib>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
#include <iostream>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
#include <abstract_db.h>
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
#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
    14
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
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
    16
  private:
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
    PGconn * conn;
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
    PGresult *res;
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
      std::string conninfo;
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
  public:
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
      PostgreSQL_DB (std::string, std::string, std::string, std::string);
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    23
      virtual ~ PostgreSQL_DB ();
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    24
      bool connect ();
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    25
      std::vector < std::vector <std::string> >query (std::string);
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    26
};
9f0ce4eaa1ce I added a small db_bridge to the repository
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    27
#endif