support for NS, TXT, NDNCERT, FH
diff --git a/src/db/db-mgr.cpp b/src/db/db-mgr.cpp
index 5ab9db1..baabad8 100644
--- a/src/db/db-mgr.cpp
+++ b/src/db/db-mgr.cpp
@@ -26,25 +26,22 @@
namespace ndns {
DBMgr::DBMgr()
-: m_dbfile("src/db/ndns-local.db")
-, m_conn(0)
-, m_reCode(-1)
-, m_status(DBClosed)
-, m_resultNum(0)
+ : m_dbfile("src/db/ndns-local.db")
+ , m_conn(0)
+ , m_reCode(-1)
+ , m_status(DBClosed)
+ , m_resultNum(0)
{
std::fstream file;
- file.open(m_dbfile,std::ios::in);
- if (file)
- {
- std::cout<<"database file "<<m_dbfile<<" does exist"<<std::endl;
- } else
- {
- std::cout<<"database file "<<m_dbfile<<" does not exist"<<std::endl;
+ file.open(m_dbfile, std::ios::in);
+ if (file) {
+ std::cout << "database file " << m_dbfile << " does exist" << std::endl;
+ } else {
+ std::cout << "database file " << m_dbfile << " does not exist" << std::endl;
}
}
-
DBMgr::~DBMgr()
{
}
@@ -55,14 +52,12 @@
return;
m_reCode = sqlite3_open(this->m_dbfile.c_str(), &(this->m_conn));
- if (m_reCode != SQLITE_OK)
- {
- m_err = "Cannot connect to the db: "+this->m_dbfile;
+ if (m_reCode != SQLITE_OK) {
+ m_err = "Cannot connect to the db: " + this->m_dbfile;
m_status = DBError;
//exit(1);
- }else
- {
- std::cout<<"connect to the db: "<<m_dbfile<<std::endl;
+ } else {
+ std::cout << "connect to the db: " << m_dbfile << std::endl;
}
m_status = DBConnected;
}
@@ -73,15 +68,15 @@
return;
m_reCode = sqlite3_close(this->m_conn);
- if (m_reCode != SQLITE_OK)
- {
- m_err = "Cannot close the db: "+this->m_dbfile;
- m_status = DBError;
+ if (m_reCode != SQLITE_OK) {
+ m_err = "Cannot close the db: " + this->m_dbfile;
+ m_status = DBError;
}
m_status = DBClosed;
}
-void DBMgr::execute(std::string sql, int (*callback)(void*,int,char**,char**), void * paras)
+void DBMgr::execute(std::string sql,
+ int (*callback)(void*, int, char**, char**), void * paras)
{
if (m_status == DBClosed)
this->open();
@@ -89,15 +84,14 @@
clearResultNum();
char *err_msg;
m_reCode = sqlite3_exec(m_conn, sql.c_str(), callback, paras, &err_msg);
- if (m_reCode != SQLITE_OK)
- {
+ if (m_reCode != SQLITE_OK) {
m_status = DBError;
this->m_err.append(err_msg);
- std::cout<<this->m_err<<std::endl;
+ std::cout << this->m_err << std::endl;
}
this->close();
}
-}//namespace ndns
-}//namespace ndn
+} //namespace ndns
+} //namespace ndn