File: spgsql.hh

package info (click to toggle)
pdns 3.4.1-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 9,084 kB
  • sloc: cpp: 56,420; ansic: 37,838; sh: 12,762; sql: 1,081; makefile: 734; ruby: 560; yacc: 222; lex: 120; perl: 52; python: 15
file content (34 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (5)
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
/* 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 &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 */