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.

102 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1997.
  5. //
  6. // File: XACT.HXX
  7. //
  8. // Contents: Transaction support
  9. //
  10. // Classes: CTransaction
  11. //
  12. // History: 29-Mar-91 KyleP Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class PStorage;
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Class: CTransaction (xact)
  20. //
  21. // Purpose: Transaction support
  22. //
  23. // Interface: CTransaction - Constructor
  24. // ~CTransaction - Destructor
  25. // GetStatus - Retrieve status
  26. // Commit - Set status to commit
  27. //
  28. // History:
  29. // 01-Apr-91 KyleP Created.
  30. // 23-Apr-91 KyleP Replaced sesid with CSession
  31. // 13-Jan-92 BartoszM Reversed logic of Commit/Abort
  32. // 16-Jul-92 BartoszM Removed session
  33. //
  34. // Notes: CTransaction objects must be destroyed in the opposite
  35. // order to their creation.
  36. // A transaction is created in the aborted state.
  37. // Unless Commit is explicitely called the destructor
  38. // will abort the transaction.
  39. //
  40. //----------------------------------------------------------------------------
  41. class CTransaction
  42. {
  43. public:
  44. CTransaction();
  45. enum TStatus
  46. {
  47. XActCommit, // Transaction is successful
  48. XActAbort // Transaction will be aborted
  49. };
  50. inline TStatus GetStatus();
  51. inline void Commit();
  52. protected:
  53. TStatus _status;
  54. };
  55. //+---------------------------------------------------------------------------
  56. //
  57. // Member: CTransaction::GetStatus., public
  58. //
  59. // Synopsis: Returns the current status of the transaction.
  60. //
  61. // Returns: XActCommit if the transaction will commit during object
  62. // destruction. XActAbort if the transaction will abort
  63. // during object destruction.
  64. //
  65. // History: 01-Apr-91 KyleP Created.
  66. //
  67. //----------------------------------------------------------------------------
  68. inline CTransaction::TStatus CTransaction::GetStatus()
  69. {
  70. return(_status);
  71. }
  72. //+---------------------------------------------------------------------------
  73. //
  74. // Member: CTransaction::Commit, public
  75. //
  76. // Synopsis: Set the commit/abort status of the transaction to commit.
  77. //
  78. // Effects: When the transaction object is destroyed, this transaction
  79. // will be committed.
  80. //
  81. // History: 13-Jan-92 BartoszM Created.
  82. //
  83. //----------------------------------------------------------------------------
  84. inline void CTransaction::Commit()
  85. {
  86. _status = XActCommit;
  87. }