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.

110 lines
3.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995.
  5. //
  6. // File: DisAcc.hxx
  7. //
  8. // Contents: Distributed accessor class
  9. //
  10. // Classes: CDistributedAccessor
  11. //
  12. // History: 05-Jun-95 KyleP Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "accbase.hxx"
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Class: CDistributedAccessor
  20. //
  21. // Purpose: Backing implementation for distributed HACCESSOR
  22. //
  23. // History: 05-Jun-95 KyleP Created.
  24. //
  25. // Notes: Most columns for a distributed query can just be fetched
  26. // from the appropriate child accessor. Bookmark is special.
  27. // a distributed bookmark contains 'hints' from all cursors.
  28. // It is because of these hints that CDistributedAccessor
  29. // needs to intercept calls to the child IRowset::GetData.
  30. //
  31. //----------------------------------------------------------------------------
  32. class CDistributedBookmarkAccessor;
  33. class CDistributedAccessor : public CAccessorBase
  34. {
  35. public:
  36. CDistributedAccessor( IRowset * * const aCursor,
  37. unsigned cCursor,
  38. DBACCESSORFLAGS dwAccessorFlags,
  39. DBCOUNTITEM cBindings,
  40. DBBINDING const * rgBindings,
  41. DBLENGTH cbRowWidth,
  42. DBBINDSTATUS rgStatus[],
  43. void * pCreator,
  44. DBBINDING const * rgAllBindings,
  45. DBCOUNTITEM cAllBindings );
  46. ~CDistributedAccessor();
  47. SCODE GetBindings( DBACCESSORFLAGS * pdwAccessorFlags,
  48. DBCOUNTITEM * pcBindings,
  49. DBBINDING * * prgBindings );
  50. SCODE GetData( unsigned iChild, HROW hrow, void * pData );
  51. SCODE GetData( unsigned iChild, HROW * ahrow, void * pData );
  52. ULONG Release(); // override from base class (AddRef is same)
  53. void SetupBookmarkAccessor( CDistributedBookmarkAccessor * pDistBmkAcc,
  54. DBBINDSTATUS rgStatus[],
  55. DBORDINAL iBookmark,
  56. DBBKMARK cBookmark );
  57. private:
  58. //
  59. // Just for convenience. These could be passed in on every call.
  60. //
  61. IRowset * * const _aCursor;
  62. unsigned _cCursor;
  63. IAccessor * * _aIacc; // IAccessor corresponding to each IRowset
  64. //
  65. // 'Base' accessor. Everything but bookmark.
  66. //
  67. HACCESSOR * _ahaccBase; // One per rowset.
  68. //
  69. // Accessor to fetch bookmarks. Offsets increase for each child.
  70. // Binding may be a composite from several input bindings.
  71. // For example, if the client requests value (in DBBINDING[i])
  72. // and then length and status (in DBBINDING[j]) then _bindBmk
  73. // will fetch value, length, and status.
  74. //
  75. CDistributedBookmarkAccessor * _pDistBmkAcc;
  76. XArray<DBBINDING> _xAllBindings; // all the bindings for this accessor
  77. DBCOUNTITEM _cAllBindings; // count of all bindings
  78. DBACCESSORFLAGS _dwAccessorFlags; // Access Flags
  79. unsigned _cBookmarkOffsets; // Total # of bookmark bindings
  80. XArray<DBBINDING*> _xBookmarkOffsets;// Bookmark binding offsets into _rgAllBindings
  81. DBCOUNTITEM _cBookmark;
  82. };