mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 09:06:46 +00:00
[Bug Fix] Fix Instance Repository (#2598)
Instance code used to use a `REPLACE INTO`, add an extended repository method to do this so we're not getting `DUPLICATE` errors.
This commit is contained in:
@@ -73,6 +73,27 @@ public:
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static bool ReplaceOne(Database& db, InstanceListPlayer e)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"REPLACE INTO {} VALUES ({})",
|
||||
TableName(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
if (results.Success()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_INSTANCE_LIST_PLAYER_REPOSITORY_H
|
||||
|
||||
Reference in New Issue
Block a user