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.

264 lines
7.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1994-1994, Microsoft Corporation.
  4. //
  5. // File: seqquery.hxx
  6. //
  7. // Contents: Declarations of classes which implement sequential IRowset
  8. // and related OLE DB interfaces over file stores.
  9. //
  10. // Classes: CSeqQuery - container of table/query for a set of seq cursors
  11. //
  12. // History: 09 Jan 95 DwightKr Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <query.hxx>
  17. #include <seqexec.hxx>
  18. const ULONG hSequentialCursor = 0x1000;
  19. //+---------------------------------------------------------------------------
  20. //
  21. // Class: CSeqQuery
  22. //
  23. // Purpose: Encapsulates a sequential query execution context, and PID
  24. // mapper for use by a row cursor.
  25. //
  26. // Interface: PQuery
  27. //
  28. // History: 09-Jan-95 DwightKr Created
  29. //
  30. // Notes:
  31. //
  32. //----------------------------------------------------------------------------
  33. class CSeqQuery : public PQuery
  34. {
  35. public:
  36. //
  37. // Local methods.
  38. //
  39. CSeqQuery( XQueryOptimizer & qopt,
  40. XColumnSet & pcol,
  41. ULONG *pCursor,
  42. XInterface<CPidRemapper> & pidremap,
  43. ICiCDocStore *pDocStore
  44. );
  45. virtual ~CSeqQuery() {}
  46. ULONG AddRef(void);
  47. ULONG Release(void);
  48. void WorkIdToPath( WORKID wid, CFunnyPath & funnyPath );
  49. BOOL CanDoWorkIdToPath() { return FALSE; }
  50. //
  51. // Method supporting load of deferred values.
  52. //
  53. BOOL FetchDeferredValue( WORKID wid,
  54. CFullPropSpec const & ps,
  55. PROPVARIANT & var );
  56. //
  57. // Methods supporting IRowset
  58. //
  59. void SetBindings(
  60. ULONG hCursor,
  61. ULONG cbRowLength,
  62. CTableColumnSet& cols,
  63. CPidMapper & pids
  64. );
  65. virtual SCODE GetRows(
  66. ULONG hCursor,
  67. const CRowSeekDescription& rSeekDesc,
  68. CGetRowsParams& rFetchParams,
  69. XPtr<CRowSeekDescription>& pSeekDescOut
  70. );
  71. virtual void RatioFinished(
  72. ULONG hCursor,
  73. DBCOUNTITEM & rulDenominator,
  74. DBCOUNTITEM & rulNumerator,
  75. DBCOUNTITEM & rcRows,
  76. BOOL & rfNewRows
  77. );
  78. virtual void RestartPosition(
  79. ULONG hCursor,
  80. CI_TBL_CHAPT chapt
  81. )
  82. {
  83. //Win4Assert( !"RestartPosition not supported for sequential cursors" );
  84. THROW(CException( E_NOTIMPL ));
  85. }
  86. //
  87. // Methods supporting IRowsetLocate
  88. //
  89. virtual void Compare(
  90. ULONG hCursor,
  91. CI_TBL_CHAPT chapt,
  92. CI_TBL_BMK bmkFirst,
  93. CI_TBL_BMK bmkSecond,
  94. DWORD & rdwComparison
  95. )
  96. {
  97. Win4Assert( !"Compare not supported for sequential cursors" );
  98. THROW(CException( E_NOTIMPL ));
  99. }
  100. //
  101. // Methods supporting IRowsetScroll
  102. //
  103. virtual void GetApproximatePosition(
  104. ULONG hCursor,
  105. CI_TBL_CHAPT chapt,
  106. CI_TBL_BMK bmk,
  107. DBCOUNTITEM * pulNumerator,
  108. DBCOUNTITEM * pulDenominator
  109. )
  110. {
  111. Win4Assert( !"GetApproximatePosition not supported for sequential cursors" );
  112. THROW(CException( E_NOTIMPL ));
  113. }
  114. //
  115. // Support routines
  116. //
  117. unsigned FreeCursor( ULONG hCursor )
  118. {
  119. Win4Assert( hCursor != 0 );
  120. _VerifyHandle( hCursor );
  121. return 0;
  122. }
  123. virtual SCODE GetNotifications(
  124. CNotificationSync &rSync,
  125. DBWATCHNOTIFY &changeType
  126. )
  127. {
  128. Win4Assert( !"GetNotifications not supported for sequential cursors" );
  129. return E_NOTIMPL;
  130. }
  131. virtual void SetWatchMode (
  132. HWATCHREGION* phRegion,
  133. ULONG mode)
  134. {
  135. Win4Assert( !"SetWatchMode not supported for sequential cursors" );
  136. }
  137. virtual void GetWatchInfo (
  138. HWATCHREGION hRegion,
  139. ULONG* pMode,
  140. CI_TBL_CHAPT* pChapt,
  141. CI_TBL_BMK* pBmk,
  142. DBCOUNTITEM * pcRows)
  143. {
  144. Win4Assert( !"GetWatchInfo not supported for sequential cursors" );
  145. }
  146. virtual void ShrinkWatchRegion (
  147. HWATCHREGION hRegion,
  148. CI_TBL_CHAPT chapt,
  149. CI_TBL_BMK bmk,
  150. LONG cRows )
  151. {
  152. Win4Assert( !"ShrinkWatchRegion not supported for sequential cursors" );
  153. }
  154. virtual void Refresh ()
  155. {
  156. Win4Assert( !"Refresh not supported for sequential cursors" );
  157. }
  158. //
  159. // Methods supporting IRowsetWatchAll
  160. //
  161. virtual void StartWatching(ULONG hCursor)
  162. {
  163. THROW(CException( E_NOTIMPL ));
  164. }
  165. virtual void StopWatching (ULONG hCursor)
  166. {
  167. THROW(CException( E_NOTIMPL ));
  168. }
  169. //
  170. // Methods supporting IRowsetAsync
  171. //
  172. virtual void StopAsynch (ULONG hCursor)
  173. {
  174. THROW(CException( E_NOTIMPL ));
  175. }
  176. //
  177. // Method supporting IRowsetQueryStatus
  178. //
  179. void GetQueryStatus(
  180. ULONG hCursor,
  181. DWORD & rdwStatus);
  182. void GetQueryStatusEx(
  183. ULONG hCursor,
  184. DWORD & rdwStatus,
  185. DWORD & rcFilteredDocuments,
  186. DWORD & rcDocumentsToFilter,
  187. DBCOUNTITEM & rdwRatioFinishedDenominator,
  188. DBCOUNTITEM & rdwRatioFinishedNumerator,
  189. CI_TBL_BMK bmk,
  190. DBCOUNTITEM & riRowBmk,
  191. DBCOUNTITEM & rcRowsTotal );
  192. protected:
  193. ULONG _CreateRowCursor() { return hSequentialCursor; }
  194. virtual void _VerifyHandle( ULONG hCursor ) const;
  195. XInterface<CPidRemapper> _pidremap; // Must be before _QExec
  196. XPtr<CQSeqExecute> _QExec; // The query execution context
  197. CTableCursor _cursor; // Array of table cursors
  198. LONG _ref; // reference count
  199. XInterface<ICiManager> _xCiManager;
  200. XInterface<ICiCDocNameToWorkidTranslator> _xNameToWidTranslator;
  201. };
  202. //+---------------------------------------------------------------------------
  203. //
  204. // Member: CSeqQuery::_VerifyHandle, public
  205. //
  206. // Synopsis: Verifies the handle passed is a legal sequential cursor handle
  207. //
  208. // Effects: Throws E_FAIL if handle invalid.
  209. //
  210. // History: 19-Jan-95 DwightKr Created
  211. //
  212. //----------------------------------------------------------------------------
  213. inline void CSeqQuery::_VerifyHandle( ULONG hCursor ) const
  214. {
  215. if ( hSequentialCursor != hCursor )
  216. THROW( CException(E_FAIL) );
  217. }