]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
remove db2 backend from build tree 1975/head
authorKees Monshouwer <mind04@monshouwer.org>
Thu, 27 Nov 2014 22:21:15 +0000 (23:21 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 21 Dec 2014 21:58:40 +0000 (22:58 +0100)
15 files changed:
configure.ac
modules/Makefile.am
modules/db2backend/.gitignore [deleted file]
modules/db2backend/DB2Backend.cc [deleted file]
modules/db2backend/DB2Backend.hh [deleted file]
modules/db2backend/DB2Exception.cc [deleted file]
modules/db2backend/DB2Exception.hh [deleted file]
modules/db2backend/Makefile.am [deleted file]
modules/db2backend/OBJECTFILES [deleted file]
modules/db2backend/OBJECTLIBS [deleted file]
pdns/docs/markdown/authoritative/backend-db2.md [deleted file]
pdns/docs/markdown/authoritative/backend-deprecated.md
pdns/docs/markdown/authoritative/index.md
pdns/docs/markdown/changelog.md
pdns/docs/mkdocs.yml

index c399645d95b006c46bcc821f471fc55585cf57a3..e98bf51c405466901ebb4df9e3c5215ef38ee09f 100644 (file)
@@ -356,7 +356,6 @@ AC_CONFIG_FILES([
   pdns/ext/polarssl/library/Makefile
   pdns/ext/rapidjson/Makefile
   modules/bindbackend/Makefile
-  modules/db2backend/Makefile
   modules/geobackend/Makefile
   modules/geoipbackend/Makefile
   modules/gmysqlbackend/Makefile
index d800244be6b03706de0d56e9505481b2caf770e3..4ea9ea4a9ae3e37ee8e107215d479f5255965440 100644 (file)
@@ -2,7 +2,6 @@ SUBDIRS= @moduledirs@
 
 DIST_SUBDIRS = \
        bindbackend \
-       db2backend \
        geobackend \
        geoipbackend \
        gmysqlbackend \
diff --git a/modules/db2backend/.gitignore b/modules/db2backend/.gitignore
deleted file mode 100644 (file)
index 9ee6454..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/Makefile.in
-/Makefile
diff --git a/modules/db2backend/DB2Backend.cc b/modules/db2backend/DB2Backend.cc
deleted file mode 100644 (file)
index 5e1d2cc..0000000
+++ /dev/null
@@ -1,623 +0,0 @@
-// $Id$
-
-#include <string>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sstream>
-
-#include "pdns/namespaces.hh"
-
-#include "pdns/dns.hh"
-#include "pdns/dnsbackend.hh"
-#include "pdns/dnspacket.hh"
-#include "pdns/ueberbackend.hh"
-#include "pdns/pdnsexception.hh"
-#include "pdns/logger.hh"
-#include "pdns/arguments.hh"
-
-#include "DB2Exception.hh"
-#include "DB2Backend.hh"
-
-static const string kBackendName="[DB2Backend]";
-
-static const int kForwardQuery            = 0;
-static const int kForwardByZoneQuery      = 1;
-static const int kForwardAnyQuery         = 2;
-static const int kForwardWildcardQuery    = 3;
-static const int kForwardWildcardAnyQuery = 4;
-
-static const int kListQuery               = 5;
-      
-static const int kNumQueries              = 6;
-
-static const char *kQueries[kNumQueries] =
-{
-   // ForwardQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and type = ?",
-   
-   // ForwardByZoneQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and Type = ? and ZoneId = ?",
-         
-   // ForwardAnyQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ?",
-   
-   // ForwardWildcardQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name like ? and Type = ?",
-   
-   // ForwardWildcardAnyQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name like ?",
-   
-   // ListQuery
-   "select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where ZoneId = ?"
-};
-
-static const char *kSoaQuery = "select Id,Hostmaster,Serial from Zones where Active = 1 and Name = ?";
-
-DB2Backend::DB2Backend(const string &suffix)
-{
-   SQLRETURN theError;
-
-   // Initialize the handles
-   mConnection = SQL_NULL_HANDLE;
-   mEnvironment = SQL_NULL_HANDLE;
-   for (int i = 0; i < kNumQueries; i++) {
-      mStatements[i] = SQL_NULL_HANDLE;
-   }
-
-   try
-   {
-      // Allocate the Environment Handle
-      theError = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &mEnvironment);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError);
-      }
-
-      // Allocate a Connection Handle
-      theError = SQLAllocHandle(SQL_HANDLE_DBC, mEnvironment, &mConnection);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_ENV, mEnvironment);
-      }
-
-      // Try to connect to the database
-      theError = SQLConnect(mConnection, (SQLCHAR*) arg()["db2-"+suffix+"server"].c_str(), SQL_NTS, (SQLCHAR*) arg()["db2-"+suffix+"user"].c_str(), SQL_NTS, (SQLCHAR*) arg()["db2-"+suffix+"password"].c_str(), SQL_NTS);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_DBC, mConnection);
-      }
-
-      // Set autocommit to off
-      theError = SQLSetConnectAttr(mConnection, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_OFF, SQL_NTS);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_DBC, mConnection);
-      }
-
-      // Prepare the statements
-      for (int i = 0; i < kNumQueries; i++)
-      {
-         // Allocate a Statement Handle
-         theError = SQLAllocHandle(SQL_HANDLE_STMT, mConnection, &(mStatements[i]));
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mConnection);
-         }         
-
-         // Prepare the statement
-         theError = SQLPrepare(mStatements[i], (SQLCHAR*) kQueries[i], SQL_NTS);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         //
-         // Bind Parameters
-         //
-
-         // Bind the Name parameter to all queries except the list statements
-         if (i != kListQuery) {
-            theError = SQLBindParameter(mStatements[i], 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 256, 0, mParamName, 256, NULL);
-            if (theError != SQL_SUCCESS) {
-               throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-            }
-         }
-
-         // Bind the Type parameter only to the kForwardQuery, kForwardByZoneQuery and kForwardWildcardQuery statements
-         if (i == kForwardQuery || i == kForwardByZoneQuery || i == kForwardWildcardQuery) {
-            theError = SQLBindParameter(mStatements[i], 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 256, 0, mParamType, 256, NULL);
-            if (theError != SQL_SUCCESS) {
-               throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-            }
-         }
-
-         // Bind the ZoneId parameter for the kForwardByZoneQuery and kListQuery queries
-         if (i == kForwardByZoneQuery || i == kListQuery) {
-            int theIndex = (i == kForwardByZoneQuery) ? 3 : 1;            
-            theError = SQLBindParameter(mStatements[i], theIndex, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &mParamZoneId, 0, NULL);
-            if (theError != SQL_SUCCESS) {
-               throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-            }            
-         }
-
-         //
-         // Bind Columns
-         //
-
-         // Bind the Content column
-         mResultContentIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 1, SQL_C_CHAR, mResultContent, sizeof(mResultContent), &mResultContentIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         // Bind the TimeToLive column
-         mResultTimeToLiveIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 2, SQL_C_LONG, &mResultTimeToLive, sizeof(mResultTimeToLive), &mResultTimeToLiveIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         // Bind the Priority column
-         mResultPriorityIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 3, SQL_C_LONG, &mResultPriority, sizeof(mResultZoneId), &mResultPriorityIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         // Bind the Type column
-         mResultTypeIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 4, SQL_C_CHAR, mResultType, sizeof(mResultType), &mResultTypeIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         // Bind the ZoneId column
-         mResultZoneIdIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 5, SQL_C_LONG, &mResultZoneId, sizeof(mResultZoneId), &mResultZoneIdIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         // Bind the ChangeDate column
-         mResultChangeDateIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 6, SQL_C_LONG, &mResultChangeDate, sizeof(mResultChangeDate), &mResultChangeDateIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-         
-         // Bind the Name column
-         mResultNameIndicator = 0;
-         theError = SQLBindCol(mStatements[i], 7, SQL_C_CHAR, mResultName, sizeof(mResultName), &mResultNameIndicator);
-         if (theError != SQL_SUCCESS) {
-            throw DB2Exception(theError, SQL_HANDLE_DBC, mStatements[i]);
-         }
-
-         mStatementStates[i] = false;
-      }
-
-      //
-      // Construct the SOA Query
-      //
-
-      // Prepare the SOA Query
-      theError = SQLAllocHandle(SQL_HANDLE_STMT, mConnection, &mSoaStatement);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_DBC, mConnection);
-      }
-
-      theError = SQLPrepare(mSoaStatement, (SQLCHAR*) kSoaQuery, SQL_NTS);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }
-
-      // Bind the Name parameter      
-      theError = SQLBindParameter(mSoaStatement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 256, 0, mSoaParamName, 256, NULL);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }
-
-      // Bind the ZoneId column
-      mSoaResultZoneIdIndicator = 0;
-      theError = SQLBindCol(mSoaStatement, 1, SQL_C_LONG, &mSoaResultZoneId, sizeof(mSoaResultZoneId), &mSoaResultZoneIdIndicator);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }      
-
-      // Bind the Hostmaster column
-      mSoaResultHostmasterIndicator = 0;
-      theError = SQLBindCol(mSoaStatement, 2, SQL_C_CHAR, mSoaResultHostmaster, 256, &mSoaResultHostmasterIndicator);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }
-
-      // Bind the Serial column
-      mSoaResultSerialIndicator = 0;
-      theError = SQLBindCol(mSoaStatement, 3, SQL_C_LONG, &mSoaResultSerial, sizeof(mSoaResultSerial), &mSoaResultSerialIndicator);
-      if (theError != SQL_SUCCESS) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }
-   }
-   
-   catch (DB2Exception& theException)
-   {
-      //
-      // Print out diagnostics
-      //
-      
-      int theNativeError;
-      string theSqlState, theSqlMessage;
-      
-      while (theException.GetNextSqlError(theNativeError, theSqlState, theSqlMessage) == true) {
-         L << Logger::Warning << kBackendName << " Statement initialization failed with error " << theNativeError << endl;
-         L << Logger::Warning << kBackendName << "  SQL State : " << theSqlState << endl;
-         L << Logger::Warning << kBackendName << "  SQL Msg   : " << theSqlMessage << endl;
-      }
-      
-      this->Cleanup();
-      throw PDNSException("DB2Backend Failed to Start");
-   }
-   
-   L << Logger::Warning << kBackendName << " Connection succeeded" << endl;
-}
-
-void DB2Backend::Cleanup()
-{
-   for (int i = 0; i < kNumQueries; i++) {
-      if (mStatements[i] != SQL_NULL_HANDLE) {
-         (void) SQLFreeHandle(SQL_HANDLE_STMT, mStatements[i]);
-      }
-   }
-
-   if (mConnection != SQL_NULL_HANDLE) {
-      (void) SQLFreeHandle(SQL_HANDLE_DBC, mConnection);
-   }
-   
-   if (mEnvironment != SQL_NULL_HANDLE) {
-      (void) SQLFreeHandle(SQL_HANDLE_ENV, mEnvironment);
-   }
-}
-
-DB2Backend::~DB2Backend()
-{
-   this->Cleanup();
-}
-
-void DB2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pkt_p, int zoneId )
-{
-   SQLRETURN theError;
-
-   //
-   // Choose the right query. All this logic and the query types could be
-   // moved to the API. Saves duplicate code in backends.
-   //
-
-   int theQueryType = -1;
-
-   if (qname[0] == '%') {
-      if (qtype.getCode() == 255) {
-         theQueryType = kForwardWildcardAnyQuery;
-      } else {
-         theQueryType = kForwardWildcardQuery;
-      }
-   } else {
-      if (qtype.getCode() == 255) {
-         theQueryType = kForwardAnyQuery;
-      } else {
-         if (zoneId != -1) {
-            theQueryType = kForwardByZoneQuery;
-         } else {
-            theQueryType = kForwardQuery;
-         }
-      }
-   }
-   
-   //
-   // Fill in the correct query parameters
-   //
-
-   //cerr << ">>>>>>>> Query = " << kQueries[theQueryType] << endl;
-   
-   switch (theQueryType)
-   {
-      case kForwardQuery:
-      case kForwardWildcardQuery:
-         strncpy(mParamName, qname.c_str(), sizeof(mParamName));
-         strncpy(mParamType, qtype.getName().c_str(), sizeof(mParamType));
-         //cerr << ">>>>>>>>  Name = " << mParamName << " Type = " << mParamType << endl;
-         break;
-
-      case kForwardByZoneQuery:
-         strncpy(mParamName, qname.c_str(), sizeof(mParamName));
-         strncpy(mParamType, qtype.getName().c_str(), sizeof(mParamType));      
-         mParamZoneId = zoneId;
-         //cerr << ">>>>>>>>  Name = " << mParamName << " Type = " << mParamType << " ZoneId = " << mParamZoneId << endl;
-         break;
-
-      case kForwardAnyQuery:
-      case kForwardWildcardAnyQuery:
-         strncpy(mParamName, qname.c_str(), sizeof(mParamName));
-         //cerr << ">>>>>>>>  Name = " << mParamName << endl;
-         break;
-   }
-
-   //
-   // Execute the query
-   //
-
-   try
-   {
-      //
-      // Close the cursor if it is in use
-      //
-
-      if (mStatementStates[theQueryType] == true) {
-         theError = SQLCloseCursor(mStatements[theQueryType]);
-         if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO) {
-            throw DB2Exception(theError, SQL_HANDLE_STMT, mStatements[theQueryType]);
-         }
-      }
-
-      //
-      // Execute the query
-      //
-
-      mResultContent[0] = mResultType[0] = mResultName[0] = 0x00;
-      mResultTimeToLive = mResultPriority = mResultZoneId = mResultChangeDate = 0;
-      
-      theError = SQLExecute(mStatements[theQueryType]);
-      if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO && theError != SQL_NO_DATA_FOUND) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mStatements[theQueryType]);
-      }
-
-      mCurrentStatement = mStatements[theQueryType];
-      mStatementStates[theQueryType] = true;
-   }
-   
-   catch (DB2Exception& theException)
-   {
-      //
-      // Print out diagnostics
-      //
-      
-      int theNativeError;
-      string theSqlState, theSqlMessage;
-      
-      while (theException.GetNextSqlError(theNativeError, theSqlState, theSqlMessage) == true) {
-         L << Logger::Warning << kBackendName << " SQLExecute() failed with error " << theNativeError << endl;
-         L << Logger::Warning << kBackendName << "  SQL State : " << theSqlState << endl;
-         L << Logger::Warning << kBackendName << "  SQL Msg   : " << theSqlMessage << endl;
-      }
-
-      //
-      // Rethrow for the nameserver
-      //
-      
-      throw PDNSException("Execute failed");
-   }
-}
-
-bool DB2Backend::list(int inZoneId)
-{
-   SQLRETURN theError;
-   bool theResult = false;
-
-   try
-   {
-      //
-      // Close the cursor
-      //
-      
-      if (mStatementStates[kListQuery] == true) {
-         theError = SQLCloseCursor(mStatements[kListQuery]);
-         if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO) {
-            throw DB2Exception(theError, SQL_HANDLE_STMT, mCurrentStatement);
-         }
-      }
-
-      //
-      // Execute the query
-      //
-
-      mParamZoneId = inZoneId;
-
-      theError = SQLExecute(mStatements[kListQuery]);
-      if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO && theError != SQL_NO_DATA_FOUND) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mStatements[kListQuery]);
-      }
-
-      mCurrentStatement = mStatements[kListQuery];
-      mStatementStates[kListQuery] = true;
-
-      if (theResult != SQL_NO_DATA_FOUND) {
-         theResult = true;
-      }
-   }
-
-   catch (DB2Exception& theException)
-   {
-      throw PDNSException("List failed");
-   }
-
-   return theResult;
-}
-
-bool DB2Backend::get(DNSResourceRecord& outRecord)
-{
-   bool theResult = false;
-
-   try
-   {
-      //
-      // Fetch a record
-      //
-
-      SQLRETURN theError = SQLFetch(mCurrentStatement);
-      if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO && theError != SQL_NO_DATA_FOUND) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mCurrentStatement);
-      }
-
-      //
-      // If we have data then return it
-      //
-   
-      //cerr << ">>>>>>>> Get theError = " << theError << endl;
-
-      if (theError != SQL_NO_DATA_FOUND)
-      {
-         //cerr << ">>>>>>>> Name    = " << mResultName << endl;
-         //cerr << ">>>>>>>> Content = " << mResultContent << endl;
-         //cerr << ">>>>>>>> Type    = " << mResultType << endl;
-         
-         outRecord.content       = mResultContent;
-         outRecord.ttl           = mResultTimeToLive;
-         outRecord.priority      = mResultPriority;
-         outRecord.qtype         = mResultType;
-         outRecord.domain_id     = mResultZoneId;
-         outRecord.last_modified = mResultChangeDate;
-         outRecord.qname         = mResultName;
-         
-         theResult = true;
-      }
-   }
-
-   catch (DB2Exception& theException)
-   {
-      //
-      // Print out diagnostics
-      //
-      
-      int theNativeError;
-      string theSqlState, theSqlMessage;
-      
-      while (theException.GetNextSqlError(theNativeError, theSqlState, theSqlMessage) == true) {
-         L << Logger::Warning << kBackendName << " SQLFetch() failed with error " << theNativeError << endl;
-         L << Logger::Warning << kBackendName << "  SQL State : " << theSqlState << endl;
-         L << Logger::Warning << kBackendName << "  SQL Msg   : " << theSqlMessage << endl;
-      }
-
-      //
-      // Rethrow for the nameserver
-      //
-      
-      throw PDNSException("Fetch failed");
-   }
-   
-   return theResult;
-}
-
-bool DB2Backend::getSOA(const string& inZoneName, SOAData& outSoaData)
-{
-   bool theResult = false;
-   
-   try
-   {
-      //
-      // Execute the query
-      //
-
-      strncpy(mSoaParamName, inZoneName.c_str(), sizeof(mSoaParamName));
-
-      SQLRETURN theError = SQLExecute(mSoaStatement);
-      if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO && theError != SQL_NO_DATA_FOUND) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }      
-
-      if (theError != SQL_NO_DATA_FOUND)
-      {
-         mSoaResultZoneId = mSoaResultSerial = 0;
-         mSoaResultHostmaster[0] = mSoaResultNameserver[0] = 0x00;
-
-         theError = SQLFetch(mSoaStatement);
-         if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO) {
-            throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-         }
-         
-         outSoaData.domain_id   = mSoaResultZoneId;         
-         outSoaData.nameserver  = arg()["default-soa-name"];
-         outSoaData.hostmaster  = mSoaResultHostmaster;
-         outSoaData.serial      = mSoaResultSerial;         
-         outSoaData.refresh     = 10800;
-         outSoaData.retry       = 3600;
-         outSoaData.expire      = 604800;
-         outSoaData.default_ttl = 3600;
-         
-         theResult = true;
-      }
-      
-      //
-      // Close the cursor
-      //
-
-      theError = SQLCloseCursor(mSoaStatement);
-      if (theError != SQL_SUCCESS && theError != SQL_SUCCESS_WITH_INFO) {
-         throw DB2Exception(theError, SQL_HANDLE_STMT, mSoaStatement);
-      }
-   }
-
-   catch (DB2Exception& theException)
-   {
-      //
-      // Print out diagnostics
-      //
-      
-      int theNativeError;
-      string theSqlState, theSqlMessage;
-      
-      while (theException.GetNextSqlError(theNativeError, theSqlState, theSqlMessage) == true) {
-         L << Logger::Warning << kBackendName << " SOA Record Lookup Failed: " << theNativeError << endl;
-         L << Logger::Warning << kBackendName << "  SQL State : " << theSqlState << endl;
-         L << Logger::Warning << kBackendName << "  SQL Msg   : " << theSqlMessage << endl;
-      }
-
-      //
-      // Rethrow for the nameserver
-      //
-      
-      throw PDNSException("GetSOA failed");
-   }
-   
-   return theResult;
-}
-
-//! For the dynamic loader
-DNSBackend *DB2Backend::maker()
-{
-   DNSBackend *theBackend;
-   
-   try {
-      theBackend = new DB2Backend;
-   } catch (...) {
-      theBackend = NULL;
-   }
-   
-   return theBackend;
-}
-
-class DB2Factory : public BackendFactory
-{
-   public:
-
-      DB2Factory() : BackendFactory("db2") {}
-  
-      void declareArguments(const string &suffix="")
-      {
-         declare(suffix,"server","Server","powerdns");
-         declare(suffix,"user","User","powerdns");
-         declare(suffix,"password","Password","powerdns");
-      }
-      
-      DNSBackend *make(const string &suffix="")
-      {
-         return new DB2Backend(suffix);
-      }
-};
-
-
-//! Magic class that is activated when the dynamic library is loaded
-class DB2Loader
-{
-   public:
-
-      Loader()
-      {
-         BackendMakers().report(new DB2Factory);
-         L << Logger::Info << "[db2backend] This is the db2 backend version " VERSION " (" __DATE__ ", " __TIME__ ") reporting" << endl;
-      }
-};
-
-static DB2Loader db2loader;
diff --git a/modules/db2backend/DB2Backend.hh b/modules/db2backend/DB2Backend.hh
deleted file mode 100644 (file)
index d37db71..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// $Id$
-
-#ifndef DB2BACKEND_HH
-#define DB2BACKEND_HH
-
-#include <string>
-#include <map>
-
-#include "pdns/namespaces.hh"
-
-#include <sqlcli1.h>
-
-class DB2Backend : public DNSBackend
-{
-   public:
-      
-      DB2Backend(const string &suffix = "");
-      ~DB2Backend();
-      
-      void lookup(const QType &, const string &qdomain, DNSPacket *p = 0, int zoneId = -1);
-      bool list(int inZoneId);
-      bool get(DNSResourceRecord& outRecord);
-      bool getSOA(const string &name, SOAData &soadata);
-      
-      static DNSBackend *maker();
-
-   private:
-
-      void Cleanup();
-      
-   private:
-
-      // Handles
-      SQLHANDLE  mConnection;
-      SQLHANDLE  mEnvironment;
-      SQLHANDLE  mStatements[6];
-      bool       mStatementStates[6];
-      SQLHANDLE  mSoaStatement;
-      SQLHANDLE  mCurrentStatement;
-
-      // Parameters
-      char mParamName[256];
-      char mParamNameLength;
-      char mParamType[256];
-      char mParamTypeLength;
-      int  mParamZoneId;
-      int  mParamZoneIdLength;
-
-      // Columns
-      char        mResultContent[256];
-      SQLINTEGER  mResultContentIndicator;
-      int         mResultTimeToLive;
-      SQLINTEGER  mResultTimeToLiveIndicator;
-      int         mResultPriority;
-      SQLINTEGER  mResultPriorityIndicator;
-      char        mResultType[256];
-      SQLINTEGER  mResultTypeIndicator;
-      int         mResultZoneId;
-      SQLINTEGER  mResultZoneIdIndicator;
-      int         mResultChangeDate;
-      SQLINTEGER  mResultChangeDateIndicator;
-      char        mResultName[256];
-      SQLINTEGER  mResultNameIndicator;
-      
-      // SOA Parameters
-      char       mSoaParamName[256];
-      
-      // SOA Result
-      int        mSoaResultZoneId;
-      SQLINTEGER mSoaResultZoneIdIndicator;
-      char       mSoaResultNameserver[256];
-      SQLINTEGER mSoaResultNameserverIndicator;
-      char       mSoaResultHostmaster[256];
-      SQLINTEGER mSoaResultHostmasterIndicator;
-      int        mSoaResultSerial;
-      SQLINTEGER mSoaResultSerialIndicator;      
-};
-
-#endif /* DB2BACKEND_HH */
diff --git a/modules/db2backend/DB2Exception.cc b/modules/db2backend/DB2Exception.cc
deleted file mode 100644 (file)
index 791eb53..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// $Id$
-
-#include "DB2Exception.hh"
-
-DB2Exception::DB2Exception(SQLRETURN inError)
-   : mError(inError), mHandle(SQL_NULL_HANDLE), mErrorIndex(1)
-{
-}
-      
-DB2Exception::DB2Exception(SQLRETURN inError, SQLSMALLINT inHandleType, SQLHANDLE inHandle)
-   : mError(inError), mHandle(inHandle), mHandleType(inHandleType), mErrorIndex(1)
-{
-}
-
-SQLRETURN DB2Exception::GetError()
-{
-   return mError;
-}
-      
-bool DB2Exception::GetNextSqlError(int& outNativeError, string& outSqlState, string& outSqlMessage)
-{
-   SQLCHAR     message[SQL_MAX_MESSAGE_LENGTH + 1];
-   SQLCHAR     sqlstate[SQL_SQLSTATE_SIZE + 1];
-   SQLINTEGER  sqlcode;
-   SQLSMALLINT length;
-   
-   bool theResult = false;
-   
-   if (mHandle != SQL_NULL_HANDLE)
-   {
-      SQLRETURN theError = SQLGetDiagRec(mHandleType, mHandle, mErrorIndex, sqlstate, &sqlcode, message, SQL_MAX_MESSAGE_LENGTH + 1, &length);
-      if (theError == SQL_SUCCESS)
-      {
-         outNativeError = sqlcode;
-         outSqlState = (const char*) sqlstate;
-         outSqlMessage = (const char*) message;
-         
-         mErrorIndex++;
-         theResult = true;
-      }
-   }
-   
-   return theResult;
-}
diff --git a/modules/db2backend/DB2Exception.hh b/modules/db2backend/DB2Exception.hh
deleted file mode 100644 (file)
index 8a09a1c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// $Id$
-
-#ifndef DB2EXCEPTION_HH
-#define DB2EXCEPTION_HH
-
-#include <string>
-
-#include "pdns/namespaces.hh"
-
-#include <sqlcli1.h>
-
-class DB2Exception
-{
-   public:
-
-      DB2Exception(SQLRETURN inError);
-      DB2Exception(SQLRETURN inError, SQLSMALLINT inHandleType, SQLHANDLE inHandle);
-      virtual ~DB2Exception();
-
-      SQLRETURN GetError();      
-      bool GetNextSqlError(int& outNativeError, string& outSqlState, string& outSqlMessage);
-
-   private:
-            
-      SQLRETURN   mError;
-      SQLHANDLE   mHandle;
-      SQLSMALLINT mHandleType;
-      SQLSMALLINT mErrorIndex;
-};
-      
-#endif // DB2EXCEPTION_HH
diff --git a/modules/db2backend/Makefile.am b/modules/db2backend/Makefile.am
deleted file mode 100644 (file)
index 651837c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-pkglib_LTLIBRARIES = libdb2backend.la
-
-libdb2backend_la_SOURCES = \
-       DB2Backend.cc DB2Backend.hh \
-       DB2Exception.cc DB2Exception.hh
-
-libdb2backend_la_LDFLAGS = -module -avoid-version
-libdb2backend_la_LIBADD = -ldb2
-
diff --git a/modules/db2backend/OBJECTFILES b/modules/db2backend/OBJECTFILES
deleted file mode 100644 (file)
index 97db35a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-DB2Backend.lo
diff --git a/modules/db2backend/OBJECTLIBS b/modules/db2backend/OBJECTLIBS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/pdns/docs/markdown/authoritative/backend-db2.md b/pdns/docs/markdown/authoritative/backend-db2.md
deleted file mode 100644 (file)
index 355deca..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# DB2 Backend
-**Note**: This backend is unsupported.
-
-|&nbsp;|&nbsp;|
-|:--|:--|
-|Native|Yes|
-|Master|No|
-|Slave|No|
-|Superslave|No|
-|Autoserial|Yes|
-|DNSSEC|No|
-|Disabled data|No|
-|Comments|No|
-|Module name|db2
-|Launch name|db2|
-
-PowerDNS is currently ascertaining if this backend can be distributed in binary form without violating IBM DB2 licensing.
-
-## Queries
-The DB2 backend executes the following queries:
-
-### Forward Query
-select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and type = ?
-
-### Forward By Zone Query
-select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and Type = ? and ZoneId = ?
-
-### Forward Any Query
-select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ?
-
-### List Query
-select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where ZoneId = ?
-
-## Configuration Parameters
-
-### `db2-server`
-Server name to connect to. Defaults to 'powerdns'. Make sure that your nameserver is not needed to resolve an IP address needed to connect as this might lead to a chicken/egg situation.
-
-### `db2-user`
-Username to connect as. Defaults to 'powerdns'.
-
-### `db2-password`
-Password to connect with. Defaults to 'powerdns'.
index 945fa9e2bbc8448d0c56ddf7eb7ce958a6bb1c15..b0ca7e5ab577d8eee601f5de84a15017e0cab6de 100644 (file)
@@ -1,5 +1,49 @@
 This page contains some information about deprecated backends.
 
+# DB2 Backend
+**Note**: This backend was removed in version 3.5.0.
+
+|&nbsp;|&nbsp;|
+|:--|:--|
+|Native|Yes|
+|Master|No|
+|Slave|No|
+|Superslave|No|
+|Autoserial|Yes|
+|DNSSEC|No|
+|Disabled data|No|
+|Comments|No|
+|Module name|db2
+|Launch name|db2|
+
+PowerDNS is currently ascertaining if this backend can be distributed in binary form without violating IBM DB2 licensing.
+
+## Queries
+The DB2 backend executes the following queries:
+
+### Forward Query
+select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and type = ?
+
+### Forward By Zone Query
+select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ? and Type = ? and ZoneId = ?
+
+### Forward Any Query
+select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where Name = ?
+
+### List Query
+select Content, TimeToLive, Priority, Type, ZoneId, 0 as ChangeDate, Name from Records where ZoneId = ?
+
+## Configuration Parameters
+
+### `db2-server`
+Server name to connect to. Defaults to 'powerdns'. Make sure that your nameserver is not needed to resolve an IP address needed to connect as this might lead
+
+### `db2-user`
+Username to connect as. Defaults to 'powerdns'.
+
+### `db2-password`
+Password to connect with. Defaults to 'powerdns'.
+
 # ODBC backend
 **Note**: This backend was removed in version 3.1.
 
index 2b888b32c4920de1ee3b2d2e7273ee0877cfb7b2..1abbf6766d0556a90978c569618189837d8efcee 100644 (file)
@@ -16,7 +16,6 @@ The following table describes the capabilities of the backends.
 | Name | Status | Native | Master | Slave | Superslave | Autoserial | DNSSEC | Disabled Data | Comments | Launch Name |
 |:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|:---|
 | [BIND](backend-bind.md) | Supported | Yes | Yes | Experimental | No | Yes | No | No | No | `bind` |
-| [DB2](backend-db2.md) | Unsupported | Yes | No | No | No | Yes | No | No | No | `db2` |
 | [Geo](backend-geo.md) | Beta | Partial | No | No | No | No | Unknown (No) | Yes (no key storage) | Unknown (No) | Unknown (No) | `geo` |
 | [LDAP](backend-ldap.md) | Unmaintained | Yes | No | No | No | No | No | Unknown (No) | Unknown (No) | Unknown |
 | [LMDB](backend-lmdb.md) | Supported | Yes | No | No | No | No | No | Unknown (No) | Unknown (No) | `lmdb`|
index 2ae24ef4ff1d83c0a81ae8b7bcc6ba3e5a177e97..65f44841a7bcb5736174ff588f571add37f2d407 100644 (file)
@@ -2460,7 +2460,7 @@ Developers: this version is compatible with 1.99.11 backends.
 
 -   Windows 2000 code base merge completed. This resulted in quite some changes on the Unix end of things, so this may impact reliability.
 -   ODBC backend added for Windows. See [Section 9, “ODBC backend”](odbc.html "9. ODBC backend").
--   IBM DB2 Universal Database backend available for Linux. See [DB2 backend](authoritative/backend-db2.md "DB2 backend").
+-   IBM DB2 Universal Database backend available for Linux. See [DB2 backend](authoritative/backend-deprecated.md#db2-backend "DB2 backend").
 -   Zone2sql now understands $INCLUDE. Thanks to Amaze Internet for nagging about this
 -   The SOA Minimum TTL now has a configurable default (**soa-minimum-ttl**)value to placate the DENIC requirements.
 -   Added a limit on the simultaneous numbers of TCP connections to accept (**max-tcp-connections**). Defaults to 10.
index c194259aa2aefb754b3fd46bb5e30250cc201735..f03fe333cee3cb974569835c6ca633666816d95d 100644 (file)
@@ -29,7 +29,6 @@ pages:
   - [authoritative/dnssec.md, 'Authoritative', 'Serve DNSSEC Signed Data']
   - [authoritative/settings.md, 'Authoritative', 'List of Settings']
   - [authoritative/backend-bind.md, 'Authoritative Backends', 'BIND']
-  - [authoritative/backend-db2.md, 'Authoritative Backends', 'DB2']
   - [authoritative/backend-generic-mypgsql.md, 'Authoritative Backends', 'Generic MySQL and PostGreSQL']
   - [authoritative/backend-geo.md, 'Authoritative Backends', 'Geo(graphic loadbalancing)']
   - [authoritative/backend-geoip.md, 'Authoritative Backends', 'GeoIP']