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.

169 lines
8.4 KiB

  1. //---------------------------------------------------------------------------
  2. // Cursor.h : CVDCursor header file
  3. //
  4. // Copyright (c) 1996 Microsoft Corporation, All Rights Reserved
  5. // Developed by Sheridan Software Systems, Inc.
  6. //---------------------------------------------------------------------------
  7. #ifndef __CVDCURSOR__
  8. #define __CVDCURSOR__
  9. #define VD_ADJUST_VARIANT_TO_BYTE 1
  10. #define VD_ADJUST_VARIANT_TO_WSTR 2
  11. #define VD_ADJUST_VARIANT_TO_STR 3
  12. class CVDCursor : public CVDNotifier,
  13. public CVDCursorBase,
  14. public ICursorUpdateARow,
  15. public ICursorFind,
  16. public IEntryID
  17. {
  18. protected:
  19. // Construction/Destruction
  20. CVDCursor();
  21. virtual ~CVDCursor();
  22. // Helper functions
  23. CVDRowsetColumn * GetRowsetColumn(ULONG ulOrdinal);
  24. CVDRowsetColumn * GetRowsetColumn(CURSOR_DBCOLUMNID& cursorColumnID);
  25. HRESULT GetOrdinal(CURSOR_DBCOLUMNID& cursorColumnID, ULONG * pulOrdinal);
  26. DWORD StatusToCursorInfo(DBSTATUS dwStatus);
  27. DBSTATUS CursorInfoToStatus(DWORD dwCursorInfo);
  28. HRESULT ValidateCursorBindParams(CURSOR_DBCOLUMNID * pCursorColumnID, CURSOR_DBBINDPARAMS * pCursorBindParams,
  29. CVDRowsetColumn ** ppRowsetColumn);
  30. HRESULT ValidateEntryID(ULONG cbEntryID, BYTE * pEntryID, CVDRowsetColumn ** ppColumn, HROW * phRow);
  31. HRESULT QueryEntryIDInterface(CVDRowsetColumn * pColumn, HROW hRow, DWORD dwFlags, REFIID riid, IUnknown ** ppUnknown);
  32. #ifndef VD_DONT_IMPLEMENT_ISTREAM
  33. HRESULT CreateEntryIDStream(CVDRowsetColumn * pColumn, HROW hRow, IStream ** ppStream);
  34. #endif //VD_DONT_IMPLEMENT_ISTREAM
  35. HRESULT MakeAdjustments(ULONG ulBindings, DBBINDING * pBindings, ULONG * pulIndex, ULONG ulTotalBindings,
  36. HACCESSOR ** prghAdjustAccessors, DWORD ** ppdwAdjustFlags, BOOL fBefore);
  37. HRESULT ReCreateAccessors(ULONG ulNewCursorBindings, CURSOR_DBCOLUMNBINDING * pNewCursorBindings, DWORD dwFlags);
  38. void ReleaseAccessorArray(HACCESSOR * rghAccessors);
  39. void DestroyAccessors();
  40. HRESULT ReCreateColumns();
  41. void DestroyColumns();
  42. HRESULT FilterNewRow(ULONG *pcRowsObtained, HROW *rghrow, HRESULT hr);
  43. HRESULT UseAdjustments(HROW hRow, BYTE * pData);
  44. HRESULT FillConsumersBuffer(HRESULT hrFetch,
  45. CURSOR_DBFETCHROWS *pFetchParams,
  46. ULONG cRowsObtained,
  47. HROW * rghRows);
  48. HRESULT FetchAtBookmark(ULONG cbBookmark,
  49. void *pBookmark,
  50. LARGE_INTEGER dlOffset,
  51. CURSOR_DBFETCHROWS *pFetchParams);
  52. HRESULT InsertNewRow();
  53. HRESULT GetOriginalColumn(CVDRowsetColumn * pColumn, CURSOR_DBBINDPARAMS * pBindParams);
  54. HRESULT GetModifiedColumn(CVDColumnUpdate * pColumnUpdate, CURSOR_DBBINDPARAMS * pBindParams);
  55. public:
  56. static HRESULT Create(CVDCursorPosition * pCursorPosition, CVDCursor ** ppCursor, CVDResourceDLL * pResourceDLL);
  57. // Access functions
  58. CVDCursorMain * GetCursorMain() const {return m_pCursorPosition->GetCursorMain();}
  59. BOOL IsRowsetValid() const {return m_pCursorPosition->GetRowsetSource()->IsRowsetValid();}
  60. IRowset * GetRowset() const {return m_pCursorPosition->GetRowsetSource()->GetRowset();}
  61. IAccessor * GetAccessor() const {return m_pCursorPosition->GetRowsetSource()->GetAccessor();}
  62. IRowsetLocate * GetRowsetLocate() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetLocate();}
  63. IRowsetScroll * GetRowsetScroll() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetScroll();}
  64. IRowsetChange * GetRowsetChange() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetChange();}
  65. IRowsetUpdate * GetRowsetUpdate() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetUpdate();}
  66. IRowsetFind * GetRowsetFind() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetFind();}
  67. IRowsetInfo * GetRowsetInfo() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetInfo();}
  68. IRowsetIdentity * GetRowsetIdentity() const {return m_pCursorPosition->GetRowsetSource()->GetRowsetIdentity();}
  69. // Other
  70. virtual BOOL SupportsScroll() {return (BOOL)m_pCursorPosition->GetRowsetSource()->GetRowsetScroll();}
  71. protected:
  72. // Retrieving data
  73. HACCESSOR m_hAccessor; // fixed length buffer accessor
  74. HACCESSOR m_hVarHelper; // variable length buffer accessors helper
  75. ULONG m_ulVarBindings; // number of variable length buffer bindings
  76. HACCESSOR * m_rghVarAccessors; // variable length buffer accessors
  77. HACCESSOR * m_rghAdjustAccessors; // adjusted fixed length buffer accessors
  78. DWORD * m_pdwAdjustFlags; // adjusted fixed length buffer accessors flags
  79. CVDRowsetColumn ** m_ppColumns; // rowset columns associated with current bindings
  80. // Other
  81. CVDCursorPosition * m_pCursorPosition; // backwards pointer to CVDCursorPosition
  82. CVDNotifyDBEventsConnPtCont * m_pConnPtContainer; // INotifyDBEvent connection points
  83. // overridden virtual functions from CVDNotifier
  84. HRESULT NotifyFail (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  85. HRESULT NotifyOKToDo (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  86. HRESULT NotifySyncBefore(DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  87. HRESULT NotifyAboutToDo (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  88. HRESULT NotifySyncAfter (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  89. HRESULT NotifyDidEvent (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  90. HRESULT NotifyCancel (DWORD, ULONG, CURSOR_DBNOTIFYREASON[]);
  91. public:
  92. //=--------------------------------------------------------------------------=
  93. // IUnknown methods implemented
  94. //
  95. STDMETHOD(QueryInterface)(REFIID riid, void **ppvObjOut);
  96. STDMETHOD_(ULONG, AddRef)(void);
  97. STDMETHOD_(ULONG, Release)(void);
  98. //=--------------------------------------------------------------------------=
  99. // ICursor methods implemented
  100. //
  101. STDMETHOD(GetColumnsCursor)(REFIID riid, IUnknown **ppvColumnsCursor, ULONG *pcRows);
  102. STDMETHOD(SetBindings)(ULONG cCol, CURSOR_DBCOLUMNBINDING rgBoundColumns[], ULONG cbRowLength, DWORD dwFlags);
  103. STDMETHOD(GetNextRows)(LARGE_INTEGER udlRowsToSkip, CURSOR_DBFETCHROWS *pFetchParams);
  104. STDMETHOD(Requery)(void);
  105. //=--------------------------------------------------------------------------=
  106. // ICursorMove methods implemented
  107. //
  108. STDMETHOD(Move)(ULONG cbBookmark, void *pBookmark, LARGE_INTEGER dlOffset, CURSOR_DBFETCHROWS *pFetchParams);
  109. STDMETHOD(GetBookmark)(CURSOR_DBCOLUMNID *pBookmarkType, ULONG cbMaxSize, ULONG *pcbBookmark, void *pBookmark);
  110. STDMETHOD(Clone)(DWORD dwFlags, REFIID riid, IUnknown **ppvClonedCursor);
  111. //=--------------------------------------------------------------------------=
  112. // ICursorScroll methods implemented
  113. //
  114. STDMETHOD(Scroll)(ULONG ulNumerator, ULONG ulDenominator, CURSOR_DBFETCHROWS *pFetchParams);
  115. STDMETHOD(GetApproximatePosition)(ULONG cbBookmark, void *pBookmark, ULONG *pulNumerator, ULONG *pulDenominator);
  116. STDMETHOD(GetApproximateCount)(LARGE_INTEGER *pudlApproxCount, DWORD *pdwFullyPopulated);
  117. //=--------------------------------------------------------------------------=
  118. // ICursorUpdateARow methods
  119. //
  120. STDMETHOD(BeginUpdate)(DWORD dwFlags);
  121. STDMETHOD(SetColumn)(CURSOR_DBCOLUMNID *pcid, CURSOR_DBBINDPARAMS *pBindParams);
  122. STDMETHOD(GetColumn)(CURSOR_DBCOLUMNID *pcid, CURSOR_DBBINDPARAMS *pBindParams, DWORD *pdwFlags);
  123. STDMETHOD(GetEditMode)(DWORD *pdwState);
  124. STDMETHOD(Update)(CURSOR_DBCOLUMNID *pBookmarkType, ULONG *pcbBookmark, void **ppBookmark);
  125. STDMETHOD(Cancel)(void);
  126. STDMETHOD(Delete)(void);
  127. //=--------------------------------------------------------------------------=
  128. // ICursorFind methods
  129. //
  130. STDMETHOD(FindByValues)(ULONG cbBookmark, LPVOID pBookmark, DWORD dwFindFlags, ULONG cValues,
  131. CURSOR_DBCOLUMNID rgColumns[], CURSOR_DBVARIANT rgValues[], DWORD rgdwSeekFlags[],
  132. CURSOR_DBFETCHROWS FAR *pFetchParams);
  133. //=--------------------------------------------------------------------------=
  134. // IEnrtyID methods
  135. //
  136. STDMETHOD(GetInterface)(ULONG cbEntryID, void *pEntryID, DWORD dwFlags, REFIID riid, IUnknown **ppvObj);
  137. };
  138. #endif //__CVDCURSOR__