develop #15

Merged
cromer merged 64 commits from develop into master 2023-02-23 01:11:48 -03:00
2 changed files with 1 additions and 10 deletions
Showing only changes of commit 6d0eeb77eb - Show all commits

View File

@ -23,7 +23,7 @@ obelisk::KnowledgeBase::KnowledgeBase(const char* filename, int flags)
auto result = sqlite3_open_v2(filename, &dbConnection_, flags, NULL); auto result = sqlite3_open_v2(filename, &dbConnection_, flags, NULL);
if (result != SQLITE_OK) if (result != SQLITE_OK)
{ {
logSqliteError(result); throw new KnowledgeBaseException("database could not be opened");
} }
enableForeignKeys(); enableForeignKeys();
@ -63,7 +63,6 @@ void obelisk::KnowledgeBase::enableForeignKeys()
&errmsg); &errmsg);
if (result != SQLITE_OK) if (result != SQLITE_OK)
{ {
logSqliteError(result);
if (errmsg) if (errmsg)
{ {
throw obelisk::KnowledgeBaseException(errmsg); throw obelisk::KnowledgeBaseException(errmsg);
@ -81,7 +80,6 @@ void obelisk::KnowledgeBase::createTable(std::function<const char*()> function)
int result = sqlite3_exec(dbConnection_, function(), NULL, NULL, &errmsg); int result = sqlite3_exec(dbConnection_, function(), NULL, NULL, &errmsg);
if (result != SQLITE_OK) if (result != SQLITE_OK)
{ {
logSqliteError(result);
if (errmsg) if (errmsg)
{ {
throw obelisk::KnowledgeBaseException(errmsg); throw obelisk::KnowledgeBaseException(errmsg);
@ -171,12 +169,6 @@ void obelisk::KnowledgeBase::getFact(obelisk::Fact& fact)
fact.selectFact(dbConnection_); 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, void obelisk::KnowledgeBase::getFloat(float& result1,
float& result2, float& result2,
double var) double var)

View File

@ -22,7 +22,6 @@ namespace obelisk
const char* filename_; const char* filename_;
sqlite3* dbConnection_ = nullptr; sqlite3* dbConnection_ = nullptr;
int flags_; int flags_;
void logSqliteError(int result);
void enableForeignKeys(); void enableForeignKeys();
void createTable(std::function<const char*()> function); void createTable(std::function<const char*()> function);