]> granicus.if.org Git - pdns/commitdiff
sqlite2 backend had been broken for a while now, and it is ancient. bye bye. Closes...
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 6 Oct 2012 18:20:35 +0000 (18:20 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 6 Oct 2012 18:20:35 +0000 (18:20 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2773 d19b8d6e-7fed-0310-83ef-9ca221ded41b

build-scripts/rpm-build-instruction
build-scripts/tar-gz-build-instruction
configure.ac
modules/gsqlitebackend/Makefile.am [deleted file]
modules/gsqlitebackend/OBJECTFILES [deleted file]
modules/gsqlitebackend/OBJECTLIBS [deleted file]
modules/gsqlitebackend/gsqlitebackend.cc [deleted file]
modules/gsqlitebackend/gsqlitebackend.hh [deleted file]
modules/gsqlitebackend/ssqlite.cc [deleted file]
modules/gsqlitebackend/ssqlite.hh [deleted file]

index 11afd52a606af06580059681b1cb9c84cd35e49e..488b400d1178b95df2562119a4bb431c1b21d22a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #LIBS="-lkrb5 -lk5crypto -lpgport -lgssapi_krb5 -lkrb5support -lgssapi_krb5 -lcom_err -lnsl -lresolv" \
 CC="ccache gcc" CXX="ccache g++" CPPFLAGS=-I/usr/local/include/botan-1.10 ./configure \
-               --with-modules="gmysql gpgsql gsqlite gsqlite3 pipe geo lua" \
+               --with-modules="gmysql gpgsql gsqlite3 pipe geo lua" \
        --with-dynmodules="" \
        --enable-static-binaries \
        --with-pgsql-lib=/opt/postgresql/lib --with-pgsql-includes=/opt/postgresql/include \
index df19f41cf8387f25a6937b500c4d3f31206a5a19..caa421c2f72a543ea65d9a64ceebf7728087f66b 100755 (executable)
@@ -2,6 +2,6 @@ rm -f $(find . -name "*~") &&
 ./bootstrap && 
 ./configure \
 --with-pgsql-lib=/opt/postgresql/lib --with-pgsql-includes=/opt/postgresql/include \
---with-modules="mydns gmysql mongodb lua gpgsql xdb pipe oracle pipe db2 ldap gsqlite gsqlite3 geo goracle opendbx godbc" \
+--with-modules="mydns gmysql mongodb lua gpgsql xdb pipe oracle pipe db2 ldap gsqlite3 geo goracle opendbx godbc" \
 --with-dynmodules="" &&
 make dist 
\ No newline at end of file
index a5d85fae5a6b00f09ce3619dc227a14b4a2ed20e..92d46cd63150c106cbccc3b72ce382b85b20564c 100644 (file)
@@ -312,9 +312,6 @@ do
                gpgsql )
                        needpgsql=yes
                ;;
-               gsqlite )
-                       needsqlite=yes
-               ;;
                gsqlite3 )
                        needsqlite3=yes
                ;;
@@ -664,7 +661,7 @@ modules/pipebackend/Makefile modules/oraclebackend/Makefile \
 modules/xdbbackend/Makefile modules/godbcbackend/Makefile \
 modules/mongodbbackend/Makefile \
 modules/gpgsqlbackend/Makefile modules/ldapbackend/Makefile \
-modules/gsqlitebackend/Makefile modules/gsqlite3backend/Makefile \
+modules/gsqlite3backend/Makefile \
 modules/goraclebackend/Makefile modules/mydnsbackend/Makefile \
 modules/luabackend/Makefile modules/tinydnsbackend/Makefile \
 modules/remotebackend/Makefile)
diff --git a/modules/gsqlitebackend/Makefile.am b/modules/gsqlitebackend/Makefile.am
deleted file mode 100644 (file)
index 66b930e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-AM_CPPFLAGS=@THREADFLAGS@ $(BOOST_CPPFLAGS)
-lib_LTLIBRARIES = libgsqlitebackend.la
-
-EXTRA_DIST=OBJECTFILES OBJECTLIBS
-
-INCLUDES=-I@SQLITE_incdir@
-
-libgsqlitebackend_la_SOURCES=gsqlitebackend.cc gsqlitebackend.hh \
-                ssqlite.hh ssqlite.cc
-
-
-libgsqlitebackend_la_LDFLAGS=-module -avoid-version -lsqlite
diff --git a/modules/gsqlitebackend/OBJECTFILES b/modules/gsqlitebackend/OBJECTFILES
deleted file mode 100644 (file)
index 4673a62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-gsqlitebackend.o ssqlite.o
\ No newline at end of file
diff --git a/modules/gsqlitebackend/OBJECTLIBS b/modules/gsqlitebackend/OBJECTLIBS
deleted file mode 100644 (file)
index beae84a..0000000
+++ /dev/null
@@ -1 +0,0 @@
--lsqlite
\ No newline at end of file
diff --git a/modules/gsqlitebackend/gsqlitebackend.cc b/modules/gsqlitebackend/gsqlitebackend.cc
deleted file mode 100644 (file)
index c92cabb..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-
-//
-// SQLite backend for PowerDNS
-// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
-//
-
-#include "pdns/utility.hh"
-#include <map>
-#include <unistd.h>
-#include <sstream>
-#include <string>
-
-#include "pdns/dns.hh"
-#include "pdns/dnsbackend.hh"
-#include "pdns/dnspacket.hh"
-#include "pdns/ueberbackend.hh"
-#include "pdns/ahuexception.hh"
-#include "pdns/logger.hh"
-#include "pdns/arguments.hh"
-#include "ssqlite.hh"
-#include "gsqlitebackend.hh"
-#include <boost/algorithm/string.hpp>
-
-// Connects to the database.
-gSQLiteBackend::gSQLiteBackend( const std::string & mode, const std::string & suffix ) : GSQLBackend( mode, suffix )
-{
-  try 
-  {
-    setDB( new SSQLite( getArg( "database" )));    
-  }  
-  catch( SSqlException & e ) 
-  {
-    L << Logger::Error << mode << ": connection failed: " << e.txtReason() << std::endl;
-    throw AhuException( "Unable to launch " + mode + " connection: " + e.txtReason());
-  }
-
-  L << Logger::Warning << mode << ": connection to '"<<getArg("database")<<"' successful" << std::endl;
-}
-
-
-//! Constructs a gSQLiteBackend
-class gSQLiteFactory : public BackendFactory
-{
-public:
-  //! Constructor.
-  gSQLiteFactory( const std::string & mode ) : BackendFactory( mode ), d_mode( mode )
-  {
-  }
-  
-  //! Declares all needed arguments.
-  void declareArguments( const std::string & suffix = "" )
-  {
-    declare( suffix, "database", "Filename of the SQLite database", "powerdns.sqlite" );
-    
-    declare( suffix, "basic-query", "Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
-    declare( suffix, "id-query", "Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
-    declare( suffix, "wildcard-query", "Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
-    declare( suffix, "wildcard-id-query", "Wildcard with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s' and domain_id=%d");
-
-    declare( suffix, "any-query", "Any query","select content,ttl,prio,type,domain_id,name from records where name='%s'");
-    declare( suffix, "any-id-query", "Any with ID query","select content,ttl,prio,type,domain_id,name from records where name='%s' and domain_id=%d");
-    declare( suffix, "wildcard-any-query", "Wildcard ANY query","select content,ttl,prio,type,domain_id,name from records where name like '%s'");
-    declare( suffix, "wildcard-any-id-query", "Wildcard ANY with ID query","select content,ttl,prio,type,domain_id,name from records where name like '%s' and domain_id=%d");
-
-    declare( suffix, "list-query", "AXFR query", "select content,ttl,prio,type,domain_id,name from records where domain_id=%d");
-    declare( suffix, "master-zone-query", "Data", "select master from domains where name='%s' and type='SLAVE'");
-
-    declare( suffix, "info-zone-query", "","select id,name,master,last_check,notified_serial,type from domains where name='%s'");
-
-    declare( suffix, "info-all-slaves-query", "","select id,name,master,last_check,type from domains where type='SLAVE'");
-    declare( suffix, "supermaster-query", "", "select account from supermasters where ip='%s' and nameserver='%s'");
-    declare( suffix, "insert-slave-query", "", "insert into domains (type,name,master,account) values('SLAVE','%s','%s','%s')");
-    declare( suffix, "insert-record-query", "", "insert into records (content,ttl,prio,type,domain_id,name) values ('%s',%d,%d,'%s',%d,'%s')");
-    declare( suffix, "update-serial-query", "", "update domains set notified_serial=%d where id=%d");
-    declare( suffix, "update-lastcheck-query", "", "update domains set last_check=%d where id=%d");
-    declare( suffix, "zone-lastchange-query", "", "select max(change_date) from records where domain_id=%d");
-    declare( suffix, "info-all-master-query", "", "select id,name,master,last_check,notified_serial,type from domains where type='MASTER'");
-    declare( suffix, "delete-zone-query", "", "delete from records where domain_id=%d");
-  }
-  
-  //! Constructs a new gSQLiteBackend object.
-  DNSBackend *make( const string & suffix = "" )
-  {
-    return new gSQLiteBackend( d_mode, suffix );
-  }
-
-private:
-  const string d_mode;
-};
-
-
-//! Magic class that is activated when the dynamic library is loaded
-class gSQLiteLoader
-{
-public:
-  //! This reports us to the main UeberBackend class
-  gSQLiteLoader()
-  {
-    BackendMakers().report( new gSQLiteFactory( "gsqlite" ));
-    L<<Logger::Warning << "This is module gsqlite reporting" << std::endl;
-  }
-};
-
-string gSQLiteBackend::sqlEscape(const string &name)
-{
-  return boost::replace_all_copy(name, "'", "''");
-}
-
-
-//! Reports the backendloader to the UeberBackend.
-static gSQLiteLoader gsqliteloader;
-
diff --git a/modules/gsqlitebackend/gsqlitebackend.hh b/modules/gsqlitebackend/gsqlitebackend.hh
deleted file mode 100644 (file)
index e2391e9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-// SQLite backend for PowerDNS
-// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
-//
-
-#ifndef GSQLITEBACKEND_HH
-#define GSQLITEBACKEND_HH
-
-#include <string>
-#include "pdns/backends/gsql/gsqlbackend.hh"
-
-//! The gSQLiteBackend retrieves it's data from a SQLite database (http://www.sqlite.org/)
-class gSQLiteBackend : public GSQLBackend
-{
-private:
-protected:
-public:
-  //! Constructs the backend, throws an exception if it failed..
-  gSQLiteBackend( const std::string & mode, const std::string & suffix );
-  virtual string sqlEscape(const string &name);
-};
-
-#endif // GSQLITEBACKEND_HH
diff --git a/modules/gsqlitebackend/ssqlite.cc b/modules/gsqlitebackend/ssqlite.cc
deleted file mode 100644 (file)
index 178d68c..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-
-//
-// SQLite backend for PowerDNS
-// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
-//
-
-#include "pdns/utility.hh"
-#include <string>
-#include "ssqlite.hh"
-#include <iostream>
-
-#ifdef WIN32
-# include <io.h>
-# define access _access
-# define F_OK 0
-#else // WIN32
-# include <unistd.h>
-#endif // Unix
-
-// Constructor.
-SSQLite::SSQLite( const std::string & database )
-{
-  // Open the database connection.
-  if ( access( database.c_str(), F_OK ) == -1 )
-    throw sPerrorException( "SQLite database does not exist yet" );
-
-  m_pDB = sqlite_open( database.c_str(), 0, NULL );
-  if ( !m_pDB )
-    throw sPerrorException( "Could not connect to the SQLite database '" + database + "'" );
-}
-
-
-// Destructor.
-SSQLite::~SSQLite( void )
-{
-  sqlite_close( m_pDB );
-}
-
-
-// Constructs a SSqlException object.
-SSqlException SSQLite::sPerrorException( const std::string & reason )
-{
-  return SSqlException( reason );
-}
-
-
-// Performs a query.
-int SSQLite::doQuery( const std::string & query, result_t & result )
-{
-  result.clear();
-  
-  doQuery( query );
-  
-  row_t row;
-  while( getRow( row ))
-    result.push_back( row );
-    
-  return result.size();
-}
-
-
-// Performs a query.
-int SSQLite::doQuery( const std::string & query )
-{
-  const char *pOut;
-
-  // Execute the query.
-  char *pError = NULL;
-  if ( sqlite_compile( m_pDB, query.c_str(), &pOut, &m_pVM, &pError ) != SQLITE_OK )
-    throw sPerrorException( "Could not create SQLite VM for query" );
-  
-  if ( !m_pVM ) {
-    std::string report( "Unable to compile SQLite statement" );
-
-    if( pError ) 
-    {
-      report += string( ": " ) + pError;
-      sqlite_freemem( pError );
-    }
-
-    sPerrorException( report );
-  }
-  return 0;
-}
-
-
-// Returns a row from the result set.
-bool SSQLite::getRow( row_t & row )
-{
-  int  numCols;
-  int  rc;
-  const char **ppData;
-  const char **ppColumnNames;
-
-  row.clear();
-
-  do
-  {
-    rc = sqlite_step( m_pVM, &numCols, &ppData, &ppColumnNames );
-    
-    if ( rc == SQLITE_BUSY )
-      Utility::usleep( 250 ); // FIXME: Should this be increased, decreased, or is it Just Right? :)
-    else
-      break;
-
-  } while ( true );
-  
-  if ( rc == SQLITE_ROW )
-  {
-    // Another row received, process it.
-    for ( int i = 0; i < numCols; i++ )
-    {
-      if ( ppData[ i ] )
-        row.push_back( ppData[ i ] );
-      else
-        row.push_back( "" ); // NULL value.
-    }
-    
-    return true;
-  }
-  
-  if ( rc == SQLITE_DONE )
-  {
-    // We're done, clean up.
-    sqlite_finalize( m_pVM, NULL );
-    m_pVM = NULL;
-    
-    return false;
-  }
-  
-  // Something went wrong, complain.
-  throw sPerrorException( "Error while retrieving SQLite query results" );
-  
-  // Prevent some compilers from complaining.
-  return false;
-}
-
-
-// Escape a SQL query.
-std::string SSQLite::escape( const std::string & name)
-{
-  std::string a;
-  
-    for( std::string::const_iterator i = name.begin(); i != name.end(); ++i ) 
-    {
-      if( *i == '\'')
-        a += '\'';
-        
-      a += *i;
-    }
-    
-  return a;
-}
-
diff --git a/modules/gsqlitebackend/ssqlite.hh b/modules/gsqlitebackend/ssqlite.hh
deleted file mode 100644 (file)
index 096f439..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-
-//
-// SQLite backend for PowerDNS
-// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
-//
-
-#ifndef SSQLITE_HH
-#define SSQLITE_HH
-
-#include <sqlite.h>
-#include "pdns/backends/gsql/ssql.hh"
-
-class SSQLite : public SSql
-{
-private:
-  //! Pointer to the SQLite database instance.
-  sqlite *m_pDB;
-
-  //! Pointer to the SQLite virtual machine executing a query.
-  sqlite_vm *m_pVM;
-  
-protected:
-public:
-  //! Constructor.
-  SSQLite( const std::string & database );
-  
-  //! Destructor.
-  ~SSQLite( void );
-  
-  //! Performs a query and puts answers in result
-  int doQuery( const std::string & query, result_t & result );
-  
-  //! Performs a query, caller can retrieve answers with getRow
-  int doQuery( const std::string & query );
-
-  //! Performs a command that does not return rows
-  int doCommand( const std::string & query )
-  {
-    result_t result;
-    return doQuery(query, result); // 'result' is necessary to force doQuery to do the work, closing Debian bug 280359
-  }
-
-  
-  //! Returns a row from a result set.
-  bool getRow( row_t & row );
-  
-  //! Escapes the SQL query.
-  std::string escape( const std::string & query );
-  
-  //! Used to create an backend specific exception message.
-  SSqlException sPerrorException( const std::string & reason );
-  
-};
-
-#endif // SSQLITE_HH
-