Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
5.2 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. Wsbdbent.h
  5. Abstract:
  6. The CWsbDbEntity class.
  7. Author:
  8. Ron White [ronw] 11-Dec-1996
  9. Revision History:
  10. --*/
  11. #ifndef _WSBDBENT_
  12. #define _WSBDBENT_
  13. #include "wsbdb.h"
  14. /*++
  15. Class Name:
  16. CWsbDbEntity
  17. Class Description:
  18. A data base entity.
  19. --*/
  20. class IDB_EXPORT CWsbDbEntity :
  21. public CWsbObject,
  22. public IWsbDbEntity,
  23. public IWsbDbEntityPriv
  24. {
  25. // CComObjectRoot
  26. public:
  27. STDMETHOD(FinalConstruct)(void);
  28. void FinalRelease(void);
  29. // IWsbCollectable
  30. public:
  31. STDMETHOD(CompareTo)(IUnknown* pCollectable, SHORT* pResult);
  32. WSB_FROM_CWSBOBJECT;
  33. // IWsbDbEntity
  34. public:
  35. STDMETHOD(Clone)(REFIID riid, void** ppEntity);
  36. STDMETHOD(Disconnect)(void);
  37. STDMETHOD(FindEQ)(void);
  38. STDMETHOD(FindGT)(void);
  39. STDMETHOD(FindGTE)(void);
  40. STDMETHOD(FindLT)(void);
  41. STDMETHOD(FindLTE)(void);
  42. STDMETHOD(First)(void);
  43. STDMETHOD(Last)(void);
  44. STDMETHOD(MarkAsNew)(void);
  45. STDMETHOD(Next)(void);
  46. STDMETHOD(Previous)(void);
  47. STDMETHOD(Print)(IStream* pStream);
  48. STDMETHOD(Remove)(void);
  49. STDMETHOD(UseKey)(ULONG type);
  50. STDMETHOD(Write)(void);
  51. STDMETHOD(SetSequentialScan)(void);
  52. STDMETHOD(ResetSequentialScan)(void);
  53. // IWsbDbPriv - For internal use only!
  54. STDMETHOD(Copy)(IWsbDbEntity* pEntity);
  55. STDMETHOD(CopyValues)(ULONG flags, IWsbDbEntity* pEntity);
  56. STDMETHOD(GetCurKey)(IWsbDbKey** ppKey);
  57. STDMETHOD(GetKey)(ULONG KeyType, IWsbDbKey** ppKey);
  58. STDMETHOD(GetValue)(ULONG flag, ULONG* pValue);
  59. STDMETHOD(Init)(IWsbDb* pDb, IWsbDbSys *pDbSys, ULONG RecType, JET_SESID SessionId);
  60. STDMETHOD(SetValue)(ULONG flag, ULONG value);
  61. // Derived Entity needs to define this:
  62. STDMETHOD(UpdateKey)(IWsbDbKey* /*pKey*/) { return(E_NOTIMPL); }
  63. // Private utility functions
  64. private:
  65. HRESULT compare(IWsbDbEntity* pEntity, SHORT* pResult);
  66. HRESULT fromMem(HGLOBAL hMem);
  67. HRESULT get_key(ULONG key_type, UCHAR* bytes, ULONG* pSize);
  68. HRESULT getMem(HGLOBAL* phMem);
  69. HRESULT toMem(HGLOBAL hMem, ULONG* pSize);
  70. HRESULT jet_compare_field(ULONG col_id, UCHAR* bytes, ULONG size);
  71. HRESULT jet_get_data(void);
  72. HRESULT jet_make_current(void);
  73. HRESULT jet_move(LONG pos);
  74. HRESULT jet_seek(ULONG seek_flag);
  75. protected:
  76. CComPtr<IWsbDbSys> m_pDbSys; // Pointer to associated Instance
  77. CComPtr<IWsbDb> m_pDb; // Pointer to associated DB
  78. COM_IDB_KEY_INFO* m_pKeyInfo; // Info. about rec. keys
  79. COM_IDB_REC_INFO m_RecInfo; // Rec. type, size, etc.
  80. BOOL m_SaveAsNew; // AsNew flag
  81. USHORT m_UseKeyIndex; // Index into m_pKeyInfo of current control key
  82. ULONG m_ColId; // Jet column ID for record data
  83. HGLOBAL m_hMem; // Mem block for DB I/O
  84. LONG m_SeqNum; // Unique sequence number (for ID)
  85. BOOL m_PosOk; // Cursor is at current record?
  86. JET_SESID m_SessionId; // Jet session ID
  87. JET_TABLEID m_TableId; // Jet table ID
  88. BOOL m_Sequential; // Flag for sequential scan settings
  89. };
  90. #define WSB_FROM_CWSBDBENTITY_BASE \
  91. STDMETHOD(Clone)(REFIID riid, void** ppEntity) \
  92. {return(CWsbDbEntity::Clone(riid, ppEntity));} \
  93. STDMETHOD(Copy)(IWsbDbEntity* pEntity) \
  94. {return(CWsbDbEntity::Copy(pEntity)); } \
  95. STDMETHOD(Disconnect)(void) \
  96. {return(CWsbDbEntity::Disconnect());} \
  97. STDMETHOD(FindEQ)(void) \
  98. {return(CWsbDbEntity::FindEQ());} \
  99. STDMETHOD(FindGT)(void) \
  100. {return(CWsbDbEntity::FindGT());} \
  101. STDMETHOD(FindGTE)(void) \
  102. {return(CWsbDbEntity::FindGTE());} \
  103. STDMETHOD(FindLT)(void) \
  104. {return(CWsbDbEntity::FindLT());} \
  105. STDMETHOD(FindLTE)(void) \
  106. {return(CWsbDbEntity::FindLTE());} \
  107. STDMETHOD(First)(void) \
  108. {return(CWsbDbEntity::First());} \
  109. STDMETHOD(GetCurKey)(IWsbDbKey** ppKey) \
  110. {return(CWsbDbEntity::GetCurKey(ppKey)); } \
  111. STDMETHOD(Init)(IWsbDb* pDb, IWsbDbSys *pDbSys, ULONG RecType, ULONG Session) \
  112. {return(CWsbDbEntity::Init(pDb, pDbSys, RecType, Session)); } \
  113. STDMETHOD(Last)(void) \
  114. {return(CWsbDbEntity::Last());} \
  115. STDMETHOD(MarkAsNew)(void) \
  116. {return(CWsbDbEntity::MarkAsNew());} \
  117. STDMETHOD(Next)(void) \
  118. {return(CWsbDbEntity::Next());} \
  119. STDMETHOD(Previous)(void) \
  120. {return(CWsbDbEntity::Previous());} \
  121. STDMETHOD(Remove)(void) \
  122. {return(CWsbDbEntity::Remove());} \
  123. STDMETHOD(UseKey)(ULONG type) \
  124. {return(CWsbDbEntity::UseKey(type)); } \
  125. STDMETHOD(Write)(void) \
  126. {return(CWsbDbEntity::Write());} \
  127. STDMETHOD(SetSequentialScan)(void) \
  128. {return(CWsbDbEntity::SetSequentialScan());} \
  129. STDMETHOD(ResetSequentialScan)(void) \
  130. {return(CWsbDbEntity::ResetSequentialScan());} \
  131. #define WSB_FROM_CWSBDBENTITY_IMP \
  132. STDMETHOD(CompareTo)(IUnknown* pCollectable, SHORT* pResult) \
  133. {return(CWsbDbEntity::CompareTo(pCollectable, pResult)); } \
  134. STDMETHOD(IsEqual)(IUnknown* pCollectable) \
  135. {return(CWsbDbEntity::IsEqual(pCollectable)); } \
  136. #define WSB_FROM_CWSBDBENTITY \
  137. WSB_FROM_CWSBDBENTITY_BASE \
  138. WSB_FROM_CWSBDBENTITY_IMP
  139. #endif // _WSBDBENT_