From cc080fbd45a7fb5ab5200fb5a20fb98c2ed35c58 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Fri, 9 Dec 2022 21:13:18 -0300 Subject: [PATCH] remove sqlite log method from knowledge base --- src/knowledge_base.cpp | 10 +--------- src/knowledge_base.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/knowledge_base.cpp b/src/knowledge_base.cpp index a0209dd..ecf82c1 100644 --- a/src/knowledge_base.cpp +++ b/src/knowledge_base.cpp @@ -23,7 +23,7 @@ obelisk::KnowledgeBase::KnowledgeBase(const char* filename, int flags) auto result = sqlite3_open_v2(filename, &dbConnection_, flags, NULL); if (result != SQLITE_OK) { - logSqliteError(result); + throw new KnowledgeBaseException("database could not be opened"); } enableForeignKeys(); @@ -63,7 +63,6 @@ void obelisk::KnowledgeBase::enableForeignKeys() &errmsg); if (result != SQLITE_OK) { - logSqliteError(result); if (errmsg) { throw obelisk::KnowledgeBaseException(errmsg); @@ -81,7 +80,6 @@ void obelisk::KnowledgeBase::createTable(std::function function) int result = sqlite3_exec(dbConnection_, function(), NULL, NULL, &errmsg); if (result != SQLITE_OK) { - logSqliteError(result); if (errmsg) { throw obelisk::KnowledgeBaseException(errmsg); @@ -171,12 +169,6 @@ void obelisk::KnowledgeBase::getFact(obelisk::Fact& fact) fact.selectFact(dbConnection_); } -// TODO: log files? or just throw an error? -void obelisk::KnowledgeBase::logSqliteError(int result) -{ - std::cout << sqlite3_errstr(result) << std::endl; -} - void obelisk::KnowledgeBase::getFloat(float& result1, float& result2, double var) diff --git a/src/knowledge_base.h b/src/knowledge_base.h index 7458f65..d3ce8ba 100644 --- a/src/knowledge_base.h +++ b/src/knowledge_base.h @@ -22,7 +22,6 @@ namespace obelisk const char* filename_; sqlite3* dbConnection_ = nullptr; int flags_; - void logSqliteError(int result); void enableForeignKeys(); void createTable(std::function function); -- 2.30.2