refactor select and insert methods to be less redundant
This commit is contained in:
parent
bc93f42c00
commit
f7b62e4645
@ -87,7 +87,7 @@ void obelisk::KnowledgeBase::addEntities(std::vector<obelisk::Entity>& entities)
|
||||
{
|
||||
try
|
||||
{
|
||||
entity.insertEntity(dbConnection_);
|
||||
entity.insert(dbConnection_);
|
||||
}
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
@ -106,7 +106,7 @@ void obelisk::KnowledgeBase::addVerbs(std::vector<obelisk::Verb>& verbs)
|
||||
{
|
||||
try
|
||||
{
|
||||
verb.insertVerb(dbConnection_);
|
||||
verb.insert(dbConnection_);
|
||||
}
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
@ -125,7 +125,7 @@ void obelisk::KnowledgeBase::addFacts(std::vector<obelisk::Fact>& facts)
|
||||
{
|
||||
try
|
||||
{
|
||||
fact.insertFact(dbConnection_);
|
||||
fact.insert(dbConnection_);
|
||||
}
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
@ -142,17 +142,17 @@ void obelisk::KnowledgeBase::addFacts(std::vector<obelisk::Fact>& facts)
|
||||
|
||||
void obelisk::KnowledgeBase::getEntity(obelisk::Entity& entity)
|
||||
{
|
||||
entity.selectEntity(dbConnection_);
|
||||
entity.select(dbConnection_);
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::getVerb(obelisk::Verb& verb)
|
||||
{
|
||||
verb.selectVerb(dbConnection_);
|
||||
verb.select(dbConnection_);
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::getFact(obelisk::Fact& fact)
|
||||
{
|
||||
fact.selectFact(dbConnection_);
|
||||
fact.select(dbConnection_);
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::getFloat(float& result1, float& result2, double var)
|
||||
|
@ -12,7 +12,7 @@ const char* obelisk::Entity::createTable()
|
||||
)";
|
||||
}
|
||||
|
||||
void obelisk::Entity::selectEntity(sqlite3* dbConnection)
|
||||
void obelisk::Entity::select(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
@ -76,7 +76,7 @@ void obelisk::Entity::selectEntity(sqlite3* dbConnection)
|
||||
}
|
||||
}
|
||||
|
||||
void obelisk::Entity::insertEntity(sqlite3* dbConnection)
|
||||
void obelisk::Entity::insert(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace obelisk
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectEntity(sqlite3* dbConnection);
|
||||
void select(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert an Entity into the database based on the object's
|
||||
@ -120,7 +120,7 @@ namespace obelisk
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insertEntity(sqlite3* dbConnection);
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
|
@ -19,7 +19,7 @@ const char* obelisk::Fact::createTable()
|
||||
)";
|
||||
}
|
||||
|
||||
void obelisk::Fact::selectFact(sqlite3* dbConnection)
|
||||
void obelisk::Fact::select(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
@ -126,7 +126,7 @@ void obelisk::Fact::selectFact(sqlite3* dbConnection)
|
||||
}
|
||||
}
|
||||
|
||||
void obelisk::Fact::insertFact(sqlite3* dbConnection)
|
||||
void obelisk::Fact::insert(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
|
@ -76,8 +76,8 @@ namespace obelisk
|
||||
bool& getIsTrue();
|
||||
void setIsTrue(bool isTrue);
|
||||
|
||||
void selectFact(sqlite3* dbConnection);
|
||||
void insertFact(sqlite3* dbConnection);
|
||||
void select(sqlite3* dbConnection);
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
|
@ -14,7 +14,7 @@ const char* obelisk::Verb::createTable()
|
||||
)";
|
||||
}
|
||||
|
||||
void obelisk::Verb::selectVerb(sqlite3* dbConnection)
|
||||
void obelisk::Verb::select(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
@ -76,7 +76,7 @@ void obelisk::Verb::selectVerb(sqlite3* dbConnection)
|
||||
}
|
||||
}
|
||||
|
||||
void obelisk::Verb::insertVerb(sqlite3* dbConnection)
|
||||
void obelisk::Verb::insert(sqlite3* dbConnection)
|
||||
{
|
||||
if (dbConnection == nullptr)
|
||||
{
|
||||
|
@ -112,14 +112,14 @@ namespace obelisk
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectVerb(sqlite3* dbConnection);
|
||||
void select(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert a new verb into the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insertVerb(sqlite3* dbConnection);
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user