File: spgsql.hh

package info (click to toggle)
pdns 3.1-4.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,356 kB
  • sloc: cpp: 42,003; ansic: 22,326; sh: 18,273; sql: 618; makefile: 590; yacc: 222; lex: 133; perl: 52
file content (35 lines) | stat: -rw-r--r-- 933 bytes parent folder | download | duplicates (2)
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
/* Copyright 2001 - 2005 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
   for more information. */
#ifndef SPGSQL_HH
#define SPGSQL_HH
#include "pdns/namespaces.hh"
#include "pdns/backends/gsql/ssql.hh"

#include <libpq-fe.h>
class SPgSQL : public SSql
{
public:
  SPgSQL(const string &database, const string &host="", const string& port="",
         const string &msocket="",const string &user="", 
         const string &password="");

  ~SPgSQL();
  
  SSqlException sPerrorException(const string &reason);
  int doQuery(const string &query, result_t &result);
  int doQuery(const string &query);
  int doCommand(const string &query);
  bool getRow(row_t &row);
  string escape(const string &str);    
  void setLog(bool state);
private:
  void ensureConnect();
  PGconn* d_db; 
  string d_connectstr;
  string d_connectlogstr;
  PGresult* d_result;
  int d_count;
  static bool s_dolog;
};
      
#endif /* SPGSQL_HH */