LiteSQL 0.3.10
postgresql.hpp
Go to the documentation of this file.
1/* LiteSQL
2 *
3 * The list of contributors at http://litesql.sf.net/
4 *
5 * See LICENSE for copyright information. */
6
9#ifndef _litesql_postgresql_hpp
10#define _litesql_postgresql_hpp
11#ifdef HAVE_LIBPQ
12#include "libpq-fe.h"
13#include "litesql/except.hpp"
14#include "litesql/types.hpp"
15#include "litesql/string.hpp"
16#include "litesql/backend.hpp"
17
18#include <string>
19namespace litesql {
20using namespace std;
22class PostgreSQL : public Backend {
23 PGconn *conn;
24 mutable bool transaction;
25public:
27 class Result : public Backend::Result {
28 PGresult *res;
29 public:
30 Result(PGresult * r) : res(r) {}
31 virtual ~Result();
32 virtual size_t fieldNum() const;
33 virtual Record fields() const;
34 virtual size_t recordNum() const;
35 virtual Records records() const;
36 };
40 class Cursor : public Backend::Cursor {
41 const PostgreSQL& pq;
42 static int sid;
43 static size_t cacheSize;
44 string name;
45 Records cache;
46 size_t cachePos;
47 public:
48 virtual void setCacheSize(int v);
49 Cursor(const PostgreSQL& p, string q);
50 virtual Record fetchOne();
51 virtual ~Cursor();
52 };
53 PostgreSQL(const string& connInfo);
54 virtual bool supportsSequences() const;
55 virtual void begin() const;
56 virtual void commit() const;
57 virtual void rollback() const;
58 Backend::Result* execute(const string& query) const;
59 Backend::Cursor* cursor(const string& query) const;
60 virtual ~PostgreSQL();
61};
62}
63#endif
64#endif
Classes Backend, Backend::Cursor and Backend::Result.
An abstract base class for interfacing with relational databases.
Definition backend.hpp:19
contains litesql's exception classes
helpful string utils
contains class Record and typedef Records
std::vector< Record > Records
shortcut
Definition types.hpp:26

SourceForge.net Logo