finish inserting the suggested actions

This commit is contained in:
2023-02-18 21:32:05 -03:00
parent 91cce4c170
commit d8ae5e1b95
4 changed files with 70 additions and 8 deletions

View File

@@ -153,6 +153,27 @@ void obelisk::KnowledgeBase::addFacts(std::vector<obelisk::Fact>& facts)
}
}
void obelisk::KnowledgeBase::addSuggestActions(std::vector<obelisk::SuggestAction>& suggestActions)
{
for (auto& suggestAction : suggestActions)
{
try
{
suggestAction.insert(dbConnection_);
}
catch (obelisk::DatabaseConstraintException& exception)
{
// ignore unique constraint error
if (std::strcmp(exception.what(),
"UNIQUE constraint failed: suggest_action.fact, suggest_action.true_action, suggest_action.false_action")
!= 0)
{
throw;
}
}
}
}
void obelisk::KnowledgeBase::getEntity(obelisk::Entity& entity)
{
entity.selectByName(dbConnection_);
@@ -173,6 +194,11 @@ void obelisk::KnowledgeBase::getFact(obelisk::Fact& fact)
fact.selectById(dbConnection_);
}
void obelisk::KnowledgeBase::getSuggestAction(obelisk::SuggestAction& suggestAction)
{
suggestAction.selectById(dbConnection_);
}
void obelisk::KnowledgeBase::getFloat(float& result1, float& result2, double var)
{
result1 = (float) var;