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.

300 lines
10 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 2000.
  5. //
  6. // File: proprst.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes: CMRowsetProps : public CUtlProps
  11. //
  12. // History: 02-28-98 danleg Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "propbase.hxx" // base class CUtlProp, CUtlPropInfo
  17. #include <parsver.hxx> // CImpIParserVerify
  18. #include <rstprop.hxx> // CRowsetProperties
  19. #include <propglob.hxx>
  20. //
  21. // Function Definitions
  22. //
  23. void __stdcall GetStringFromLCID( LCID lcid, WCHAR * pwcLocale );
  24. LCID __stdcall GetLCIDFromString( WCHAR * wcsLocale );
  25. struct SPropDescription {
  26. DBPROPID dwProp;
  27. BOOL fSettable;
  28. DWORD dwIndicator;
  29. unsigned uIndex;
  30. };
  31. //+-------------------------------------------------------------------------
  32. //
  33. // Class: CMRowsetProps
  34. //
  35. // Purpose: Properties for Rowset
  36. //
  37. // History: 11-12-97 danleg Created from Monarch
  38. //
  39. //--------------------------------------------------------------------------
  40. class CMRowsetProps : public CUtlProps
  41. {
  42. public:
  43. //
  44. // Ctor -- if pSrc is not 0, FInit() will do a copy
  45. //
  46. CMRowsetProps ( LCID lcidInit = 0 );
  47. CMRowsetProps ( const CMRowsetProps & propSrc );
  48. static const SPropDescription aPropDescriptions[];
  49. static const ULONG cPropDescriptions;
  50. static const SPropDescription aQueryExtPropDescriptions[];
  51. static const ULONG cQueryExtPropDescriptions;
  52. //
  53. // List of property offsets.
  54. // Note that this must match up with the static array
  55. // s_rgRowsetPropSets.
  56. //
  57. enum EID {
  58. // s_rgdbPropRowset[] =
  59. eid_PROP_IAccessor,
  60. eid_PROP_IChapteredRowset,
  61. eid_PROP_IColumnsInfo,
  62. // eid_PROP_IColumnsRowset,
  63. eid_PROP_IConnectionPointContainer,
  64. eid_PROP_IConvertType,
  65. eid_PROP_IRowset,
  66. // eid_PROP_IRowsetChange,
  67. eid_PROP_IRowsetIdentity,
  68. eid_PROP_IRowsetInfo,
  69. eid_PROP_IRowsetLocate,
  70. // eid_PROP_IRowsetResynch,
  71. eid_PROP_IRowsetScroll,
  72. // eid_PROP_IRowsetUpdate,
  73. eid_PROP_ISupportErrorInfo,
  74. eid_PROP_IDBAsynchStatus,
  75. eid_PROP_IRowsetAsynch,
  76. eid_PROP_IRowsetExactScroll,
  77. eid_PROP_IRowsetWatchAll,
  78. eid_PROP_IRowsetWatchRegion,
  79. // eid_PROP_ILockBytes,
  80. // eid_PROP_ISequentialStream,
  81. // eid_PROP_IStorage,
  82. // eid_PROP_IStream,
  83. // eid_PROP_ABORTPRESERVE,
  84. // eid_PROP_APPENDONLY,
  85. eid_PROP_BLOCKINGSTORAGEOBJECTS,
  86. eid_PROP_BOOKMARKS,
  87. eid_PROP_BOOKMARKSKIPPED,
  88. eid_PROP_BOOKMARKTYPE,
  89. // eid_PROP_CACHEDEFERRED,
  90. eid_PROP_CANFETCHBACKWARDS,
  91. eid_PROP_CANHOLDROWS,
  92. eid_PROP_CANSCROLLBACKWARDS,
  93. // eid_PROP_CHANGEINSERTEDROWS,
  94. eid_PROP_COLUMNRESTRICT,
  95. eid_PROP_COMMANDTIMEOUT,
  96. // eid_PROP_COMMITPRESERVE,
  97. // eid_PROP_DEFERRED,
  98. // eid_PROP_DELAYSTORAGEOBJECTS,
  99. // eid_PROP_IMMOBILEROWS,
  100. eid_PROP_LITERALBOOKMARKS,
  101. eid_PROP_LITERALIDENTITY,
  102. eid_PROP_MAXOPENROWS,
  103. //eid_PROP_MAXPENDINGROWS,
  104. eid_PROP_MAXROWS,
  105. eid_PROP_FIRSTROWS,
  106. // eid_PROP_MAYWRITECOLUMN,
  107. eid_PROP_MEMORYUSAGE,
  108. eid_PROP_NOTIFICATIONPHASES,
  109. //eid_PROP_NOTIFYCOLUMNSET,
  110. //eid_PROP_NOTIFYROWDELETE,
  111. //eid_PROP_NOTIFYROWFIRSTCHANGE,
  112. //eid_PROP_NOTIFYROWINSERT,
  113. //eid_PROP_NOTIFYROWRESYNCH,
  114. eid_PROP_NOTIFYROWSETRELEASE,
  115. eid_PROP_NOTIFYROWSETFETCHPOSITIONCHANGE,
  116. //eid_PROP_NOTIFYROWUNDOCHANGE,
  117. //eid_PROP_NOTIFYROWUNDODELETE,
  118. //eid_PROP_NOTIFYROWUNDOINSERT,
  119. //eid_PROP_NOTIFYROWUPDATE,
  120. eid_PROP_ORDEREDBOOKMARKS,
  121. eid_PROP_OTHERINSERT,
  122. eid_PROP_OTHERUPDATEDELETE,
  123. // eid_PROP_OWNINSERT,
  124. // eid_PROP_OWNUPDATEDELETE,
  125. eid_PROP_QUICKRESTART,
  126. eid_PROP_REENTRANTEVENTS,
  127. eid_PROP_REMOVEDELETED,
  128. // eid_PROP_REPORTMULTIPLECHANGES,
  129. // eid_PROP_RETURNPENDINGINSERTS,
  130. eid_PROP_ROWRESTRICT,
  131. eid_PROP_ROWSET_ASYNCH,
  132. eid_PROP_ROWTHREADMODEL,
  133. eid_PROP_SERVERCURSOR,
  134. eid_PROP_STRONGIDENTITY,
  135. // eid_PROP_TRANSACTEDOBJECT,
  136. eid_PROP_UPDATABILITY,
  137. eid_ROWSET_PROPS_NUM,
  138. // s_rgdbPropMSIDXSExt[] =
  139. eid_MSIDXSPROP_ROWSETQUERYSTATUS = 0,
  140. eid_MSIDXSPROP_COMMAND_LOCALE_STRING,
  141. eid_MSIDXSPROP_QUERY_RESTRICTION,
  142. eid_MSIDXS_PROPS_NUM, // total # of entries
  143. // s_rgdbPropQueryExt[] =
  144. eid_PROP_USECONTENTINDEX = 0,
  145. eid_PROP_DEFERNONINDEXEDTRIMMING,
  146. eid_PROP_USEEXTENDEDDBTYPES,
  147. eid_QUERYEXT_PROPS_NUM,
  148. //
  149. // Index into the writable or changeable UPROPVAL buffer
  150. //
  151. eid_PROPVAL_IChapteredRowset = 0,
  152. // eid_PROPVAL_IColumnsRowset,
  153. // eid_PROPVAL_IRowsetChange,
  154. eid_PROPVAL_IConnectionPointContainer,
  155. eid_PROPVAL_IRowsetIdentity,
  156. eid_PROPVAL_IRowsetLocate,
  157. // eid_PROPVAL_IRowsetResynch,
  158. eid_PROPVAL_IRowsetScroll,
  159. // eid_PROPVAL_IRowsetUpdate,
  160. eid_PROPVAL_IDBAsynchStatus,
  161. eid_PROPVAL_IRowsetAsynch,
  162. eid_PROPVAL_IRowsetExactScroll,
  163. eid_PROPVAL_IRowsetWatchAll,
  164. eid_PROPVAL_IRowsetWatchRegion,
  165. // eid_PROPVAL_ILockBytes,
  166. // eid_PROPVAL_ISequentialStream,
  167. // eid_PROPVAL_IStorage,
  168. // eid_PROPVAL_IStream,
  169. // eid_PROPVAL_APPENDONLY,
  170. eid_PROPVAL_BOOKMARKS,
  171. // eid_PROPVAL_CACHEDEFERRED,
  172. eid_PROPVAL_CANFETCHBACKWARDS,
  173. eid_PROPVAL_CANHOLDROWS,
  174. eid_PROPVAL_CANSCROLLBACKWARDS,
  175. // eid_PROPVAL_CHANGEINSERTEDROWS,
  176. eid_PROPVAL_COMMANDTIMEOUT,
  177. // eid_PROPVAL_DEFERRED,
  178. // eid_PROPVAL_IMMOBILEROWS,
  179. eid_PROPVAL_LITERALIDENTITY,
  180. eid_PROPVAL_MAXROWS,
  181. eid_PROPVAL_FIRSTROWS,
  182. // eid_PROPVAL_MAYWRITECOLUMN,
  183. eid_PROPVAL_MEMORYUSAGE,
  184. eid_PROPVAL_ORDEREDBOOKMARKS,
  185. eid_PROPVAL_OTHERINSERT,
  186. eid_PROPVAL_OTHERUPDATEDELETE,
  187. // eid_PROPVAL_OWNINSERT,
  188. // eid_PROPVAL_OWNUPDATEDELETE,
  189. eid_PROPVAL_QUICKRESTART,
  190. // eid_PROPVAL_REPORTMULTIPLECHANGES,
  191. eid_PROPVAL_ROWSET_ASYNCH,
  192. eid_PROPVAL_STRONGIDENTITY,
  193. eid_PROPVAL_ROWSET_NUM,
  194. eid_PROPVAL_USECONTENTINDEX = 0,
  195. eid_PROPVAL_DEFERNONINDEXEDTRIMMING,
  196. eid_PROPVAL_USEEXTENDEDDBTYPES,
  197. eid_PROPVAL_QUERYEXT_NUM,
  198. eid_MSIDXSPROPVAL_ROWSETQUERYSTATUS = 0,
  199. eid_MSIDXSPROPVAL_COMMAND_LOCALE_STRING,
  200. eid_MSIDXSPROPVAL_QUERY_RESTRICTION,
  201. eid_PROPVAL_MSIDXS_NUM,
  202. eid_DBPROPSET_ROWSET = 0,
  203. eid_DBPROPSET_MSIDXS_ROWSET_EXT,
  204. eid_DBPROPSET_QUERY_EXT,
  205. eid_DBPROPSET_NUM,
  206. };
  207. DWORD GetPropertyFlags( ) { return _dwBooleanOptions; }
  208. DWORD SetPropertyFlags( DWORD dwFlags ) { _dwBooleanOptions |= dwFlags;
  209. return _dwBooleanOptions; }
  210. DWORD SetChaptered( BOOL fSet = TRUE );
  211. SCODE SetProperties ( const ULONG cPropertySets,
  212. const DBPROPSET rgPropertySets[] );
  213. DWORD SetImpliedProperties( REFIID riid, ULONG cRowsets );
  214. SCODE ArePropsInError( CMRowsetProps & rProps );
  215. ULONG GetCommandTimeout( ) { return GetValLong( eid_DBPROPSET_ROWSET,
  216. eid_PROPVAL_COMMANDTIMEOUT ); }
  217. ULONG GetMaxResults( ) { return GetValLong( eid_DBPROPSET_ROWSET,
  218. eid_PROPVAL_MAXROWS ); }
  219. ULONG GetFirstRows() { return GetValLong( eid_DBPROPSET_ROWSET,
  220. eid_PROPVAL_FIRSTROWS ); }
  221. ULONG GetMaxOpenRows( ) { return 0; }
  222. // BUBGUG: This is not settable.
  223. // GetValLong( eid_DBPROPSET_ROWSET,
  224. // eid_PROPVAL_MAXOPENROWS ); }
  225. ULONG GetMemoryUsage( ) { return GetValLong( eid_DBPROPSET_ROWSET,
  226. eid_PROPVAL_MEMORYUSAGE ); }
  227. LCID GetInitLCID() { return _lcidInit; }
  228. void SetFirstRows( ULONG ulFirstRows );
  229. private:
  230. static SPropDescription const * FindPropertyDescription(
  231. SPropDescription const * prgPropDesc,
  232. unsigned cPropDesc,
  233. DBPROPID dwPropId );
  234. static SPropDescription const * FindInterfaceDescription( REFIID riid );
  235. void UpdateBooleanOptions( const ULONG cPropStes,
  236. const DBPROPSET rgPropertySets[] );
  237. LCID _lcidInit;
  238. DWORD _dwBooleanOptions;
  239. //
  240. // Initialize the properties this class manages
  241. //
  242. SCODE InitAvailUPropSets( ULONG * pcUPropSet,
  243. UPROPSET ** ppUPropSet,
  244. ULONG * pcElemPer );
  245. //
  246. // Initialize the properties this class supports
  247. //
  248. SCODE InitUPropSetsSupported( DWORD * rgdwSupported );
  249. //
  250. // Given a propset and propid, return the default value
  251. //
  252. SCODE GetDefaultValue ( ULONG iCurSet,
  253. DBPROPID dwPropId,
  254. DWORD * pdwOption,
  255. VARIANT * pvValue );
  256. //
  257. // Given a propset and propid, determine if the value is valid
  258. //
  259. SCODE IsValidValue ( ULONG iCurSet,
  260. DBPROP * pDBProp );
  261. };