#ifndef _RYL_DB_STORE_PROCESS_COMMAND_H_ #define _RYL_DB_STORE_PROCESS_COMMAND_H_ #include #include #include #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(m_UID); } unsigned char GetOldServerGroupID() const { return m_OldServerGroupID; } unsigned long GetFlag() const { return static_cast(m_Flag); } unsigned long GetGold() const { return static_cast(m_Gold); } const char* GetPassword() const { return m_Password; } const STORE& GetStore() const { return reinterpret_cast(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(m_UID); } unsigned char GetOldServerGroupID() const { return m_OldServerGroupID; } const STORE& GetStore() const { return reinterpret_cast(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(m_ServerID); } unsigned __int64 GetItemSerial() const { return static_cast(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