2024-05-18 09:05:55 +00:00
|
|
|
#include "IBehaviors.h"
|
|
|
|
|
|
|
|
#include "MySQLDatabase.h"
|
|
|
|
|
|
|
|
void MySQLDatabase::AddBehavior(const IBehaviors::Info& info) {
|
|
|
|
ExecuteInsert(
|
|
|
|
"INSERT INTO behaviors (behavior_info, character_id, behavior_id) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE behavior_info = ?",
|
|
|
|
info.behaviorInfo, info.characterId, info.behaviorId, info.behaviorInfo
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-05-18 10:36:29 +00:00
|
|
|
void MySQLDatabase::RemoveBehavior(const int32_t behaviorId) {
|
2024-05-18 09:05:55 +00:00
|
|
|
ExecuteDelete("DELETE FROM behaviors WHERE behavior_id = ?", behaviorId);
|
|
|
|
}
|
2024-05-18 10:36:29 +00:00
|
|
|
|
|
|
|
std::string MySQLDatabase::GetBehavior(const int32_t behaviorId) {
|
|
|
|
auto result = ExecuteSelect("SELECT behavior_info FROM behaviors WHERE behavior_id = ?", behaviorId);
|
|
|
|
return result->next() ? result->getString("behavior_info").c_str() : "";
|
|
|
|
}
|