Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
Server/DBProcess/RylDBLibrary/ReadMe.txt
Normal file
21
Server/DBProcess/RylDBLibrary/ReadMe.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
========================================================================
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺귯<CCBA><EAB7AF> : RylDBLibrary <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
========================================================================
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD>翡<EFBFBD><E7BFA1> <20><> RylDBLibrary <20><><EFBFBD>̺귯<CCBA><EAB7AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾҽ<CABE><D2BD>ϴ<EFBFBD>.
|
||||
|
||||
|
||||
RylDBLibrary.vcproj
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD>縦 <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VC++ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>⺻ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>.
|
||||
<20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Visual C++<2B><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD>
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD>翡<EFBFBD><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD>ɿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
<EFBFBD><EFBFBD>Ÿ <20><><EFBFBD><EFBFBD>:
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>α<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD>翡<EFBFBD><E7BFA1> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> "TODO:" <20>ּ<EFBFBD><D6BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20>߰<EFBFBD><DFB0>ϰų<CFB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <20>ϴ<EFBFBD>
|
||||
<EFBFBD>ҽ<EFBFBD> <20>ڵ<EFBFBD> <20>κ<EFBFBD><CEBA><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD>ϴ<EFBFBD>.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
577
Server/DBProcess/RylDBLibrary/RylDBCharCommand.cpp
Normal file
577
Server/DBProcess/RylDBLibrary/RylDBCharCommand.cpp
Normal file
@@ -0,0 +1,577 @@
|
||||
#include <Log/ServerLog.h>
|
||||
#include "RylDBStoreCommand.h"
|
||||
#include "RylDBCharCommand.h"
|
||||
|
||||
namespace RylDBCommand
|
||||
{
|
||||
|
||||
#define BOUNDED_SUBTRACT(data, minusval, minbound) if ((data) < (minusval) + (minbound)) { (data) = (minbound); } else { (data) -= (minusval); }
|
||||
|
||||
void DBErrorLogByCID(DBErrorType eErrorType,
|
||||
unsigned long dwCID, HRESULT hr,
|
||||
const char* szClassName, const CString& DBStatus)
|
||||
{
|
||||
switch(eErrorType)
|
||||
{
|
||||
case DBERR_CONVERT_FAILED:
|
||||
ERRLOG2(g_Log, "CID:%10u / %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD>", dwCID, szClassName);
|
||||
break;
|
||||
|
||||
case DBERR_SETDATA_FAILED:
|
||||
ERRLOG4(g_Log, "CID:%10u / hr:0x%08x / %s SetData <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
dwCID, hr, szClassName, DBStatus);
|
||||
break;
|
||||
|
||||
case DBERR_UPDATE_FAILED:
|
||||
ERRLOG4(g_Log, "CID:%10u / hr:0x%08x / %s Update <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
dwCID, hr, szClassName, DBStatus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCharData::Init(void)
|
||||
{
|
||||
m_CID = 0;
|
||||
|
||||
memset(m_Name, 0, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
|
||||
memset(m_EquipData, 0, sizeof(BYTE) * MAX_EQUIP_DATA);
|
||||
|
||||
m_Sex = m_Hair = m_Face = m_Race = 0;
|
||||
m_Class = 0;
|
||||
|
||||
m_Fame = m_Mileage = m_GID = m_PID = 0;
|
||||
m_Level = 0;
|
||||
|
||||
m_Gold = 0;
|
||||
|
||||
m_IP = m_STR = m_DEX = m_CON = m_INT = m_WIS = m_HP = m_MP = 0;
|
||||
m_Exp = 0LL;
|
||||
|
||||
m_Chance = 0;
|
||||
m_NameLen = m_EquipLen = 0;
|
||||
|
||||
// Data Status
|
||||
m_CIDStatus = m_NameStatus = m_SexStatus = m_HairStatus =
|
||||
m_FaceStatus = m_RaceStatus = m_ClassStatus = m_FameStatus =
|
||||
m_MileageStatus = m_GIDStatus = m_PIDStatus = m_LevelStatus =
|
||||
m_GoldStatus = m_IPStatus = m_STRStatus = m_DEXStatus =
|
||||
m_CONStatus = m_INTStatus = m_WISStatus = m_HPStatus = m_MPStatus = m_ExpStatus =
|
||||
m_ChanceStatus = m_EquipDataStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool CCharData::operator == (const CCharData& rhs) const
|
||||
{
|
||||
return (m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Name, rhs.m_Name, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN) &&
|
||||
m_Sex == rhs.m_Sex &&
|
||||
m_Hair == rhs.m_Hair &&
|
||||
m_Face == rhs.m_Face &&
|
||||
m_Race == rhs.m_Race &&
|
||||
m_Class == rhs.m_Class &&
|
||||
m_Fame == rhs.m_Fame &&
|
||||
m_Mileage == rhs.m_Mileage &&
|
||||
m_GID == rhs.m_GID &&
|
||||
m_PID == rhs.m_PID &&
|
||||
m_Level == rhs.m_Level &&
|
||||
m_Gold == rhs.m_Gold &&
|
||||
m_IP == rhs.m_IP &&
|
||||
m_STR == rhs.m_STR &&
|
||||
m_DEX == rhs.m_DEX &&
|
||||
m_CON == rhs.m_CON &&
|
||||
m_INT == rhs.m_INT &&
|
||||
m_WIS == rhs.m_WIS &&
|
||||
m_HP == rhs.m_HP &&
|
||||
m_MP == rhs.m_MP &&
|
||||
m_Exp == rhs.m_Exp &&
|
||||
m_Chance == rhs.m_Chance &&
|
||||
0 == memcmp(m_EquipData, rhs.m_EquipData, sizeof(BYTE) * MAX_EQUIP_DATA));
|
||||
}
|
||||
|
||||
void CCharData::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "CCharData", GetDBStatus());
|
||||
}
|
||||
|
||||
CString CCharData::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) "
|
||||
"Name:%s(0x%08x) "
|
||||
"Sex:%d(0x%08x) "
|
||||
"Hair:%d(0x%08x) "
|
||||
"Face:%d(0x%08x) "
|
||||
"Race:%d(0x%08x) "
|
||||
"Class:%d(0x%08x) "
|
||||
"Fame:%6d(0x%08x) "
|
||||
"Mileage:%6d(0x%08x) "
|
||||
"GID:%d(0x%08x) "
|
||||
"PID:%d(0x%08x) "
|
||||
"Level:%d(0x%08x) "
|
||||
"Gold:%10u(0x%08x) "
|
||||
"IP:%d(0x%08x) "
|
||||
"STR:%3d(0x%08x) "
|
||||
"DEX:%3d(0x%08x) "
|
||||
"CON:%3d(0x%08x) "
|
||||
"INT:%3d(0x%08x) "
|
||||
"WIS:%3d(0x%08x) "
|
||||
"HP:%d(0x%08x) "
|
||||
"MP:%d(0x%08x) "
|
||||
"Exp:%I64u(0x%08x) "
|
||||
"Chance:%d(0x%08x) "
|
||||
"Equipdata(0x%08x) ",
|
||||
m_CID, m_CIDStatus,
|
||||
m_Name, m_NameStatus,
|
||||
m_Sex, m_SexStatus,
|
||||
m_Hair, m_HairStatus,
|
||||
m_Face, m_FaceStatus,
|
||||
m_Race, m_RaceStatus,
|
||||
m_Class, m_ClassStatus,
|
||||
m_Fame, m_FameStatus,
|
||||
m_Mileage, m_MileageStatus,
|
||||
m_GID, m_GIDStatus,
|
||||
m_PID, m_PIDStatus,
|
||||
m_Level, m_LevelStatus,
|
||||
m_Gold, m_GoldStatus,
|
||||
m_IP, m_IPStatus,
|
||||
m_STR, m_STRStatus,
|
||||
m_DEX, m_DEXStatus,
|
||||
m_CON, m_CONStatus,
|
||||
m_INT, m_INTStatus,
|
||||
m_WIS, m_WISStatus,
|
||||
m_HP, m_HPStatus,
|
||||
m_MP, m_MPStatus,
|
||||
m_Exp, m_ExpStatus,
|
||||
m_Chance, m_ChanceStatus,
|
||||
m_EquipDataStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CSkillData::Init(void)
|
||||
{
|
||||
m_CID = 0;
|
||||
memset(m_Skill, 0, sizeof(BYTE) * sizeof(SKILL));
|
||||
|
||||
m_SkillLength = 0;
|
||||
m_CIDStatus = m_SkillStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void CSkillData::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "CSkillData", GetDBStatus());
|
||||
}
|
||||
|
||||
bool CSkillData::operator == (const CSkillData& rhs) const
|
||||
{
|
||||
return m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Skill, rhs.m_Skill, sizeof(SKILL));
|
||||
}
|
||||
|
||||
CString CSkillData::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) Skill(0x%08x)",
|
||||
m_CID, m_CIDStatus, m_SkillStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CCharItem::Init()
|
||||
{
|
||||
m_CID = 0;
|
||||
|
||||
memset(m_Quick, 0, sizeof(QUICK));
|
||||
memset(m_Equip, 0, sizeof(EQUIP));
|
||||
memset(m_Inven, 0, sizeof(INVEN));
|
||||
memset(m_Extra, 0, sizeof(EXTRA));
|
||||
|
||||
m_QuickLen = m_EquipLen = m_InvenLen = m_ExtraLen = 0;
|
||||
m_CIDStatus = m_QuickStatus = m_EquipStatus = m_InvenStatus = m_ExtraStatus = DBSTATUS_S_OK;
|
||||
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
|
||||
void CCharItem::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "CCharItem", GetDBStatus());
|
||||
}
|
||||
|
||||
void CCharItem::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustSize)
|
||||
{
|
||||
reinterpret_cast<EQUIP&>(m_Equip).dwSize += sizeof(unsigned long);
|
||||
reinterpret_cast<INVEN&>(m_Inven).dwSize += sizeof(unsigned long);
|
||||
reinterpret_cast<EXTRA&>(m_Extra).dwSize += sizeof(unsigned long);
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
else if (!bRestore && !m_bAdjustSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<EQUIP&>(m_Equip).dwSize, sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<INVEN&>(m_Inven).dwSize, sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<EXTRA&>(m_Extra).dwSize, sizeof(unsigned long), 0);
|
||||
m_bAdjustSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CCharItem::operator == (const CCharItem& rhs) const
|
||||
{
|
||||
return m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Quick, rhs.m_Quick, sizeof(QUICK)) &&
|
||||
0 == memcmp(m_Equip, rhs.m_Equip, sizeof(EQUIP)) &&
|
||||
0 == memcmp(m_Inven, rhs.m_Inven, sizeof(INVEN)) &&
|
||||
0 == memcmp(m_Extra, rhs.m_Extra, sizeof(EXTRA));
|
||||
}
|
||||
|
||||
CString CCharItem::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) Quick(0x%08x) "
|
||||
"Equip:%d(0x%08x) Inven:%d(0x%08x) Extra:%d(0x%08x)",
|
||||
m_CID, m_CIDStatus, m_QuickStatus,
|
||||
GetEquip().dwSize, m_EquipStatus,
|
||||
GetInven().dwSize, m_InvenStatus,
|
||||
GetExtra().dwSize, m_ExtraStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CCharItemEx::Init()
|
||||
{
|
||||
m_CID = 0;
|
||||
|
||||
memset(m_Exchange, 0, sizeof(EXCHANGE));
|
||||
memset(m_TempInven, 0, sizeof(TEMPINVEN));
|
||||
|
||||
m_ExchangeLen = m_TempInvenLen = 0;
|
||||
m_CIDStatus = m_ExchangeStatus = m_TempInvenStatus = DBSTATUS_S_OK;
|
||||
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
|
||||
void CCharItemEx::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "CCharItemEx", GetDBStatus());
|
||||
}
|
||||
|
||||
void CCharItemEx::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustSize)
|
||||
{
|
||||
reinterpret_cast<EXCHANGE&>(m_Exchange).dwSize += sizeof(unsigned long);
|
||||
reinterpret_cast<TEMPINVEN&>(m_TempInven).dwSize += sizeof(unsigned long);
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
else if (!bRestore && !m_bAdjustSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<EXCHANGE&>(m_Exchange).dwSize, sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<TEMPINVEN&>(m_TempInven).dwSize, sizeof(unsigned long), 0);
|
||||
m_bAdjustSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CCharItemEx::operator == (const CCharItemEx& rhs) const
|
||||
{
|
||||
return m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Exchange, rhs.m_Exchange, sizeof(EXCHANGE)) &&
|
||||
0 == memcmp(m_TempInven, rhs.m_TempInven, sizeof(TEMPINVEN));
|
||||
}
|
||||
|
||||
CString CCharItemEx::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) Exchange:%d(0x%08x) TempInven:%d(0x%08x)",
|
||||
m_CID, m_CIDStatus, GetExchange().dwSize, m_ExchangeStatus,
|
||||
GetTempInven().dwSize, m_TempInvenStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CCharQuest::Init()
|
||||
{
|
||||
m_CID = 0;
|
||||
|
||||
memset(m_Quest, 0, sizeof(QUEST));
|
||||
memset(m_History, 0, sizeof(HISTORY));
|
||||
|
||||
m_QuestLen = m_HistoryLen = 0;
|
||||
m_CIDStatus = m_QuestStatus = m_HistoryStatus = DBSTATUS_S_OK;
|
||||
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
|
||||
void CCharQuest::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "CCharQuest", GetDBStatus());
|
||||
}
|
||||
|
||||
void CCharQuest::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustSize)
|
||||
{
|
||||
reinterpret_cast<QUEST&>(m_Quest).dwSize += sizeof(unsigned long);
|
||||
reinterpret_cast<HISTORY&>(m_History).dwSize += sizeof(unsigned long);
|
||||
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
else if(!bRestore && !m_bAdjustSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<QUEST&>(m_Quest).dwSize, sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<HISTORY&>(m_History).dwSize, sizeof(unsigned long), 0);
|
||||
|
||||
m_bAdjustSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CCharQuest::operator == (const CCharQuest& rhs) const
|
||||
{
|
||||
return m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Quest, rhs.m_Quest, sizeof(QUEST)) &&
|
||||
0 == memcmp(m_History, rhs.m_History, sizeof(HISTORY));
|
||||
}
|
||||
|
||||
CString CCharQuest::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) Quest(0x%08x) History(0x%08x)",
|
||||
m_CID, m_CIDStatus, m_QuestStatus, m_HistoryStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CPartyData::Init()
|
||||
{
|
||||
m_PID = m_GID = 0;
|
||||
memset(m_PartyInfo, 0, sizeof(m_PartyInfo));
|
||||
memset(m_UserInfo, 0, sizeof(m_UserInfo));
|
||||
|
||||
m_PartyLen = sizeof(m_PartyInfo);
|
||||
m_UserInfoLen = sizeof(m_UserInfo);
|
||||
|
||||
m_PIDStatus = m_GIDStatus =
|
||||
m_PartyStatus = m_UserInfoStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void CPartyData::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
switch(eErrorType)
|
||||
{
|
||||
case DBERR_CONVERT_FAILED:
|
||||
ERRLOG1(g_Log, "PID:%10u / CPartyData <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD>", GetPID());
|
||||
break;
|
||||
|
||||
case DBERR_SETDATA_FAILED:
|
||||
ERRLOG3(g_Log, "PID:%10u / hr:0x%08x / CPartyData SetData <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetPID(), hr, GetDBStatus());
|
||||
break;
|
||||
|
||||
case DBERR_UPDATE_FAILED:
|
||||
ERRLOG3(g_Log, "PID:%10u / hr:0x%08x / CPartyData Update <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetPID(), hr, GetDBStatus());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CPartyData::operator == (const CPartyData& rhs) const
|
||||
{
|
||||
return (m_PID == rhs.m_PID &&
|
||||
m_GID == rhs.m_GID &&
|
||||
0 == memcmp(m_PartyInfo, rhs.m_PartyInfo, sizeof(m_PartyInfo)) &&
|
||||
0 == memcmp(m_UserInfo, rhs.m_UserInfo, sizeof(m_UserInfo)));
|
||||
}
|
||||
|
||||
CString CPartyData::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("PID:%10u(0x%08x) GID:%10u(0x%08x) Party(0x%08x) PartyUserInfo(0x%08x)",
|
||||
m_PID, m_PIDStatus, m_GID, m_GIDStatus, m_PartyStatus, m_UserInfoStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
|
||||
void CFriendData::Init()
|
||||
{
|
||||
m_CID = 0;
|
||||
memset(m_Friend, 0, sizeof(m_Friend));
|
||||
memset(m_Ban, 0, sizeof(m_Ban));
|
||||
|
||||
memset(m_FriendInfo, 0, sizeof(m_FriendInfo));
|
||||
memset(m_BanInfo, 0, sizeof(m_BanInfo));
|
||||
|
||||
m_FriendLen = sizeof(m_Friend);
|
||||
m_BanLen = sizeof(m_Ban);
|
||||
m_FriendInfoLen = sizeof(m_FriendInfo);
|
||||
m_BanInfoLen = sizeof(m_BanInfo);
|
||||
|
||||
m_CIDStatus = m_FriendStatus =
|
||||
m_BanStatus = m_FriendInfoStatus = m_BanInfoStatus = DBSTATUS_S_OK;
|
||||
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
|
||||
void CFriendData::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustSize)
|
||||
{
|
||||
*reinterpret_cast<unsigned long*>(m_Friend) += sizeof(unsigned long);
|
||||
*reinterpret_cast<unsigned long*>(m_FriendInfo) += sizeof(unsigned long);
|
||||
*reinterpret_cast<unsigned long*>(m_Ban) += sizeof(unsigned long);
|
||||
*reinterpret_cast<unsigned long*>(m_BanInfo) += sizeof(unsigned long);
|
||||
m_bAdjustSize = false;
|
||||
}
|
||||
else if (!bRestore && !m_bAdjustSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(*reinterpret_cast<unsigned long*>(m_Friend), sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(*reinterpret_cast<unsigned long*>(m_FriendInfo), sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(*reinterpret_cast<unsigned long*>(m_Ban), sizeof(unsigned long), 0);
|
||||
BOUNDED_SUBTRACT(*reinterpret_cast<unsigned long*>(m_BanInfo), sizeof(unsigned long), 0);
|
||||
m_bAdjustSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CFriendData::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
DBErrorLogByCID(eErrorType, GetCID(), hr, "FriendData", GetDBStatus());
|
||||
}
|
||||
|
||||
const FRIEND CFriendData::GetFriend() const
|
||||
{
|
||||
FRIEND localFriend;
|
||||
memcpy(&localFriend, m_Friend, sizeof(m_Friend));
|
||||
memcpy(reinterpret_cast<BYTE*>(&localFriend) + sizeof(m_Friend),
|
||||
m_FriendInfo, sizeof(m_FriendInfo));
|
||||
|
||||
return localFriend;
|
||||
}
|
||||
|
||||
const BAN CFriendData::GetBan() const
|
||||
{
|
||||
BAN localBan;
|
||||
|
||||
memcpy(&localBan, m_Ban, sizeof(m_Ban));
|
||||
|
||||
memcpy(reinterpret_cast<BYTE*>(&localBan) + sizeof(m_Ban),
|
||||
m_BanInfo, sizeof(m_BanInfo));
|
||||
|
||||
return localBan;
|
||||
}
|
||||
|
||||
void CFriendData::SetFriend(const FRIEND& friendData)
|
||||
{
|
||||
memcpy(m_Friend, &friendData.dwSize, sizeof(friendData.dwSize));
|
||||
memcpy(m_Friend + sizeof(friendData.dwSize),
|
||||
friendData.Data, sizeof(friendData.Data));
|
||||
|
||||
memcpy(m_FriendInfo, &friendData.dwInfoSize, sizeof(friendData.dwInfoSize));
|
||||
memcpy(m_FriendInfo + sizeof(friendData.dwInfoSize),
|
||||
friendData.Info, sizeof(friendData.Info));
|
||||
|
||||
m_FriendLen = sizeof(m_Friend);
|
||||
m_FriendInfoLen = sizeof(m_FriendInfo);
|
||||
m_FriendStatus = DBSTATUS_S_OK;
|
||||
m_FriendInfoStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void CFriendData::SetBan(const BAN& banData)
|
||||
{
|
||||
memcpy(m_Ban, &banData.dwSize, sizeof(banData.dwSize));
|
||||
memcpy(m_Ban + sizeof(banData.dwSize),
|
||||
banData.Data, sizeof(banData.Data));
|
||||
|
||||
memcpy(m_BanInfo, &banData.dwInfoSize, sizeof(banData.dwInfoSize));
|
||||
memcpy(m_BanInfo + sizeof(banData.dwSize),
|
||||
banData.Info, sizeof(banData.Info));
|
||||
|
||||
m_BanLen = sizeof(m_Ban);
|
||||
m_BanInfoLen = sizeof(m_BanInfo);
|
||||
m_BanStatus = DBSTATUS_S_OK;
|
||||
m_BanInfoStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool CFriendData::operator == (const CFriendData& rhs) const
|
||||
{
|
||||
return m_CID == rhs.m_CID &&
|
||||
0 == memcmp(m_Friend, rhs.m_Friend, sizeof(m_Friend)) &&
|
||||
0 == memcmp(m_Ban, rhs.m_Ban, sizeof(m_Ban)) &&
|
||||
0 == memcmp(m_FriendInfo, rhs.m_FriendInfo, sizeof(m_FriendInfo)) &&
|
||||
0 == memcmp(m_BanInfo, rhs.m_BanInfo, sizeof(m_BanInfo));
|
||||
}
|
||||
|
||||
CString CFriendData::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("CID:%10u(0x%08x) Friend(0x%08x) Ban(0x%08x) FriendInfo(0x%08x) BanInfo(0x%08x)",
|
||||
m_CID, m_CIDStatus, m_FriendStatus, m_BanStatus, m_FriendInfoStatus, m_BanInfoStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
|
||||
void CUnifiedCharList::Init()
|
||||
{
|
||||
m_UID = m_BeforeCID = m_NewCID = 0;
|
||||
memset(m_BeforeCharName, 0, sizeof(m_BeforeCharName));
|
||||
|
||||
m_OldServerGroupID = 0;
|
||||
m_BeforeCharNameLen = 0;
|
||||
|
||||
m_UIDStatus = m_OldServerGroupIDStatus = m_BeforeCIDStatus =
|
||||
m_NewCIDStatus = m_BeforeCharNameStatus = DBSTATUS_S_ISNULL;
|
||||
}
|
||||
|
||||
void CUnifiedCharList::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
switch(eErrorType)
|
||||
{
|
||||
case DBERR_CONVERT_FAILED:
|
||||
ERRLOG2(g_Log, "UID:%10u / NewCID:%10u / CUnifiedCharList <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD>",
|
||||
GetUID(), GetNewCID());
|
||||
break;
|
||||
|
||||
case DBERR_SETDATA_FAILED:
|
||||
ERRLOG4(g_Log, "CID:%10u / NewCID:%10u / hr:0x%08x / CUnifiedCharList SetData <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), GetNewCID(), hr, GetDBStatus());
|
||||
break;
|
||||
|
||||
case DBERR_UPDATE_FAILED:
|
||||
ERRLOG4(g_Log, "CID:%10u / NewCID:%10u / hr:0x%08x / CUnifiedCharList Update <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), GetNewCID(), hr, GetDBStatus());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CString CUnifiedCharList::GetDBStatus()
|
||||
{
|
||||
CString DBStatus;
|
||||
|
||||
DBStatus.Format("UIDStatus(0x%08x)/OldServerGroupID(0x%08x)/BeforeCIDStatus(0x%08x)/"
|
||||
"NewCIDStatus(0x%08x)/BeforeCharNameStatus(0x%08x)",
|
||||
m_UIDStatus, m_OldServerGroupIDStatus,
|
||||
m_BeforeCIDStatus, m_NewCIDStatus, m_BeforeCharNameStatus);
|
||||
|
||||
return DBStatus;
|
||||
}
|
||||
|
||||
bool CUnifiedCharList::operator == (const CUnifiedCharList& rhs) const
|
||||
{
|
||||
return m_UID == rhs.m_UID &&
|
||||
m_BeforeCID == rhs.m_BeforeCID &&
|
||||
m_NewCID == rhs.m_NewCID &&
|
||||
m_OldServerGroupID == rhs.m_OldServerGroupID &&
|
||||
0 == memcmp(m_BeforeCharName, rhs.m_BeforeCharName, sizeof(m_BeforeCharName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
675
Server/DBProcess/RylDBLibrary/RylDBCharCommand.h
Normal file
675
Server/DBProcess/RylDBLibrary/RylDBCharCommand.h
Normal file
@@ -0,0 +1,675 @@
|
||||
#ifndef _RYL_DB_CHARACTER_PROCESS_COMMAND_H_
|
||||
#define _RYL_DB_CHARACTER_PROCESS_COMMAND_H_
|
||||
|
||||
#include <atlstr.h>
|
||||
#include <atldbcli.h>
|
||||
#include <DB/DBdefine.h>
|
||||
#include "RylDBCommand.h"
|
||||
|
||||
namespace RylDBCommand
|
||||
{
|
||||
|
||||
class CCharData : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_COLUMN_NUM = 25,
|
||||
MAX_EQUIP_DATA = 30
|
||||
};
|
||||
|
||||
CCharData() { Init(); }
|
||||
|
||||
void Init(void);
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
const char* GetName() const { return m_Name; }
|
||||
|
||||
unsigned char GetSex() const { return m_Sex; }
|
||||
unsigned char GetHair() const { return m_Hair; }
|
||||
unsigned char GetFace() const { return m_Face; }
|
||||
unsigned char GetRace() const { return m_Race; }
|
||||
short GetClass() const { return m_Class; }
|
||||
|
||||
unsigned long GetFame() const { return static_cast<unsigned long>(m_Fame); }
|
||||
unsigned long GetMileage() const { return static_cast<unsigned long>(m_Mileage); }
|
||||
unsigned long GetGID() const { return static_cast<unsigned long>(m_GID); }
|
||||
unsigned long GetPID() const { return static_cast<unsigned long>(m_PID); }
|
||||
unsigned char GetLevel() const { return m_Level; }
|
||||
|
||||
unsigned long GetGold() const { return static_cast<unsigned long>(m_Gold); }
|
||||
|
||||
short GetIP() const { return m_IP; }
|
||||
short GetSTR() const { return m_STR; }
|
||||
short GetDEX() const { return m_DEX; }
|
||||
short GetCON() const { return m_CON; }
|
||||
short GetINT() const { return m_INT; }
|
||||
short GetWIS() const { return m_WIS; }
|
||||
|
||||
short GetHP() const { return m_HP; }
|
||||
short GetMP() const { return m_MP; }
|
||||
|
||||
unsigned __int64 GetEXP() const { return m_Exp; }
|
||||
unsigned char GetChance() const { return m_Chance; }
|
||||
|
||||
|
||||
// CID<49><44> <20>ٲ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD><D9B2><EFBFBD> <20>ʴ´<CAB4>.
|
||||
void SetGold(unsigned long Gold) { m_Gold = Gold; m_GoldStatus = DBSTATUS_S_OK; }
|
||||
void SetFame(unsigned long Fame) { m_Fame = Fame; m_FameStatus = DBSTATUS_S_OK; }
|
||||
void SetMileage(unsigned long Mileage) { m_Mileage = Mileage; m_MileageStatus = DBSTATUS_S_OK; }
|
||||
|
||||
bool operator == (const CCharData& rhs) const;
|
||||
bool operator != (const CCharData& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CCharData, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Name, m_NameLen, m_NameStatus)
|
||||
COLUMN_ENTRY_STATUS(3, m_Sex, m_SexStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_Hair, m_HairStatus)
|
||||
COLUMN_ENTRY_STATUS(5, m_Face, m_FaceStatus)
|
||||
COLUMN_ENTRY_STATUS(6, m_Race, m_RaceStatus)
|
||||
COLUMN_ENTRY_STATUS(7, m_Class, m_ClassStatus)
|
||||
COLUMN_ENTRY_STATUS(8, m_Fame, m_FameStatus)
|
||||
COLUMN_ENTRY_STATUS(9, m_Mileage, m_MileageStatus)
|
||||
COLUMN_ENTRY_STATUS(10, m_GID, m_GIDStatus)
|
||||
COLUMN_ENTRY_STATUS(11, m_PID, m_PIDStatus)
|
||||
COLUMN_ENTRY_STATUS(12, m_Level, m_LevelStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(13, m_EquipData, m_EquipLen, m_EquipDataStatus)
|
||||
COLUMN_ENTRY_STATUS(14, m_Gold, m_GoldStatus)
|
||||
COLUMN_ENTRY_STATUS(15, m_IP, m_IPStatus)
|
||||
COLUMN_ENTRY_STATUS(16, m_STR, m_STRStatus)
|
||||
COLUMN_ENTRY_STATUS(17, m_DEX, m_DEXStatus)
|
||||
COLUMN_ENTRY_STATUS(18, m_CON, m_CONStatus)
|
||||
COLUMN_ENTRY_STATUS(19, m_INT, m_INTStatus)
|
||||
COLUMN_ENTRY_STATUS(20, m_WIS, m_WISStatus)
|
||||
COLUMN_ENTRY_STATUS(21, m_HP, m_HPStatus)
|
||||
COLUMN_ENTRY_STATUS(22, m_MP, m_MPStatus)
|
||||
COLUMN_ENTRY_STATUS(23, m_Exp, m_ExpStatus)
|
||||
COLUMN_ENTRY_STATUS(24, m_Chance, m_ChanceStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_STATUS(3, m_Sex, m_SexStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_Hair, m_HairStatus)
|
||||
COLUMN_ENTRY_STATUS(5, m_Face, m_FaceStatus)
|
||||
COLUMN_ENTRY_STATUS(6, m_Race, m_RaceStatus)
|
||||
COLUMN_ENTRY_STATUS(7, m_Class, m_ClassStatus)
|
||||
COLUMN_ENTRY_STATUS(8, m_Fame, m_FameStatus)
|
||||
COLUMN_ENTRY_STATUS(9, m_Mileage, m_MileageStatus)
|
||||
COLUMN_ENTRY_STATUS(10, m_GID, m_GIDStatus)
|
||||
COLUMN_ENTRY_STATUS(11, m_PID, m_PIDStatus)
|
||||
COLUMN_ENTRY_STATUS(12, m_Level, m_LevelStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(13, m_EquipData, m_EquipLen, m_EquipDataStatus)
|
||||
COLUMN_ENTRY_STATUS(14, m_Gold, m_GoldStatus)
|
||||
COLUMN_ENTRY_STATUS(15, m_IP, m_IPStatus)
|
||||
COLUMN_ENTRY_STATUS(16, m_STR, m_STRStatus)
|
||||
COLUMN_ENTRY_STATUS(17, m_DEX, m_DEXStatus)
|
||||
COLUMN_ENTRY_STATUS(18, m_CON, m_CONStatus)
|
||||
COLUMN_ENTRY_STATUS(19, m_INT, m_INTStatus)
|
||||
COLUMN_ENTRY_STATUS(20, m_WIS, m_WISStatus)
|
||||
COLUMN_ENTRY_STATUS(21, m_HP, m_HPStatus)
|
||||
COLUMN_ENTRY_STATUS(22, m_MP, m_MPStatus)
|
||||
COLUMN_ENTRY_STATUS(23, m_Exp, m_ExpStatus)
|
||||
COLUMN_ENTRY_STATUS(24, m_Chance, m_ChanceStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
|
||||
char m_Name[CHAR_INFOST::MAX_NAME_LEN]; // ij<><C4B3><EFBFBD><EFBFBD> <20≯<EFBFBD>
|
||||
unsigned char m_Sex; // ij<><C4B3><EFBFBD><EFBFBD> <20><>
|
||||
unsigned char m_Hair; // ij<><C4B3><EFBFBD><EFBFBD> <20>Ӹ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
unsigned char m_Face; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
unsigned char m_Race; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
short m_Class; // ij<><C4B3><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD>
|
||||
|
||||
int m_Fame; // <20><><EFBFBD><EFBFBD>
|
||||
int m_Mileage; // <20><><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>
|
||||
int m_GID; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
int m_PID; // ij<><C4B3><EFBFBD><EFBFBD> <20><>Ƽ
|
||||
unsigned char m_Level; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
int m_Gold; // <20><>
|
||||
|
||||
short m_IP; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ
|
||||
short m_STR; // ij<><C4B3><EFBFBD><EFBFBD> STR
|
||||
short m_DEX; // ij<><C4B3><EFBFBD><EFBFBD> DEX
|
||||
short m_CON; // ij<><C4B3><EFBFBD><EFBFBD> CON
|
||||
short m_INT; // ij<><C4B3><EFBFBD><EFBFBD> INT
|
||||
short m_WIS; // ij<><C4B3><EFBFBD><EFBFBD> WIS
|
||||
|
||||
short m_HP; // ij<><C4B3><EFBFBD><EFBFBD> HP
|
||||
short m_MP; // ij<><C4B3><EFBFBD><EFBFBD> MP
|
||||
__int64 m_Exp; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned char m_Chance; // ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
BYTE m_EquipData[MAX_EQUIP_DATA];
|
||||
|
||||
DBLENGTH m_NameLen;
|
||||
DBLENGTH m_EquipLen;
|
||||
|
||||
// Data Status
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_NameStatus;
|
||||
DBSTATUSENUM m_SexStatus;
|
||||
DBSTATUSENUM m_HairStatus;
|
||||
DBSTATUSENUM m_FaceStatus;
|
||||
DBSTATUSENUM m_RaceStatus;
|
||||
DBSTATUSENUM m_ClassStatus;
|
||||
DBSTATUSENUM m_FameStatus;
|
||||
DBSTATUSENUM m_MileageStatus;
|
||||
DBSTATUSENUM m_GIDStatus;
|
||||
DBSTATUSENUM m_PIDStatus;
|
||||
DBSTATUSENUM m_LevelStatus;
|
||||
DBSTATUSENUM m_GoldStatus;
|
||||
DBSTATUSENUM m_IPStatus;
|
||||
DBSTATUSENUM m_STRStatus;
|
||||
DBSTATUSENUM m_DEXStatus;
|
||||
DBSTATUSENUM m_CONStatus;
|
||||
DBSTATUSENUM m_INTStatus;
|
||||
DBSTATUSENUM m_WISStatus;
|
||||
DBSTATUSENUM m_HPStatus;
|
||||
DBSTATUSENUM m_MPStatus;
|
||||
DBSTATUSENUM m_ExpStatus;
|
||||
DBSTATUSENUM m_ChanceStatus;
|
||||
DBSTATUSENUM m_EquipDataStatus;
|
||||
};
|
||||
|
||||
|
||||
class CSkillData : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CSkillData() { Init(); }
|
||||
|
||||
void Init(void);
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
const SKILL& GetSkill() const { return reinterpret_cast<const SKILL&>(m_Skill); }
|
||||
void SetSkill(const SKILL& skill)
|
||||
{
|
||||
memcpy(m_Skill, &skill, sizeof(SKILL));
|
||||
m_SkillLength = sizeof(SKILL);
|
||||
m_SkillStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CSkillData& rhs) const;
|
||||
bool operator != (const CSkillData& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CSkillData, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Skill, m_SkillLength, m_SkillStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Skill, m_SkillLength, m_SkillStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
BYTE m_Skill[sizeof(SKILL)];
|
||||
|
||||
DBLENGTH m_SkillLength;
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_SkillStatus;
|
||||
};
|
||||
|
||||
|
||||
class CCharItem : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CCharItem() { Init(); }
|
||||
|
||||
void Init();
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
void AdjustSize(bool bRestore);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
|
||||
const QUICK& GetQuick() const { return reinterpret_cast<const QUICK&>(m_Quick); }
|
||||
const EQUIP& GetEquip() const { return reinterpret_cast<const EQUIP&>(m_Equip); }
|
||||
const INVEN& GetInven() const { return reinterpret_cast<const INVEN&>(m_Inven); }
|
||||
const EXTRA& GetExtra() const { return reinterpret_cast<const EXTRA&>(m_Extra); }
|
||||
|
||||
void SetQuick(const QUICK& quick)
|
||||
{
|
||||
memcpy(m_Quick, &quick, sizeof(QUICK));
|
||||
m_QuickLen = sizeof(QUICK);
|
||||
m_QuickStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetEquip(const EQUIP& equip)
|
||||
{
|
||||
memcpy(m_Equip, &equip, sizeof(EQUIP));
|
||||
m_EquipLen = sizeof(EQUIP);
|
||||
m_EquipStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetInven(const INVEN& inven)
|
||||
{
|
||||
memcpy(m_Inven, &inven, sizeof(INVEN));
|
||||
m_InvenLen = sizeof(INVEN);
|
||||
m_InvenStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetExtra(const EXTRA& extra)
|
||||
{
|
||||
memcpy(m_Extra, &extra, sizeof(EXTRA));
|
||||
m_ExtraLen = sizeof(EXTRA);
|
||||
m_ExtraStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CCharItem& rhs) const;
|
||||
bool operator != (const CCharItem& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CCharItem, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Quick, m_QuickLen, m_QuickStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Equip, m_EquipLen, m_EquipStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(4, m_Inven, m_InvenLen, m_InvenStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_Extra, m_ExtraLen, m_ExtraStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Quick, m_QuickLen, m_QuickStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Equip, m_EquipLen, m_EquipStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(4, m_Inven, m_InvenLen, m_InvenStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_Extra, m_ExtraLen, m_ExtraStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
|
||||
BYTE m_Quick[sizeof(QUICK)];
|
||||
BYTE m_Equip[sizeof(EQUIP)];
|
||||
BYTE m_Inven[sizeof(INVEN)];
|
||||
BYTE m_Extra[sizeof(EXTRA)];
|
||||
|
||||
DBLENGTH m_QuickLen;
|
||||
DBLENGTH m_EquipLen;
|
||||
DBLENGTH m_InvenLen;
|
||||
DBLENGTH m_ExtraLen;
|
||||
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_QuickStatus;
|
||||
DBSTATUSENUM m_EquipStatus;
|
||||
DBSTATUSENUM m_InvenStatus;
|
||||
DBSTATUSENUM m_ExtraStatus;
|
||||
|
||||
bool m_bAdjustSize;
|
||||
};
|
||||
|
||||
|
||||
class CCharItemEx : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CCharItemEx() { Init(); }
|
||||
|
||||
void Init();
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
void AdjustSize(bool bRestore);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
|
||||
const EXCHANGE& GetExchange() const { return reinterpret_cast<const EXCHANGE&>(m_Exchange); }
|
||||
const TEMPINVEN& GetTempInven() const { return reinterpret_cast<const TEMPINVEN&>(m_TempInven); }
|
||||
|
||||
void SetExchange(const EXCHANGE& exchange)
|
||||
{
|
||||
memcpy(m_Exchange, &exchange, sizeof(EXCHANGE));
|
||||
m_ExchangeLen = sizeof(EXCHANGE);
|
||||
m_ExchangeStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetTempInven(const TEMPINVEN& tempInven)
|
||||
{
|
||||
memcpy(m_TempInven, &tempInven, sizeof(TEMPINVEN));
|
||||
m_TempInvenLen = sizeof(TEMPINVEN);
|
||||
m_TempInvenStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CCharItemEx& rhs) const;
|
||||
bool operator != (const CCharItemEx& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CCharItemEx, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Exchange, m_ExchangeLen, m_ExchangeStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_TempInven, m_TempInvenLen, m_TempInvenStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Exchange, m_ExchangeLen, m_ExchangeStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_TempInven, m_TempInvenLen, m_TempInvenStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
|
||||
BYTE m_Exchange[sizeof(EXCHANGE)];
|
||||
BYTE m_TempInven[sizeof(TEMPINVEN)];
|
||||
|
||||
DBLENGTH m_ExchangeLen;
|
||||
DBLENGTH m_TempInvenLen;
|
||||
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_ExchangeStatus;
|
||||
DBSTATUSENUM m_TempInvenStatus;
|
||||
|
||||
bool m_bAdjustSize;
|
||||
};
|
||||
|
||||
class CCharQuest : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CCharQuest() { Init(); }
|
||||
|
||||
void Init();
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
void AdjustSize(bool bRestore);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
const QUEST& GetQuest() const { return reinterpret_cast<const QUEST&>(m_Quest); }
|
||||
const HISTORY& GetHistory() const { return reinterpret_cast<const HISTORY&>(m_History); }
|
||||
|
||||
void SetQuest(QUEST& quest)
|
||||
{
|
||||
memcpy(m_Quest, &quest, sizeof(QUEST));
|
||||
m_QuestLen = sizeof(QUEST);
|
||||
m_QuestStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetHistory(HISTORY& history)
|
||||
{
|
||||
memcpy(m_History, &history, sizeof(HISTORY));
|
||||
m_HistoryLen = sizeof(HISTORY);
|
||||
m_HistoryStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CCharQuest& rhs) const;
|
||||
bool operator != (const CCharQuest& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CCharQuest, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Quest, m_QuestLen, m_QuestStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_History, m_HistoryLen, m_HistoryStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Quest, m_QuestLen, m_QuestStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_History, m_HistoryLen, m_HistoryStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
|
||||
BYTE m_Quest[sizeof(QUEST)];
|
||||
BYTE m_History[sizeof(HISTORY)];
|
||||
|
||||
DBLENGTH m_QuestLen;
|
||||
DBLENGTH m_HistoryLen;
|
||||
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_QuestStatus;
|
||||
DBSTATUSENUM m_HistoryStatus;
|
||||
|
||||
bool m_bAdjustSize;
|
||||
};
|
||||
|
||||
class CPartyData : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CPartyData() { Init(); }
|
||||
|
||||
void Init();
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetPID() const { return static_cast<unsigned long>(m_PID); }
|
||||
unsigned long GetGID() const { return static_cast<unsigned long>(m_GID); }
|
||||
|
||||
const PARTY_DB_INFO GetParty() const
|
||||
{
|
||||
PARTY_DB_INFO dbInfo;
|
||||
|
||||
memcpy(&dbInfo.PartyInfo, m_PartyInfo, sizeof(m_PartyInfo));
|
||||
memcpy(&dbInfo.PartyUserInfo, m_UserInfo, sizeof(m_UserInfo));
|
||||
//dbInfo.dwGID = m_GID;
|
||||
|
||||
return dbInfo;
|
||||
}
|
||||
|
||||
void SetGID(unsigned long dwGID)
|
||||
{
|
||||
m_GID = dwGID;
|
||||
m_GIDStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetParty(const PARTY_INFO& partyInfo)
|
||||
{
|
||||
memcpy(m_PartyInfo, &partyInfo, sizeof(m_PartyInfo));
|
||||
m_PartyLen = sizeof(m_PartyInfo);
|
||||
m_PartyStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetUserInfo(const PARTY_USER_INFO& userInfo)
|
||||
{
|
||||
memcpy(m_UserInfo, &userInfo, sizeof(PARTY_USER_INFO));
|
||||
m_UserInfoLen = sizeof(PARTY_USER_INFO);
|
||||
m_UserInfoStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CPartyData& rhs) const;
|
||||
bool operator != (const CPartyData& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CPartyData, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_PID, m_PIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_PartyInfo, m_PartyLen, m_PartyStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_UserInfo, m_UserInfoLen, m_UserInfoStatus);
|
||||
COLUMN_ENTRY_STATUS(4, m_GID, m_GIDStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_PartyInfo, m_PartyLen, m_PartyStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_UserInfo, m_UserInfoLen, m_UserInfoStatus);
|
||||
COLUMN_ENTRY_STATUS(4, m_GID, m_GIDStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_PID;
|
||||
int m_GID;
|
||||
BYTE m_PartyInfo[sizeof(PARTY_INFO)];
|
||||
BYTE m_UserInfo[sizeof(PARTY_USER_INFO)];
|
||||
|
||||
DBLENGTH m_PartyLen;
|
||||
DBLENGTH m_UserInfoLen;
|
||||
|
||||
DBSTATUSENUM m_PIDStatus;
|
||||
DBSTATUSENUM m_GIDStatus;
|
||||
DBSTATUSENUM m_PartyStatus;
|
||||
DBSTATUSENUM m_UserInfoStatus;
|
||||
};
|
||||
|
||||
class CFriendData : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CFriendData() { Init(); }
|
||||
|
||||
void Init();
|
||||
void AdjustSize(bool bRestore);
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetCID() const { return static_cast<unsigned long>(m_CID); }
|
||||
|
||||
const FRIEND GetFriend() const;
|
||||
const BAN GetBan() const;
|
||||
|
||||
void SetFriend(const FRIEND& friendData);
|
||||
void SetBan(const BAN& banData);
|
||||
|
||||
bool operator == (const CFriendData& rhs) const;
|
||||
bool operator != (const CFriendData& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CFriendData, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_CID, m_CIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Friend, m_FriendLen, m_FriendStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Ban, m_BanLen, m_BanStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(4, m_FriendInfo, m_FriendInfoLen, m_FriendInfoStatus);
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_BanInfo, m_BanInfoLen, m_BanInfoStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(2, m_Friend, m_FriendLen, m_FriendStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Ban, m_BanLen, m_BanStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(4, m_FriendInfo, m_FriendInfoLen, m_FriendInfoStatus);
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_BanInfo, m_BanInfoLen, m_BanInfoStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_CID;
|
||||
BYTE m_Friend[_FRIEND::MAX_FRIEND_SIZE + sizeof(unsigned long)];
|
||||
BYTE m_Ban[_BAN::MAX_BAN_SIZE + sizeof(unsigned long)];
|
||||
|
||||
BYTE m_FriendInfo[_FRIEND::MAX_FRIENDINFO_SIZE + sizeof(unsigned long)];
|
||||
BYTE m_BanInfo[_BAN::MAX_BANINFO_SIZE + sizeof(unsigned long)];
|
||||
|
||||
DBLENGTH m_FriendLen;
|
||||
DBLENGTH m_BanLen;
|
||||
DBLENGTH m_FriendInfoLen;
|
||||
DBLENGTH m_BanInfoLen;
|
||||
|
||||
DBSTATUSENUM m_CIDStatus;
|
||||
DBSTATUSENUM m_FriendStatus;
|
||||
DBSTATUSENUM m_BanStatus;
|
||||
DBSTATUSENUM m_FriendInfoStatus;
|
||||
DBSTATUSENUM m_BanInfoStatus;
|
||||
|
||||
bool m_bAdjustSize;
|
||||
};
|
||||
|
||||
|
||||
class CUnifiedCharList : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_NAME_LEN = 20
|
||||
};
|
||||
|
||||
CUnifiedCharList() { Init(); }
|
||||
|
||||
void Init();
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
unsigned long GetUID() const { return static_cast<unsigned long>(m_UID); }
|
||||
unsigned long GetBeforeCID() const { return static_cast<unsigned long>(m_BeforeCID); }
|
||||
unsigned long GetNewCID() const { return static_cast<unsigned long>(m_NewCID); }
|
||||
|
||||
unsigned char GetOldServerGroupID() const { return m_OldServerGroupID; }
|
||||
|
||||
const char* GetBeforeCharName() const { return m_BeforeCharName; }
|
||||
|
||||
bool operator == (const CUnifiedCharList& rhs) const;
|
||||
bool operator != (const CUnifiedCharList& rhs) const { return !(*this == rhs); }
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CUnifiedCharList, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_UID, m_UIDStatus)
|
||||
COLUMN_ENTRY_STATUS(2, m_OldServerGroupID, m_OldServerGroupIDStatus)
|
||||
COLUMN_ENTRY_STATUS(3, m_BeforeCID, m_BeforeCIDStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_NewCID, m_NewCIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_BeforeCharName, m_BeforeCharNameLen, m_BeforeCharNameStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_STATUS(2, m_OldServerGroupID, m_OldServerGroupIDStatus)
|
||||
COLUMN_ENTRY_STATUS(3, m_BeforeCID, m_BeforeCIDStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_NewCID, m_NewCIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(5, m_BeforeCharName, m_BeforeCharNameLen, m_BeforeCharNameStatus);
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_UID;
|
||||
int m_BeforeCID;
|
||||
int m_NewCID;
|
||||
char m_BeforeCharName[MAX_NAME_LEN];
|
||||
|
||||
BYTE m_OldServerGroupID;
|
||||
|
||||
DBLENGTH m_BeforeCharNameLen;
|
||||
|
||||
DBSTATUSENUM m_UIDStatus;
|
||||
DBSTATUSENUM m_OldServerGroupIDStatus;
|
||||
DBSTATUSENUM m_BeforeCIDStatus;
|
||||
DBSTATUSENUM m_NewCIDStatus;
|
||||
DBSTATUSENUM m_BeforeCharNameStatus;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
26
Server/DBProcess/RylDBLibrary/RylDBCommand.h
Normal file
26
Server/DBProcess/RylDBLibrary/RylDBCommand.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _RYL_DB_COMMAND_H_
|
||||
#define _RYL_DB_COMMAND_H_
|
||||
|
||||
namespace RylDBCommand
|
||||
{
|
||||
|
||||
enum DBErrorType
|
||||
{
|
||||
DBERR_CONVERT_FAILED,
|
||||
DBERR_SETDATA_FAILED,
|
||||
DBERR_UPDATE_FAILED
|
||||
};
|
||||
|
||||
class IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Init() = 0;
|
||||
virtual void LogError(DBErrorType eErrorType, HRESULT hr) = 0;
|
||||
virtual void AdjustSize(bool bRestore) { }
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
422
Server/DBProcess/RylDBLibrary/RylDBLibrary.cpp
Normal file
422
Server/DBProcess/RylDBLibrary/RylDBLibrary.cpp
Normal file
@@ -0,0 +1,422 @@
|
||||
#include "RylDBLibrary.h"
|
||||
#include "RylDBStoreCommand.h"
|
||||
#include "RylDBCharCommand.h"
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||||
#include <sqloledb.h>
|
||||
|
||||
const int MAX_READ_NUM = 100000;
|
||||
|
||||
CNoneCounter& CNoneCounter::GetInstance()
|
||||
{
|
||||
static CNoneCounter noneCounter;
|
||||
return noneCounter;
|
||||
}
|
||||
|
||||
bool CConsoleCounter::ShowCounter(const char* szProcessName, int nCount, bool bForceWrite)
|
||||
{
|
||||
if(bForceWrite || 0 == (nCount % m_nCounterPerLine))
|
||||
{
|
||||
printf("[%s] : %12d\n", szProcessName, nCount);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::ConnectDB(ATL::CDataSource& ds, const char* szDBAddress, const char* szDBName,
|
||||
const char* szDBAccount, const char* szDBPassword)
|
||||
{
|
||||
ATL::CDBPropSet dsPropSet;
|
||||
dsPropSet.SetGUID(DBPROPSET_DBINIT);
|
||||
dsPropSet.AddProperty(DBPROP_INIT_DATASOURCE, szDBAddress);
|
||||
dsPropSet.AddProperty(DBPROP_INIT_CATALOG, szDBName);
|
||||
dsPropSet.AddProperty(DBPROP_AUTH_USERID, szDBAccount);
|
||||
dsPropSet.AddProperty(DBPROP_AUTH_PASSWORD, szDBPassword);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA>̽<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
return ds.Open(CLSID_SQLOLEDB, &dsPropSet, 1);
|
||||
}
|
||||
|
||||
template<class CAccessorData, class IDBProcess>
|
||||
HRESULT EnumerateTable(ATL::CSession& dataSession,
|
||||
const char* szTableName,
|
||||
IDBProcess& dbProcess,
|
||||
IShowCounter& showCounter)
|
||||
{
|
||||
ATL::CTable< CAccessor<CAccessorData>, CBulkRowset> data;
|
||||
|
||||
CDBPropSet dbPropSet;
|
||||
dbPropSet.SetGUID(DBPROPSET_ROWSET);
|
||||
dbPropSet.AddProperty(DBPROP_IRowsetUpdate, true);
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
data.SetRows(MAX_READ_NUM);
|
||||
|
||||
if (FAILED(hr = data.Open(dataSession, szTableName, &dbPropSet, 1)))
|
||||
{
|
||||
ERRLOG2(g_Log, "hr:0x%08X / %s table open failed", hr, szTableName);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAccessorData oldData;
|
||||
bool bUpdate = false;
|
||||
|
||||
int nCount = 0;
|
||||
|
||||
// <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>. <20><><EFBFBD>鼭 ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
|
||||
while(S_OK == (hr = data.MoveNext()))
|
||||
{
|
||||
oldData = data;
|
||||
|
||||
data.AdjustSize(false);
|
||||
|
||||
switch(dbProcess(data))
|
||||
{
|
||||
case CONVERT_FAILED:
|
||||
data.LogError(RylDBCommand::DBERR_CONVERT_FAILED, hr);
|
||||
bUpdate = false;
|
||||
break;
|
||||
|
||||
case CONVERT_SUCCEEDED:
|
||||
bUpdate = (oldData != data);
|
||||
break;
|
||||
|
||||
case CONVERT_DO_NOT_WRITE:
|
||||
bUpdate = false;
|
||||
break;
|
||||
|
||||
case CONVERT_FORCE_WRITE:
|
||||
bUpdate = true;
|
||||
}
|
||||
|
||||
data.AdjustSize(true);
|
||||
|
||||
if (bUpdate)
|
||||
{
|
||||
if (FAILED(hr = data.SetData(1)))
|
||||
{
|
||||
data.LogError(RylDBCommand::DBERR_SETDATA_FAILED, hr);
|
||||
}
|
||||
else if (FAILED(hr = data.Update()))
|
||||
{
|
||||
data.LogError(RylDBCommand::DBERR_UPDATE_FAILED, hr);
|
||||
}
|
||||
}
|
||||
|
||||
showCounter.ShowCounter(szTableName, ++nCount, false);
|
||||
data.Init();
|
||||
}
|
||||
|
||||
showCounter.ShowCounter(szTableName, ++nCount, true);
|
||||
g_Log.Flush();
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
template<class CAccessorData, class IDBProcess>
|
||||
HRESULT EnumerateCommand(ATL::CSession& dataSession,
|
||||
char* szTableName,
|
||||
char* szQuery,
|
||||
IDBProcess& dbProcess,
|
||||
IShowCounter& showCounter)
|
||||
{
|
||||
ATL::CCommand<CAccessor<CAccessorData>, CBulkRowset, CMultipleResults> data;
|
||||
|
||||
CDBPropSet dbPropSet;
|
||||
dbPropSet.SetGUID(DBPROPSET_ROWSET);
|
||||
/*dbPropSet.AddProperty(DBPROP_IRowsetUpdate, true);
|
||||
dbPropSet.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE);
|
||||
*/
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
data.SetRows(MAX_READ_NUM);
|
||||
|
||||
if (FAILED(hr = data.Open(dataSession, szQuery, &dbPropSet)))
|
||||
{
|
||||
ERRLOG2(g_Log, "hr:0x%08X / %s table open failed", hr, szTableName);
|
||||
}
|
||||
else
|
||||
{
|
||||
CAccessorData oldData;
|
||||
bool bUpdate = false;
|
||||
|
||||
int nCount = 0;
|
||||
|
||||
// <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>. <20><><EFBFBD>鼭 ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
|
||||
while(S_OK == (hr = data.MoveNext()))
|
||||
{
|
||||
oldData = data;
|
||||
|
||||
data.AdjustSize(false);
|
||||
|
||||
switch(dbProcess(data))
|
||||
{
|
||||
case CONVERT_FAILED:
|
||||
data.LogError(RylDBCommand::DBERR_CONVERT_FAILED, hr);
|
||||
bUpdate = false;
|
||||
break;
|
||||
|
||||
case CONVERT_SUCCEEDED:
|
||||
bUpdate = (oldData != data);
|
||||
break;
|
||||
|
||||
case CONVERT_DO_NOT_WRITE:
|
||||
bUpdate = false;
|
||||
break;
|
||||
|
||||
case CONVERT_FORCE_WRITE:
|
||||
bUpdate = true;
|
||||
}
|
||||
|
||||
data.AdjustSize(true);
|
||||
|
||||
if (bUpdate)
|
||||
{
|
||||
if (FAILED(hr = data.SetData(1)))
|
||||
{
|
||||
data.LogError(RylDBCommand::DBERR_SETDATA_FAILED, hr);
|
||||
}
|
||||
else if (FAILED(hr = data.Update()))
|
||||
{
|
||||
data.LogError(RylDBCommand::DBERR_UPDATE_FAILED, hr);
|
||||
}
|
||||
}
|
||||
|
||||
showCounter.ShowCounter(szTableName, ++nCount, false);
|
||||
data.Init();
|
||||
}
|
||||
|
||||
showCounter.ShowCounter(szTableName, ++nCount, true);
|
||||
g_Log.Flush();
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::CharInfo(IDBCharInfoProcess& charInfoProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CCharData, IDBCharInfoProcess>(
|
||||
m_DataSession, "CharInfo", charInfoProcess, showCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumerateCommand<RylDBCommand::CCharData, IDBCharInfoProcess>(
|
||||
m_DataSession, "CharInfo", szQuery, charInfoProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::CharSkill(IDBCharSkillProcess& charSkillProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CSkillData, IDBCharSkillProcess>(
|
||||
m_DataSession, "CharSkill", charSkillProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::CharItem(IDBCharItemProcess& charItemProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CCharItem, IDBCharItemProcess>(
|
||||
m_DataSession, "CharItem", charItemProcess, showCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumerateCommand<RylDBCommand::CCharItem, IDBCharItemProcess>(
|
||||
m_DataSession, "CharItem", szQuery, charItemProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::CharItemEx(IDBCharItemExProcess& charItemExProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CCharItemEx, IDBCharItemExProcess>(
|
||||
m_DataSession, "CharItemEx", charItemExProcess, showCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumerateCommand<RylDBCommand::CCharItemEx, IDBCharItemExProcess>(
|
||||
m_DataSession, "CharItemEx", szQuery, charItemExProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::CharQuest(IDBCharQuestProcess& charQuestProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CCharQuest, IDBCharQuestProcess>(
|
||||
m_DataSession, "Quest", charQuestProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::Party(IDBPartyProcess& partyProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CPartyData, IDBPartyProcess>(
|
||||
m_DataSession, "PartyInfo", partyProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::Friend(IDBFriendProcess& friendProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CFriendData, IDBFriendProcess>(
|
||||
m_DataSession, "Friend", friendProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CRylDBProcess::UnifiedStore1(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CUnifiedStore1, IDBStoreProcess>(
|
||||
m_DataSession, "TblUnifiedItemStore1", storeProcess, showCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumerateCommand<RylDBCommand::CUnifiedStore1, IDBStoreProcess>(
|
||||
m_DataSession, "TblUnifiedItemStore1", szQuery, storeProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::UnifiedStore2(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CUnifiedStore2, IDBStoreProcess>(
|
||||
m_DataSession, "TblUnifiedItemStore2", storeProcess, showCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
return EnumerateCommand<RylDBCommand::CUnifiedStore2, IDBStoreProcess>(
|
||||
m_DataSession, "TblUnifiedItemStore2", szQuery, storeProcess, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRylDBProcess::UnifiedCharList(IDBUnifiedCharInfoProcess& process, IShowCounter& showCounter, char* szQuery)
|
||||
{
|
||||
if(NULL == szQuery)
|
||||
{
|
||||
return EnumerateTable<RylDBCommand::CUnifiedCharList, IDBUnifiedCharInfoProcess>(
|
||||
m_DataSession, "TblUnifiedCharLIst", process, showCounter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CDBItemSerialMgr::CDBItemSerialMgr()
|
||||
: m_dwItemSerial(0LL), m_dwServerID(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CDBItemSerialMgr::~CDBItemSerialMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDBItemSerialMgr::SetItemSerial(unsigned __int64 dwItemSerial)
|
||||
{
|
||||
if(m_dwItemSerial < dwItemSerial)
|
||||
{
|
||||
m_dwItemSerial = dwItemSerial;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT CDBItemSerialMgr::LoadItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID)
|
||||
{
|
||||
m_dwItemSerial = 0LL;
|
||||
m_dwServerID = dwServerID;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
const int MAX_QUERY_LEN = 512;
|
||||
|
||||
char szQuery[MAX_QUERY_LEN];
|
||||
_snprintf(szQuery, MAX_QUERY_LEN - 1,
|
||||
"SELECT Server, Item FROM ItemUID WHERE Server = %d", dwServerID);
|
||||
|
||||
ATL::CCommand< CAccessor< RylDBCommand::CReadItemSerial >, CRowset, CMultipleResults > itemCommand;
|
||||
|
||||
if (FAILED(hr = itemCommand.Open(DBSession, szQuery)))
|
||||
{
|
||||
return hr;
|
||||
}
|
||||
|
||||
if(S_OK != itemCommand.MoveNext())
|
||||
{
|
||||
itemCommand.Close();
|
||||
|
||||
SERVER_ID serverID;
|
||||
serverID.dwID = dwServerID;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ø<EFBFBD><C3B8><EFBFBD> <20><> Ŀ<><C4BF><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><D7BF><EFBFBD>.. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> / ä<><C3A4> 2byteü<65><C3BC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
m_dwItemSerial = ((static_cast<unsigned __int64>(serverID.GetZone()) << 56) & 0xFF00000000000000LL) |
|
||||
((static_cast<unsigned __int64>(serverID.GetChannel()) << 48) & 0x00FF000000000000LL);
|
||||
|
||||
ATL::CCommand< CAccessor< RylDBCommand::CUpdateItemSerial> > insertCommand;
|
||||
|
||||
insertCommand.SetServerID(dwServerID);
|
||||
insertCommand.SetItemSerial(m_dwItemSerial);
|
||||
|
||||
// <20><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if (FAILED(hr = insertCommand.Open(DBSession,
|
||||
L"INSERT INTO ItemUID (Item, Server) VALUES(?, ?)")))
|
||||
{
|
||||
ERRLOG1(g_Log, "ServerID:0x%08X / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - Insert<72><74><EFBFBD><EFBFBD>", m_dwServerID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dwItemSerial = itemCommand.GetItemSerial();
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDBItemSerialMgr::SaveItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if(m_dwServerID != dwServerID)
|
||||
{
|
||||
ERRLOG2(g_Log, "OldServerID:0x%08X / NewServerID:0x%08X / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> ID<49><44> <20>ٸ<EFBFBD><D9B8>ϴ<EFBFBD>",
|
||||
m_dwServerID, dwServerID);
|
||||
|
||||
hr = E_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATL::CCommand< CAccessor<RylDBCommand::CUpdateItemSerial> > updateItemSerial;
|
||||
|
||||
updateItemSerial.SetServerID(dwServerID);
|
||||
updateItemSerial.SetItemSerial(m_dwItemSerial);
|
||||
|
||||
if (FAILED(hr = updateItemSerial.Open(DBSession,
|
||||
L"UPDATE ItemUID SET Item=? WHERE Server=?")))
|
||||
{
|
||||
ERRLOG2(g_Log, "ServerID:0x%08X / ItemSerial : 0x016I64X / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : DB<44><42> <20>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
m_dwServerID, m_dwItemSerial);
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDBItemSerialMgr::ClearAllSerialDB(ATL::CSession& DBSession)
|
||||
{
|
||||
ATL::CCommand<> deleteCommand;
|
||||
return deleteCommand.Open(DBSession, L"DELETE FROM ItemUID");
|
||||
}
|
||||
162
Server/DBProcess/RylDBLibrary/RylDBLibrary.h
Normal file
162
Server/DBProcess/RylDBLibrary/RylDBLibrary.h
Normal file
@@ -0,0 +1,162 @@
|
||||
#ifndef _RYL_DB_PROCESS_LIBRARY_H_
|
||||
#define _RYL_DB_PROCESS_LIBRARY_H_
|
||||
|
||||
#include <atldbcli.h>
|
||||
|
||||
// forward decl.
|
||||
namespace RylDBCommand
|
||||
{
|
||||
class CCharData;
|
||||
class CSkillData;
|
||||
class CCharItem;
|
||||
class CCharItemEx;
|
||||
class CCharQuest;
|
||||
|
||||
class CUnifiedStore1;
|
||||
class CUnifiedStore2;
|
||||
|
||||
class CPartyData;
|
||||
class CFriendData;
|
||||
|
||||
class CUnifiedCharList;
|
||||
}
|
||||
|
||||
enum ConvertResult
|
||||
{
|
||||
CONVERT_FAILED,
|
||||
CONVERT_SUCCEEDED,
|
||||
CONVERT_DO_NOT_WRITE,
|
||||
CONVERT_FORCE_WRITE
|
||||
};
|
||||
|
||||
class IShowCounter
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite) = 0;
|
||||
};
|
||||
|
||||
class CNoneCounter : public IShowCounter
|
||||
{
|
||||
public:
|
||||
|
||||
static CNoneCounter& GetInstance();
|
||||
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite) { return true; }
|
||||
|
||||
private:
|
||||
|
||||
CNoneCounter() { }
|
||||
};
|
||||
|
||||
class CConsoleCounter : public IShowCounter
|
||||
{
|
||||
public:
|
||||
|
||||
CConsoleCounter(int nCounterPerLine) : m_nCounterPerLine(nCounterPerLine) { }
|
||||
virtual bool ShowCounter(const char* szProcessName, int nCount, bool bForceWrite);
|
||||
|
||||
private:
|
||||
|
||||
int m_nCounterPerLine;
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><CCBD><EFBFBD>
|
||||
struct IDBCharInfoProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CCharData& charData_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBCharSkillProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CSkillData& charSkillData_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBCharItemProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CCharItem& charItem_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBCharItemExProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CCharItemEx& charItemEx_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBCharQuestProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CCharQuest& charQuest_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBStoreProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CUnifiedStore1& unifiedStore1_InOut) = 0;
|
||||
virtual ConvertResult operator() (RylDBCommand::CUnifiedStore2& unifiedStore2_InOut) = 0;
|
||||
};
|
||||
|
||||
struct IDBPartyProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CPartyData& partyData) = 0;
|
||||
};
|
||||
|
||||
struct IDBFriendProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CFriendData& friendData) = 0;
|
||||
};
|
||||
|
||||
struct IDBUnifiedCharInfoProcess
|
||||
{
|
||||
virtual ConvertResult operator() (RylDBCommand::CUnifiedCharList& unifiedCharList) = 0;
|
||||
};
|
||||
|
||||
|
||||
class CRylDBProcess
|
||||
{
|
||||
public:
|
||||
|
||||
static HRESULT ConnectDB(ATL::CDataSource& ds,
|
||||
const char* szDBAddress, const char* szDBName,
|
||||
const char* szDBAccount, const char* szDBPassword);
|
||||
|
||||
CRylDBProcess(ATL::CSession& dataSession) : m_DataSession(dataSession) { }
|
||||
|
||||
HRESULT CharInfo(IDBCharInfoProcess& charInfoProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT CharSkill(IDBCharSkillProcess& charSkillProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT CharItem(IDBCharItemProcess& charItemProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT CharItemEx(IDBCharItemExProcess& charItemExProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT CharQuest(IDBCharQuestProcess& charQuestProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
|
||||
HRESULT Party(IDBPartyProcess& partyProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT Friend(IDBFriendProcess& friendProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
|
||||
HRESULT UnifiedStore1(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
HRESULT UnifiedStore2(IDBStoreProcess& storeProcess, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
|
||||
HRESULT UnifiedCharList(IDBUnifiedCharInfoProcess& process, IShowCounter& showCounter, char* szQuery = NULL);
|
||||
|
||||
private:
|
||||
|
||||
ATL::CSession& m_DataSession;
|
||||
};
|
||||
|
||||
class CDBItemSerialMgr
|
||||
{
|
||||
public:
|
||||
|
||||
CDBItemSerialMgr();
|
||||
~CDBItemSerialMgr();
|
||||
|
||||
unsigned __int64 GetItemSerial() const { return m_dwItemSerial; }
|
||||
unsigned __int64 GetNewItemSerial() { return ++m_dwItemSerial; }
|
||||
bool SetItemSerial(unsigned __int64 dwItemSerial);
|
||||
|
||||
HRESULT LoadItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID);
|
||||
HRESULT SaveItemSerialDB(ATL::CSession& DBSession, unsigned long dwServerID);
|
||||
|
||||
HRESULT ClearAllSerialDB(ATL::CSession& DBSession);
|
||||
|
||||
private:
|
||||
|
||||
unsigned __int64 m_dwItemSerial;
|
||||
unsigned long m_dwServerID;
|
||||
};
|
||||
|
||||
#endif
|
||||
144
Server/DBProcess/RylDBLibrary/RylDBLibrary.vcproj
Normal file
144
Server/DBProcess/RylDBLibrary/RylDBLibrary.vcproj
Normal file
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="RylDBLibrary"
|
||||
ProjectGUID="{63201132-77F7-43F2-92B0-8F3CBEA05C9D}"
|
||||
SccProjectName="SAK"
|
||||
SccAuxPath="SAK"
|
||||
SccLocalPath="SAK"
|
||||
SccProvider="SAK"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../;../../RylServerProject;../../RylServerProject/BaseLibrary;../../RylServerProject/RylServerLibrary;../../RylServerProject/RylGameLibrary"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/RylDBLibrary.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../Library/$(ConfigurationName)"
|
||||
IntermediateDirectory="../Intermediate/$(ProjectName)/$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../;../../RylServerProject;../../RylServerProject/BaseLibrary;../../RylServerProject/RylServerLibrary;../../RylServerProject/RylGameLibrary"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/RylDBLibrary.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="<22>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\RylDBCharCommand.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RylDBLibrary.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RylDBStoreCommand.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\RylDBCharCommand.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RylDBCommand.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RylDBLibrary.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RylDBStoreCommand.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="<22><><EFBFBD>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
155
Server/DBProcess/RylDBLibrary/RylDBStoreCommand.cpp
Normal file
155
Server/DBProcess/RylDBLibrary/RylDBStoreCommand.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
#include <Log/ServerLog.h>
|
||||
#include "RylDBStoreCommand.h"
|
||||
|
||||
namespace RylDBCommand
|
||||
{
|
||||
|
||||
#define BOUNDED_SUBTRACT(data, minusval, minbound) if ((data) < (minusval) + (minbound)) { (data) = (minbound); } else { (data) -= (minusval); }
|
||||
|
||||
void CUnifiedStore1::Init(void)
|
||||
{
|
||||
m_UID = 0;
|
||||
m_Flag = 0;
|
||||
m_Gold = 0;
|
||||
memset(m_Store, 0, sizeof(STORE));
|
||||
memset(m_Password, 0, sizeof(char) * STORE_INFO::MAX_PASS_LEN * 2);
|
||||
m_OldServerGroupID = 0;
|
||||
m_bAdjustedSize = false;
|
||||
|
||||
m_StoreLength = 0;
|
||||
m_PasswordLength = 0;
|
||||
|
||||
m_UIDStatus = DBSTATUS_S_OK;
|
||||
m_OldServerGroupIDStatus = DBSTATUS_S_OK;
|
||||
m_PasswordStatus = DBSTATUS_S_OK;
|
||||
m_FlagStatus = DBSTATUS_S_OK;
|
||||
m_GoldStatus = DBSTATUS_S_OK;
|
||||
m_StoreStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void CUnifiedStore1::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustedSize)
|
||||
{
|
||||
reinterpret_cast<STORE&>(m_Store).dwSize += sizeof(unsigned long);
|
||||
m_bAdjustedSize = false;
|
||||
}
|
||||
else if (!bRestore && !m_bAdjustedSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<STORE&>(m_Store).dwSize, sizeof(unsigned long), 0);
|
||||
m_bAdjustedSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CUnifiedStore1::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
switch(eErrorType)
|
||||
{
|
||||
case DBERR_CONVERT_FAILED:
|
||||
ERRLOG1(g_Log, "UID:%10u / UnifiedStore1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD>", GetUID());
|
||||
break;
|
||||
|
||||
case DBERR_SETDATA_FAILED:
|
||||
ERRLOG3(g_Log, "UID:%10u / hr:0x%08x / UnifiedStore1 SetData <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), hr, GetDBStatus());
|
||||
break;
|
||||
|
||||
case DBERR_UPDATE_FAILED:
|
||||
ERRLOG3(g_Log, "UID:%10u / hr:0x%08x / UnifiedStore1 Update <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), hr, GetDBStatus());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CUnifiedStore1::operator == (const CUnifiedStore1& rhs) const
|
||||
{
|
||||
return
|
||||
m_UID == rhs.m_UID &&
|
||||
m_Flag == rhs.m_Flag &&
|
||||
m_Gold == rhs.m_Gold &&
|
||||
m_OldServerGroupID == rhs.m_OldServerGroupID &&
|
||||
0 == memcmp(m_Store, rhs.m_Store, sizeof(STORE)) &&
|
||||
0 == memcmp(m_Password, rhs.m_Password, sizeof(char) * STORE_INFO::MAX_PASS_LEN * 2);
|
||||
}
|
||||
|
||||
CString CUnifiedStore1::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
m_Password[STORE_INFO::MAX_PASS_LEN - 1] = 0;
|
||||
|
||||
dbStatus.Format("UID:%10u(0x%08x) OldServerGroupID:%3d(0x%08x) Password:%s(0x%08x) "
|
||||
"Flag:0x%08x(0x%08x) Gold:%10u(0x%08x) StoreLen:%4u(0x%08x)",
|
||||
m_UID, m_UIDStatus, m_OldServerGroupID, m_OldServerGroupIDStatus,
|
||||
m_Password, m_PasswordStatus, m_Flag, m_FlagStatus,
|
||||
m_Gold, m_GoldStatus, GetStore().dwSize, m_StoreStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
void CUnifiedStore2::Init(void)
|
||||
{
|
||||
m_UID = 0;
|
||||
memset(m_Store, 0, sizeof(STORE));
|
||||
m_OldServerGroupID = 0;
|
||||
m_bAdjustedSize = false;
|
||||
m_StoreLength = 0;
|
||||
|
||||
m_UIDStatus = DBSTATUS_S_OK;
|
||||
m_StoreStatus = DBSTATUS_S_OK;
|
||||
m_OldServerGroupIDStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void CUnifiedStore2::AdjustSize(bool bRestore)
|
||||
{
|
||||
if (bRestore && m_bAdjustedSize)
|
||||
{
|
||||
reinterpret_cast<STORE&>(m_Store).dwSize += sizeof(unsigned long);
|
||||
m_bAdjustedSize = false;
|
||||
}
|
||||
else if (!bRestore && !m_bAdjustedSize)
|
||||
{
|
||||
BOUNDED_SUBTRACT(reinterpret_cast<STORE&>(m_Store).dwSize, sizeof(unsigned long), 0);
|
||||
m_bAdjustedSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CUnifiedStore2::LogError(DBErrorType eErrorType, HRESULT hr)
|
||||
{
|
||||
switch(eErrorType)
|
||||
{
|
||||
case DBERR_CONVERT_FAILED:
|
||||
ERRLOG1(g_Log, "UID:%10u / UnifiedStore2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3> <20><><EFBFBD><EFBFBD>", GetUID());
|
||||
break;
|
||||
|
||||
case DBERR_SETDATA_FAILED:
|
||||
ERRLOG3(g_Log, "UID:%10u / hr:0x%08x / UnifiedStore2 SetData <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), hr, GetDBStatus());
|
||||
break;
|
||||
|
||||
case DBERR_UPDATE_FAILED:
|
||||
ERRLOG3(g_Log, "UID:%10u / hr:0x%08x / UnifiedStore2 Update <20><><EFBFBD><EFBFBD> : DBStatus:%s",
|
||||
GetUID(), hr, GetDBStatus());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CUnifiedStore2::operator == (const CUnifiedStore2& rhs) const
|
||||
{
|
||||
return
|
||||
m_UID == rhs.m_UID &&
|
||||
m_OldServerGroupID == rhs.m_OldServerGroupID &&
|
||||
0 == memcmp(m_Store, rhs.m_Store, sizeof(STORE));
|
||||
}
|
||||
|
||||
CString CUnifiedStore2::GetDBStatus()
|
||||
{
|
||||
CString dbStatus;
|
||||
|
||||
dbStatus.Format("UID:%10u(0x%08x) OldServerGroupID:%3d(0x%08x) StoreLen:%4u(0x%08x)",
|
||||
m_UID, m_UIDStatus, m_OldServerGroupID, m_OldServerGroupIDStatus, GetStore().dwSize, m_StoreStatus);
|
||||
|
||||
return dbStatus;
|
||||
}
|
||||
|
||||
}
|
||||
212
Server/DBProcess/RylDBLibrary/RylDBStoreCommand.h
Normal file
212
Server/DBProcess/RylDBLibrary/RylDBStoreCommand.h
Normal file
@@ -0,0 +1,212 @@
|
||||
#ifndef _RYL_DB_STORE_PROCESS_COMMAND_H_
|
||||
#define _RYL_DB_STORE_PROCESS_COMMAND_H_
|
||||
|
||||
#include <atlstr.h>
|
||||
#include <atldbcli.h>
|
||||
#include <DB/DBdefine.h>
|
||||
|
||||
#include "RylDBCommand.h"
|
||||
|
||||
namespace RylDBCommand
|
||||
{
|
||||
|
||||
class CUnifiedStore1 : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CUnifiedStore1() { Init(); }
|
||||
|
||||
void Init(void);
|
||||
void AdjustSize(bool bRestore);
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetUID() const { return static_cast<unsigned long>(m_UID); }
|
||||
unsigned char GetOldServerGroupID() const { return m_OldServerGroupID; }
|
||||
|
||||
unsigned long GetFlag() const { return static_cast<unsigned long>(m_Flag); }
|
||||
unsigned long GetGold() const { return static_cast<unsigned long>(m_Gold); }
|
||||
const char* GetPassword() const { return m_Password; }
|
||||
const STORE& GetStore() const { return reinterpret_cast<const STORE&>(m_Store); }
|
||||
|
||||
void SetFlag(unsigned long Flag) { m_Flag = Flag; m_FlagStatus = DBSTATUS_S_OK; }
|
||||
void SetGold(unsigned long Gold) { m_Gold = Gold; m_GoldStatus = DBSTATUS_S_OK; }
|
||||
void SetPassword(const char* Password)
|
||||
{
|
||||
strncpy(m_Password, Password, STORE_INFO::MAX_PASS_LEN * 2);
|
||||
m_Password[STORE_INFO::MAX_PASS_LEN * 2 - 1] = 0;
|
||||
|
||||
m_PasswordLength = STORE_INFO::MAX_PASS_LEN;
|
||||
m_PasswordStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void SetStore(STORE& store)
|
||||
{
|
||||
memcpy(m_Store, &store, sizeof(STORE));
|
||||
m_StoreLength = sizeof(STORE);
|
||||
m_StoreStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CUnifiedStore1& rhs) const;
|
||||
bool operator != (const CUnifiedStore1& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CUnifiedStore1, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_UID, m_UIDStatus)
|
||||
COLUMN_ENTRY_STATUS(2, m_OldServerGroupID, m_OldServerGroupIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Password, m_PasswordLength, m_PasswordStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_Flag, m_FlagStatus)
|
||||
COLUMN_ENTRY_STATUS(5, m_Gold, m_GoldStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(6, m_Store, m_StoreLength, m_StoreStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Password, m_PasswordLength, m_PasswordStatus)
|
||||
COLUMN_ENTRY_STATUS(4, m_Flag, m_FlagStatus)
|
||||
COLUMN_ENTRY_STATUS(5, m_Gold, m_GoldStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(6, m_Store, m_StoreLength, m_StoreStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_UID;
|
||||
int m_Flag;
|
||||
int m_Gold;
|
||||
BYTE m_Store[sizeof(STORE)];
|
||||
|
||||
char m_Password[STORE_INFO::MAX_PASS_LEN * 2];
|
||||
unsigned char m_OldServerGroupID;
|
||||
bool m_bAdjustedSize;
|
||||
|
||||
DBLENGTH m_StoreLength;
|
||||
DBLENGTH m_PasswordLength;
|
||||
|
||||
DBSTATUSENUM m_UIDStatus;
|
||||
DBSTATUSENUM m_OldServerGroupIDStatus;
|
||||
DBSTATUSENUM m_PasswordStatus;
|
||||
DBSTATUSENUM m_FlagStatus;
|
||||
DBSTATUSENUM m_GoldStatus;
|
||||
DBSTATUSENUM m_StoreStatus;
|
||||
};
|
||||
|
||||
|
||||
class CUnifiedStore2 : public IRylDBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
CUnifiedStore2() { Init(); }
|
||||
|
||||
void Init(void);
|
||||
void AdjustSize(bool bRestore);
|
||||
void LogError(DBErrorType eErrorType, HRESULT hr);
|
||||
|
||||
unsigned long GetUID() const { return static_cast<unsigned long>(m_UID); }
|
||||
unsigned char GetOldServerGroupID() const { return m_OldServerGroupID; }
|
||||
|
||||
const STORE& GetStore() const { return reinterpret_cast<const STORE&>(m_Store); }
|
||||
|
||||
void SetStore(STORE& store)
|
||||
{
|
||||
memcpy(m_Store, &store, sizeof(STORE));
|
||||
m_StoreLength = sizeof(STORE);
|
||||
m_StoreStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
bool operator == (const CUnifiedStore2& rhs) const;
|
||||
bool operator != (const CUnifiedStore2& rhs) const { return !(*this == rhs); }
|
||||
|
||||
CString GetDBStatus();
|
||||
|
||||
BEGIN_ACCESSOR_MAP(CUnifiedStore2, 2)
|
||||
|
||||
BEGIN_ACCESSOR(0, true)
|
||||
COLUMN_ENTRY_STATUS(1, m_UID, m_UIDStatus)
|
||||
COLUMN_ENTRY_STATUS(2, m_OldServerGroupID, m_OldServerGroupIDStatus)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Store, m_StoreLength, m_StoreStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
BEGIN_ACCESSOR(1, true)
|
||||
COLUMN_ENTRY_LENGTH_STATUS(3, m_Store, m_StoreLength, m_StoreStatus)
|
||||
END_ACCESSOR()
|
||||
|
||||
END_ACCESSOR_MAP()
|
||||
|
||||
private:
|
||||
|
||||
int m_UID;
|
||||
BYTE m_Store[sizeof(STORE)];
|
||||
unsigned char m_OldServerGroupID;
|
||||
|
||||
DBLENGTH m_StoreLength;
|
||||
|
||||
DBSTATUSENUM m_UIDStatus;
|
||||
DBSTATUSENUM m_StoreStatus;
|
||||
DBSTATUSENUM m_OldServerGroupIDStatus;
|
||||
|
||||
bool m_bAdjustedSize;
|
||||
};
|
||||
|
||||
class CItemSerial
|
||||
{
|
||||
public:
|
||||
|
||||
CItemSerial() { Init(); }
|
||||
CItemSerial(unsigned long ServerID, unsigned __int64 ItemSerial)
|
||||
{
|
||||
m_ServerID = ServerID;
|
||||
m_ItemSerial = ItemSerial;
|
||||
|
||||
m_ServerIDStatus = m_ItemSerialStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
m_ServerID = 0;
|
||||
m_ItemSerial = 0LL;
|
||||
|
||||
m_ServerIDStatus = m_ItemSerialStatus = DBSTATUS_S_OK;
|
||||
}
|
||||
|
||||
unsigned long GetServerID() const { return static_cast<unsigned long>(m_ServerID); }
|
||||
unsigned __int64 GetItemSerial() const { return static_cast<unsigned __int64>(m_ItemSerial); }
|
||||
|
||||
void SetServerID(unsigned long ServerID) { m_ServerID = ServerID; }
|
||||
void SetItemSerial(unsigned __int64 ItemSerial) { m_ItemSerial = ItemSerial; }
|
||||
|
||||
protected:
|
||||
|
||||
int m_ServerID;
|
||||
__int64 m_ItemSerial;
|
||||
|
||||
DBSTATUSENUM m_ServerIDStatus;
|
||||
DBSTATUSENUM m_ItemSerialStatus;
|
||||
|
||||
};
|
||||
|
||||
class CReadItemSerial : public CItemSerial
|
||||
{
|
||||
public:
|
||||
BEGIN_COLUMN_MAP(CReadItemSerial)
|
||||
COLUMN_ENTRY_STATUS(1, m_ServerID, m_ServerIDStatus)
|
||||
COLUMN_ENTRY_STATUS(2, m_ItemSerial, m_ItemSerialStatus)
|
||||
END_COLUMN_MAP()
|
||||
};
|
||||
|
||||
class CUpdateItemSerial : public CItemSerial
|
||||
{
|
||||
public:
|
||||
BEGIN_PARAM_MAP(CUpdateItemSerial)
|
||||
SET_PARAM_TYPE(DBPARAMIO_INPUT)
|
||||
COLUMN_ENTRY_STATUS(1, m_ItemSerial, m_ItemSerialStatus)
|
||||
COLUMN_ENTRY_STATUS(2, m_ServerID, m_ServerIDStatus)
|
||||
END_PARAM_MAP();
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user