]> granicus.if.org Git - pdns/commitdiff
don't try this at home
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 19 Dec 2002 16:28:31 +0000 (16:28 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 19 Dec 2002 16:28:31 +0000 (16:28 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@88 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/gmysqlbackend/Makefile.am
modules/gmysqlbackend/Makefile.in
modules/gmysqlbackend/gmysqlbackend.hh
modules/gmysqlbackend/smysql.hh
modules/gmysqlbackend/spgsql.cc [deleted file]
modules/gmysqlbackend/spgsql.hh [deleted file]
modules/gmysqlbackend/ssql.hh [deleted file]

index c7fb489883e1c961bef0627cf87f69873c212010..e750045dfdf30dc3b5ea35e2cc290b43fb1d4a48 100644 (file)
@@ -1,5 +1,7 @@
 lib_LTLIBRARIES = libgmysqlbackend.la
 
+EXTRA_DIST=OBJECTFILES OBJECTLIBS
+
 INCLUDES=-I@MYSQL_incdir@
 
 libgmysqlbackend_la_SOURCES=gmysqlbackend.cc gmysqlbackend.hh \
index 875e01758bc47ecb2cf53789d2136ee170754fb9..0080470278f62642e699d0b9b8853c29ae9ae3b1 100644 (file)
@@ -85,16 +85,17 @@ VERSION = @VERSION@
 YACC = @YACC@
 am__include = @am__include@
 am__quote = @am__quote@
-domysql = @domysql@
-dopgsql = @dopgsql@
 install_sh = @install_sh@
 moduledirs = @moduledirs@
 modulelibs = @modulelibs@
 moduleobjects = @moduleobjects@
+programdescend = @programdescend@
 socketdir = @socketdir@
 
 lib_LTLIBRARIES = libgmysqlbackend.la
 
+EXTRA_DIST = OBJECTFILES OBJECTLIBS
+
 INCLUDES = -I@MYSQL_incdir@
 
 libgmysqlbackend_la_SOURCES = gmysqlbackend.cc gmysqlbackend.hh \
index f1af22368949697bc08e337ab29ebdb37402548e..d30999eaea8bd8b256230767de1ce6bd3e4eddb5 100644 (file)
@@ -1,6 +1,6 @@
 #include <string>
 #include <map>
-#include "ssql.hh"
+
 #include "pdns/backends/gsql/gsqlbackend.hh"
 
 using namespace std;
index 9ceacd02fa9cdbf69ce29082f721e9162f326b8c..30c4ad7758dde5235bf1aad312142a24562efe30 100644 (file)
@@ -1,11 +1,11 @@
 /* Copyright 2001 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
    for more information.
-   $Id: smysql.hh,v 1.2 2002/11/29 15:20:08 ahu Exp $  */
+   $Id: smysql.hh,v 1.3 2002/12/19 16:28:31 ahu Exp $  */
 #ifndef SMYSQL_HH
 #define SMYSQL_HH
 
 #include <mysql.h>
-#include "ssql.hh"
+#include "pdns/backends/gsql/ssql.hh"
 
 class SMySQL : public SSql
 {
diff --git a/modules/gmysqlbackend/spgsql.cc b/modules/gmysqlbackend/spgsql.cc
deleted file mode 100644 (file)
index fe06175..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright 200w Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
-   for more information.
-   $Id: spgsql.cc,v 1.2 2002/12/16 18:02:24 ahu Exp $  */
-#include "spgsql.hh"
-#include <string>
-#include <iostream>
-#include "pdns/logger.hh"
-#include "pdns/dns.hh"
-using namespace std;
-
-bool SPgSQL::s_dolog;
-
-SPgSQL::SPgSQL(const string &database, const string &host, const string &msocket, const string &user, 
-              const string &password)
-{
-  string connectstr;
-
-  connectstr="dbname=";
-  connectstr+=database;
-  connectstr+=" user=";
-  connectstr+=user;
-
-  if(!host.empty())
-    connectstr+=" host="+host;
-
-  if(!password.empty())
-    connectstr+=" password="+password;
-
-  d_db=new PgDatabase(connectstr.c_str());
-  
-  // Check to see that the backend connection was successfully made
-  if (d_db->ConnectionBad() ) {
-    throw sPerrorException("Unable to connect to database");
-  }
-
-}
-
-void SPgSQL::setLog(bool state)
-{
-  s_dolog=state;
-}
-
-SPgSQL::~SPgSQL()
-{
-  delete d_db;
-}
-
-SSqlException SPgSQL::sPerrorException(const string &reason)
-{
-  return SSqlException(reason+string(": ")+d_db->ErrorMessage());
-}
-
-int SPgSQL::doQuery(const string &query)
-{
-  if(s_dolog)
-    L<<Logger::Warning<<"Query: "<<query<<endl;
-
-  if(!d_db->Exec(query.c_str())) {
-    throw sPerrorException("PostgreSQL failed to execute command");
-  }
-  d_count=0;
-  return 0;
-}
-
-int SPgSQL::doQuery(const string &query, result_t &result)
-{
-  result.clear();
-  if(s_dolog)
-    L<<Logger::Warning<<"Query: "<<query<<endl;
-
-  if(!d_db->ExecTuplesOk(query.c_str()))
-    throw sPerrorException("gPgSQLBackend failed to execute command that expected results");
-  d_count=0;
-
-  row_t row;
-  while(getRow(row))
-    result.push_back(row);
-
-  return result.size();
-}
-
-bool SPgSQL::getRow(row_t &row)
-{
-  row.clear();
-  if(d_count>=d_db->Tuples())
-    return false;
-  
-  for(int i=0;i<d_db->Fields();i++)
-    row.push_back(d_db->GetValue(d_count,i) ?: "");
-  d_count++;
-  return true;
-}
-
-string SPgSQL::escape(const string &name)
-{
-  string a;
-
-  for(string::const_iterator i=name.begin();i!=name.end();++i) {
-    if(*i=='\'' || *i=='\\')
-      a+='\\';
-    a+=*i;
-  }
-  return a;
-}
diff --git a/modules/gmysqlbackend/spgsql.hh b/modules/gmysqlbackend/spgsql.hh
deleted file mode 100644 (file)
index b9d8d17..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2001 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
-   for more information.
-   $Id: spgsql.hh,v 1.1 2002/11/27 15:23:16 ahu Exp $  */
-#ifndef SPGSQL_HH
-#define SPGSQL_HH
-#include <libpq++.h>
-#include "ssql.hh"
-
-class SPgSQL : public SSql
-{
-public:
-  SPgSQL(const string &database, const string &host="", 
-        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);
-  bool getRow(row_t &row);
-  string escape(const string &str);    
-  void setLog(bool state);
-private:
-  PgDatabase *d_db; 
-  int d_count;
-  static bool s_dolog;
-};
-      
-#endif /* SPGSQL_HH */
diff --git a/modules/gmysqlbackend/ssql.hh b/modules/gmysqlbackend/ssql.hh
deleted file mode 100644 (file)
index 9837466..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright 2001 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE 
-   for more information.
-   $Id: ssql.hh,v 1.1 2002/11/27 15:23:16 ahu Exp $  */
-#ifndef SSQL_HH
-#define SSQL_HH
-
-#include <string>
-#include <vector>
-using namespace std;
-
-
-class SSqlException 
-{
-public: 
-  SSqlException(const string &reason) 
-  {
-      d_reason=reason;
-  }
-  
-  string txtReason()
-  {
-    return d_reason;
-  }
-private:
-  string d_reason;
-};
-
-class SSql
-{
-public:
-  typedef vector<string> row_t;
-  typedef vector<row_t> result_t;
-  virtual SSqlException sPerrorException(const string &reason)=0;
-  virtual int doQuery(const string &query, result_t &result)=0;
-  virtual int doQuery(const string &query)=0;
-  virtual bool getRow(row_t &row)=0;
-  virtual string escape(const string &name)=0;
-  virtual void setLog(bool state){}
-  virtual ~SSql(){};
-};
-
-#endif /* SSQL_HH */