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.

201 lines
4.7 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996
  5. //
  6. // File: ccommand.hxx
  7. //
  8. // Contents: Microsoft OleDB/OleDS Data Source Object for LDAP
  9. //
  10. //
  11. // History: 08-01-96 shanksh Created.
  12. //
  13. //----------------------------------------------------------------------------
  14. #ifndef _CCOMMAND_HXX
  15. #define _CCOMMAND_HXX
  16. enum COMMAND_STATUS_FLAG {
  17. // Command Object status flags
  18. CMD_STATUS_MASK = 0x00000FFF,
  19. CMD_INITIALIZED = 0x00000001,
  20. CMD_HAVE_TXN_SUPPORT = 0x00000002,
  21. CMD_TEXT_SET = 0x00000020,
  22. CMD_PREPARED = 0x00000040,
  23. CMD_EXEC_CANCELLED = 0x10000000,
  24. };
  25. extern const GUID DBGUID_LDAPDialect;
  26. // Constant values for dwFlags on ICommand::Execute
  27. const DWORD EXECUTE_NOROWSET = 0x00000001;
  28. const DWORD EXECUTE_SUCCESSWITHINFO = 0x00000002;
  29. const DWORD EXECUTE_NEWHSTMT = 0x00000004;
  30. const DWORD EXECUTE_NONROWRETURNING = 0x00000008;
  31. const DWORD EXECUTE_RESTART = 0x00000010;
  32. class CCommandObject;
  33. class CCommandObject : INHERIT_TRACKING,
  34. public IAccessor,
  35. public IColumnsInfo,
  36. public ICommandText,
  37. public ICommandProperties,
  38. public ICommandPrepare,
  39. public IConvertType {
  40. friend class CImpIAccessor;
  41. protected:
  42. LPUNKNOWN _pUnkOuter;
  43. //
  44. // Parent Session Object
  45. //
  46. CSessionObject * _pCSession;
  47. //
  48. // Execution Status Flags
  49. //
  50. DWORD _dwStatus;
  51. //
  52. // Count of Active Rowsets on this command object
  53. //
  54. ULONG _cRowsetsOpen;
  55. //
  56. // Critical Section for ICommand::Cancel timing issues
  57. //
  58. CRITICAL_SECTION _csCancel;
  59. //
  60. // GUID for dialect of current text
  61. //
  62. GUID _guidCmdDialect;
  63. //
  64. // current Command text, if any
  65. //
  66. LPWSTR _pszCommandText;
  67. LPWSTR _pszCommandTextCp;
  68. LPWSTR _pszADsContext;
  69. LPWSTR _pszSearchFilter;
  70. LPWSTR * _ppszAttrs;
  71. DWORD _cAttrs;
  72. DWORD _searchScope;
  73. //@cmember Contained IAccessor
  74. CImpIAccessor * _pAccessor;
  75. IMalloc * _pIMalloc;
  76. //
  77. // Utility object to manage properties
  78. //
  79. PCUTILPROP _pUtilProp;
  80. IDirectorySearch * _pDSSearch;
  81. //
  82. // Credentials from the Data Source Object
  83. //
  84. CCredentials _Credentials;
  85. BOOL _fADSPathPresent;
  86. // flag to indicate if the query was a SELECT * query
  87. BOOL _fAllAttrs;
  88. STDMETHODIMP
  89. SplitCommandText(
  90. LPWSTR pszParsedCmd
  91. );
  92. HRESULT
  93. SeekPastADsPath(
  94. IN LPWSTR pszIn,
  95. OUT LPWSTR *ppszOut
  96. );
  97. HRESULT
  98. SeekPastSearchFilter(
  99. IN LPWSTR pszIn,
  100. OUT LPWSTR *ppszOut
  101. );
  102. public:
  103. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  104. BOOL FInit(CSessionObject *pSession, CCredentials& Credentials);
  105. DECLARE_STD_REFCOUNTING
  106. DECLARE_IAccessor_METHODS
  107. DECLARE_IColumnsInfo_METHODS
  108. DECLARE_ICommand_METHODS
  109. DECLARE_ICommandText_METHODS
  110. DECLARE_ICommandProperties_METHODS
  111. DECLARE_IConvertType_METHODS
  112. DECLARE_ICommandPrepare_METHODS
  113. inline BOOL IsCommandSet() { return !!(_dwStatus & CMD_TEXT_SET);};
  114. inline void DecrementOpenRowsets()
  115. {
  116. InterlockedDecrement( (LONG*) &_cRowsetsOpen );
  117. };
  118. inline void IncrementOpenRowsets()
  119. {
  120. InterlockedIncrement( (LONG*) &_cRowsetsOpen );
  121. }
  122. inline BOOL IsRowsetOpen()
  123. { return (_cRowsetsOpen > 0) ? TRUE : FALSE;};
  124. STDMETHODIMP
  125. CCommandObject::GetDBType(
  126. PADS_ATTR_DEF pAttrDefinitions,
  127. DWORD dwNumAttrs,
  128. LPWSTR pszAttrName,
  129. WORD *pwType,
  130. DBLENGTH *pulSize
  131. );
  132. STDMETHODIMP
  133. CCommandObject::SetSearchPrefs(
  134. void
  135. );
  136. CCommandObject::CCommandObject(
  137. LPUNKNOWN pIUnknown
  138. );
  139. CCommandObject::~CCommandObject();
  140. STDMETHODIMP
  141. CCommandObject::GetColumnInfo2(
  142. DBORDINAL *pcColumns,
  143. DBCOLUMNINFO **prgInfo,
  144. OLECHAR **ppStringBuffer,
  145. BOOL **ppfMultiValued
  146. );
  147. inline BOOL IsCommandPrepared() {
  148. return !!(_dwStatus & CMD_PREPARED);
  149. }
  150. inline CCredentials GetCredentials() {
  151. return _Credentials;
  152. }
  153. STDMETHODIMP PrepareHelper(void);
  154. };
  155. #endif