mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
feat(Core/Database): port TrinityCore database API (#5611)
This commit is contained in:
@@ -81,10 +81,10 @@ bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner)
|
||||
void Corpse::SaveToDB()
|
||||
{
|
||||
// prevent DB data inconsistence problems and duplicates
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
DeleteFromDB(trans);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
|
||||
stmt->setUInt32(0, GetOwnerGUID().GetCounter()); // guid
|
||||
stmt->setFloat (1, GetPositionX()); // posX
|
||||
stmt->setFloat (2, GetPositionY()); // posY
|
||||
@@ -107,14 +107,14 @@ void Corpse::SaveToDB()
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void Corpse::DeleteFromDB(SQLTransaction& trans)
|
||||
void Corpse::DeleteFromDB(CharacterDatabaseTransaction trans)
|
||||
{
|
||||
DeleteFromDB(GetOwnerGUID(), trans);
|
||||
}
|
||||
|
||||
void Corpse::DeleteFromDB(ObjectGuid const ownerGuid, SQLTransaction& trans)
|
||||
void Corpse::DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
stmt->setUInt32(0, ownerGuid.GetCounter());
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
void SaveToDB();
|
||||
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
|
||||
|
||||
void DeleteFromDB(SQLTransaction& trans);
|
||||
static void DeleteFromDB(ObjectGuid const ownerGuid, SQLTransaction& trans);
|
||||
void DeleteFromDB(CharacterDatabaseTransaction trans);
|
||||
static void DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans);
|
||||
|
||||
[[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user