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.

142 lines
3.4 KiB

  1. /*
  2. * _ F S S R C H . H
  3. *
  4. * File system search routines
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #ifndef __FSSRCH_H_
  9. #define __FSSRCH_H_
  10. #include <xsearch.h>
  11. //$REVIEW: 4510 -- Should we work this one out of the code?
  12. #pragma warning(disable:4510) // default constructor could not be generated
  13. #pragma warning(disable:4610) // class can never be instantiated - user defined constructor required
  14. typedef std::list<CRCWszi, heap_allocator<CRCWszi> > CWsziList;
  15. #include <oledb.h>
  16. // CSearchRowsetContext ------------------------------------------------------
  17. //
  18. class CSearchRowsetContext : public CSearchContext
  19. {
  20. // non-implemented operators
  21. //
  22. CSearchRowsetContext( const CSearchRowsetContext& );
  23. CSearchRowsetContext& operator=( const CSearchRowsetContext& );
  24. protected:
  25. auto_com_ptr<IRowset> m_prs; // Rowset
  26. auto_heap_ptr<DBBINDING> m_rgBindings; // array of column bindings
  27. auto_com_ptr<IAccessor> m_pAcc; // IAccessor
  28. auto_heap_ptr<BYTE> m_pData; // data buffer
  29. DBCOUNTITEM m_cHRow; // length of array of HROWS
  30. HROW * m_rgHRow; // array of HROWs
  31. HACCESSOR m_hAcc; // array of accessors
  32. ULONG m_ulRowCur; // current row
  33. ULONG m_cRowsEmitted; // Number of rows emitted
  34. // Rowset specific methods
  35. //
  36. VOID CleanUp();
  37. public:
  38. virtual ~CSearchRowsetContext() {}
  39. CSearchRowsetContext ()
  40. : m_cHRow(0),
  41. m_rgHRow(NULL),
  42. m_hAcc(NULL),
  43. m_ulRowCur(0),
  44. m_cRowsEmitted(0)
  45. {
  46. }
  47. // When the parser finds an item that applies to the search, a call is
  48. // made such that the context is informed of the desired search.
  49. //
  50. virtual SCODE ScSetSQL(CParseNmspcCache * pnsc, LPCWSTR pwszSQL) = 0;
  51. // Search processing
  52. //
  53. virtual SCODE ScMakeQuery() = 0;
  54. virtual SCODE ScEmitResults (CXMLEmitter& emitter);
  55. // Impl. specific rowset methods
  56. //
  57. virtual SCODE ScCreateAccessor () = 0;
  58. virtual SCODE ScEmitRow (CXMLEmitter& emitter) = 0;
  59. // OLE DB Error code translations
  60. //
  61. static ULONG HscFromDBStatus (ULONG ulStatus);
  62. };
  63. // Search XMLDocument --------------------------------------------------------
  64. //
  65. class CFSSearch : public CSearchRowsetContext
  66. {
  67. IMethUtil * m_pmu;
  68. // Receives the string buffer returned from
  69. // GetColumnInfo. it is allocated by OLE DB
  70. // provider and should be freed with
  71. // CoTaskMemFree
  72. //
  73. LPWSTR m_pwszBuf;
  74. DBCOLUMNINFO * m_rgInfo;
  75. // Used for SQL
  76. //
  77. StringBuffer<WCHAR> m_sbSQL;
  78. auto_com_ptr<ICommandText> m_pCommandText;
  79. // Find context
  80. //
  81. CFSFind m_cfc;
  82. // Used for child-vroot processing
  83. //
  84. ChainedStringBuffer<WCHAR> m_csb;
  85. CVRList m_vrl;
  86. // non-implemented operators
  87. //
  88. CFSSearch( const CFSSearch& );
  89. CFSSearch& operator=( const CFSSearch& );
  90. LPCWSTR PwszSQL() const { return m_sbSQL.PContents(); }
  91. public:
  92. CFSSearch(IMethUtil * pmu)
  93. : m_pmu(pmu),
  94. m_rgInfo(NULL),
  95. m_pwszBuf(NULL)
  96. {
  97. }
  98. ~CFSSearch()
  99. {
  100. // free information returned from IColumnInfo
  101. //
  102. CoTaskMemFree (m_rgInfo);
  103. CoTaskMemFree (m_pwszBuf);
  104. }
  105. // Impl. methods
  106. //
  107. virtual SCODE ScMakeQuery();
  108. virtual SCODE ScSetSQL(CParseNmspcCache * pnsc, LPCWSTR pwszSQL);
  109. virtual SCODE ScEmitRow (CXMLEmitter& emitter);
  110. virtual SCODE ScCreateAccessor();
  111. IPreloadNamespaces * PPreloadNamespaces () { return &m_cfc; }
  112. };
  113. #endif // __FSSRCH_H_