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.

123 lines
3.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: rstprop.hxx
  7. //
  8. // Contents: ICommandProperties support class
  9. //
  10. // Classes: CRowsetProperties
  11. //
  12. // History: 30 Jun 1995 AlanW Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <proprst.hxx>
  17. enum PropertyOptionsEnum {
  18. eSequential = 0x0001,
  19. eLocatable = 0x0002,
  20. eScrollable = 0x0004,
  21. eAsynchronous = 0x0008,
  22. // eNotifiable = 0x0010,
  23. eWatchable = 0x0020,
  24. eDistributed = 0x0100,
  25. eHoldRows = 0x0200,
  26. eChaptered = 0x0800,
  27. eUseCI = 0x1000,
  28. eDeferTrimming = 0x2000,
  29. eExtendedTypes = 0x4000,
  30. eFirstRows = 0x0080,
  31. eDefaultFalse = 0,
  32. eDefaultTrue = 0xFFFF,
  33. eNotSupported = 0xFFFE,
  34. eColumnProp = 0xFFFD,
  35. eNumeric = 0xFFFC,
  36. };
  37. class CRowsetProperties
  38. {
  39. public:
  40. CRowsetProperties( DWORD dwFlags = 0 ) :
  41. _uBooleanOptions ( dwFlags ),
  42. _ulMaxOpenRows ( 0 ),
  43. _ulMemoryUsage ( 0 ),
  44. _cMaxResults( 0 ),
  45. _cCmdTimeout( 0 ) { }
  46. CRowsetProperties( CRowsetProperties const & rProps ) :
  47. _uBooleanOptions ( rProps._uBooleanOptions ),
  48. _ulMaxOpenRows ( rProps._ulMaxOpenRows ),
  49. _ulMemoryUsage ( rProps._ulMemoryUsage ),
  50. _cMaxResults ( rProps._cMaxResults ),
  51. _cCmdTimeout( rProps._cCmdTimeout ) { }
  52. DWORD GetPropertyFlags( ) const { return _uBooleanOptions; }
  53. void SetDefaults( CRowsetProperties & rProp )
  54. {
  55. _uBooleanOptions = rProp._uBooleanOptions;
  56. _ulMaxOpenRows = rProp._ulMaxOpenRows;
  57. _ulMemoryUsage = rProp._ulMemoryUsage;
  58. _cMaxResults = rProp._cMaxResults;
  59. _cCmdTimeout = rProp._cCmdTimeout;
  60. }
  61. void SetDefaults( DWORD dwOptions, ULONG ulMaxRows = 0, ULONG ulMem = 0, ULONG cMaxResults = 0, ULONG cCmdTimeout = 0, ULONG cFirstRows = 0 )
  62. {
  63. _uBooleanOptions = dwOptions;
  64. _ulMaxOpenRows = ulMaxRows;
  65. _ulMemoryUsage = ulMem;
  66. _cCmdTimeout = cCmdTimeout;
  67. if ( cFirstRows > 0 )
  68. {
  69. if ( cMaxResults > 0 )
  70. THROW( CException( E_INVALIDARG ) );
  71. Win4Assert( 0 != ( eFirstRows & _uBooleanOptions ) );
  72. _cMaxResults = cFirstRows;
  73. }
  74. else
  75. _cMaxResults = cMaxResults;
  76. }
  77. void Marshall( PSerStream & ss ) const;
  78. void Unmarshall( PDeSerStream & ss );
  79. ULONG GetCommandTimeout() const { return _cCmdTimeout; }
  80. ULONG GetMaxResults() const
  81. {
  82. if ( IsFirstRowsSet() )
  83. return 0;
  84. else
  85. return _cMaxResults;
  86. }
  87. ULONG GetFirstRows() const
  88. {
  89. if ( IsFirstRowsSet() )
  90. return _cMaxResults;
  91. else
  92. return 0;
  93. }
  94. BOOL IsFirstRowsSet() const { return ( 0 != (eFirstRows & _uBooleanOptions) ); }
  95. private:
  96. DWORD _uBooleanOptions; // binary option flags
  97. ULONG _ulMaxOpenRows; // rowset info max. open rows
  98. ULONG _ulMemoryUsage; // rowset info mem. usage
  99. ULONG _cMaxResults; // limit on # results
  100. ULONG _cCmdTimeout; // query execution timeout
  101. };