#include "bind-dnssec.schema.sqlite3.sql.h"
#include <boost/foreach.hpp>
#include "config.h"
+#include "pdns/arguments.hh"
#ifndef HAVE_SQLITE3
void Bind2Backend::setupDNSSEC()
{
if(!getArg("dnssec-db").empty())
throw runtime_error("bind-dnssec-db requires building PowerDNS with SQLite3");
+
+ d_dnssecdb->setLog(::arg().mustDo("query-logging"));
}
void Bind2Backend::createDNSSECDB(const string& fname)
snprintf(output,sizeof(output)-1, format.c_str(),sqlEscape(lcqname).c_str(),domain_id);
}
}
- DLOG(L<< "Query: '" << output << "'"<<endl);
try {
d_db->doQuery(output);
// Copyright (C) 2003, Michel Stol <michel@powerdns.com>
//
-#include "pdns/utility.hh"
#include <string>
+#include <sstream>
#include "ssqlite3.hh"
#include <iostream>
+#include <fstream>
+#include "pdns/logger.hh"
+#include "misc.hh"
#ifdef WIN32
# include <io.h>
sqlite3_busy_handler(m_pDB, busyHandler, 0);
}
+void SSQLite3::setLog(bool state)
+{
+ s_dolog=state;
+}
+
// Destructor.
SSQLite3::~SSQLite3()
{
int SSQLite3::doQuery( const std::string & query )
{
const char *pTail;
- // Execute the query.
+
+ if(s_dolog)
+ L<<Logger::Warning<<"Query: "<<query<<endl;
+ // Execute the query.
+
#if SQLITE_VERSION_NUMBER >= 3003009
if ( sqlite3_prepare_v2( m_pDB, query.c_str(), -1, &m_pStmt, &pTail ) != SQLITE_OK )
#else
//! Pointer to the SQLite virtual machine executing a query.
sqlite3_stmt *m_pStmt;
+ bool s_dolog;
+
static int busyHandler(void*, int);
protected:
public:
//! Escapes the SQL query.
std::string escape( const std::string & query );
+ void setLog(bool state);
+
//! Used to create an backend specific exception message.
SSqlException sPerrorException( const std::string & reason );
};