Leaked source code of windows server 2003
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.

144 lines
5.5 KiB

  1. //---------------------------------------------------------------------------
  2. // CursorMain.h : CVDCursorMain header file
  3. //
  4. // Copyright (c) 1996 Microsoft Corporation, All Rights Reserved
  5. // Developed by Sheridan Software Systems, Inc.
  6. //---------------------------------------------------------------------------
  7. #ifndef __CVDCURSORMAIN__
  8. #define __CVDCURSORMAIN__
  9. class CVDBookmark;
  10. class CVDCursorPosition;
  11. class CVDCursorMain : public CVDRowsetSource
  12. {
  13. protected:
  14. // Construction/Destruction
  15. CVDCursorMain(LCID lcid);
  16. virtual ~CVDCursorMain();
  17. protected:
  18. static HRESULT Create(IRowPosition * pRowPosition, IRowset * pRowset, ICursor ** ppCursor, LCID lcid);
  19. public:
  20. static HRESULT Create(IRowset * pRowset, ICursor ** ppCursor, LCID lcid);
  21. static HRESULT Create(IRowPosition * pRowPosition, ICursor ** ppCursor, LCID lcid);
  22. protected:
  23. // Rowset columns
  24. HRESULT CreateMetaColumns();
  25. void InitOptionalMetadata(ULONG cColumns);
  26. void DestroyMetaColumns();
  27. HRESULT CreateColumns();
  28. void DestroyColumns();
  29. public:
  30. // Access functions
  31. ULONG GetMetaColumnsCount() const {return s_ulMetaColumns;}
  32. CVDRowsetColumn * InternalGetMetaColumns() const {return s_rgMetaColumns;}
  33. ULONG GetColumnsCount() const {return m_ulColumns;}
  34. CVDRowsetColumn * InternalGetColumns() const {return m_rgColumns;}
  35. HACCESSOR GetBookmarkAccessor() const {return m_hAccessorBM;}
  36. ULONG GetMaxBookmarkLen() const {return m_cbMaxBookmark;}
  37. BOOL IsColumnsRowsetSupported() const {return m_fColumnsRowsetSupported;}
  38. void SetInternalInsertRow(BOOL fInternalInsertRow) {m_fInternalInsertRow = fInternalInsertRow;}
  39. void SetInternalDeleteRows(BOOL fInternalDeleteRows) {m_fInternalDeleteRows = fInternalDeleteRows;}
  40. void SetInternalSetData(BOOL fInternalSetData) {m_fInternalSetData = fInternalSetData;}
  41. BOOL IsSameRowAsNew(HROW hrow);
  42. ULONG AddedRows(void);
  43. protected:
  44. // Rowset columns
  45. static DWORD s_dwMetaRefCount; // reference count for meta-columns
  46. static ULONG s_ulMetaColumns; // number of meta-columns for IColumnsInfo
  47. static CVDRowsetColumn * s_rgMetaColumns; // pointer to an array of meta-column objects
  48. ULONG m_ulColumns; // number of rowset columns
  49. CVDRowsetColumn * m_rgColumns; // pointer to an array of column objects
  50. // IRowsetNotify
  51. VARIANT_BOOL m_fConnected; // have we added ourselves to the Rowset's connection point
  52. DWORD m_dwAdviseCookie; // connection point identifier
  53. HRESULT ConnectIRowsetNotify();
  54. void DisconnectIRowsetNotify();
  55. void Passivate();
  56. // Other
  57. ULONG m_cbMaxBookmark; // sizeof maximum bookmark
  58. HACCESSOR m_hAccessorBM; // hAccessor for the bookmark column
  59. CVDResourceDLL m_resourceDLL; // keeps track of resource DLL
  60. // booleans
  61. WORD m_fWeAddedMetaRef : 1; // we added a reference count to meta-columns
  62. WORD m_fPassivated : 1; // external ref count went to zero
  63. WORD m_fColumnsRowsetSupported : 1; // does rowset expose IColumnsRowset
  64. WORD m_fInternalInsertRow : 1; // row insert caused by internal call
  65. WORD m_fInternalDeleteRows : 1; // row delete caused by internal call
  66. WORD m_fInternalSetData : 1; // set column caused by internal call
  67. // rowset properties
  68. WORD m_fLiteralBookmarks : 1;
  69. WORD m_fOrderedBookmarks : 1;
  70. WORD m_fBookmarkSkipped : 1;
  71. public:
  72. //=--------------------------------------------------------------------------=
  73. // IUnknown methods
  74. //
  75. STDMETHOD(QueryInterface)(REFIID riid, void **ppvObjOut);
  76. STDMETHOD_(ULONG, AddRef)(void);
  77. STDMETHOD_(ULONG, Release)(void);
  78. //=--------------------------------------------------------------------------=
  79. // IRowsetNotify methods passed up from CVDRowsetNotify implementation
  80. //
  81. STDMETHOD(OnFieldChange)(IRowset *pRowset, HROW hRow, ULONG cColumns, ULONG rgColumns[], DBREASON eReason,
  82. DBEVENTPHASE ePhase, BOOL fCantDeny);
  83. STDMETHOD(OnRowChange)(IRowset *pRowset, ULONG cRows, const HROW rghRows[], DBREASON eReason, DBEVENTPHASE ePhase,
  84. BOOL fCantDeny);
  85. STDMETHOD(OnRowsetChange)(IRowset *pRowset, DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny);
  86. private:
  87. // the inner, private unknown implementation to give to connection point
  88. // container to avoid circular ref count
  89. //
  90. class CVDRowsetNotify : public IRowsetNotify {
  91. public:
  92. STDMETHOD(QueryInterface)(REFIID riid, void **ppvObjOut);
  93. STDMETHOD_(ULONG, AddRef)(void);
  94. STDMETHOD_(ULONG, Release)(void);
  95. // constructor is remarkably trivial
  96. //
  97. CVDRowsetNotify() : m_cRef(0) {}
  98. ULONG GetRefCount() const {return m_cRef;}
  99. private:
  100. CVDCursorMain *m_pMainUnknown();
  101. ULONG m_cRef;
  102. //=--------------------------------------------------------------------------=
  103. // IRowsetNotify methods
  104. //
  105. STDMETHOD(OnFieldChange)(IRowset *pRowset, HROW hRow, ULONG cColumns, ULONG rgColumns[], DBREASON eReason,
  106. DBEVENTPHASE ePhase, BOOL fCantDeny);
  107. STDMETHOD(OnRowChange)(IRowset *pRowset, ULONG cRows, const HROW rghRows[], DBREASON eReason, DBEVENTPHASE ePhase,
  108. BOOL fCantDeny);
  109. STDMETHOD(OnRowsetChange)(IRowset *pRowset, DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny);
  110. } m_RowsetNotify;
  111. friend class CVDRowsetNotify;
  112. };
  113. #endif //__CVDCURSORMAIN__