transact.idl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. //-----------------------------------------------------------------------------
  2. // File: transact.idl
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation
  5. //
  6. // Contents: The basic transaction interfaces and types.
  7. //
  8. // Comments:
  9. //
  10. //-----------------------------------------------------------------------------
  11. cpp_quote("//-----------------------------------------------------------------------------")
  12. cpp_quote("// File: .C or .H file generated by transact.idl ")
  13. cpp_quote("//")
  14. cpp_quote("// Copyright: Copyright (c) 1998-1999 Microsoft Corporation")
  15. cpp_quote("//")
  16. cpp_quote("// Contents: .C or .H file generated by transact.idl")
  17. cpp_quote("//")
  18. cpp_quote("// Comments: Microsoft OLE DB")
  19. cpp_quote("//")
  20. cpp_quote("//-----------------------------------------------------------------------------")
  21. cpp_quote("")
  22. import "unknwn.idl";
  23. //
  24. //--------------------------------------------------------------------------
  25. //
  26. interface ITransaction;
  27. interface ITransactionDispenser;
  28. interface ITransactionOptions;
  29. interface ITransactionOutcomeEvents;
  30. interface ITransactionCompletionEvents;
  31. cpp_quote("#ifndef DECLSPEC_UUID")
  32. cpp_quote("#if (_MSC_VER >= 1100) && defined (__cplusplus)")
  33. cpp_quote("#define DECLSPEC_UUID(x) __declspec(uuid(x))")
  34. cpp_quote("#else")
  35. cpp_quote("#define DECLSPEC_UUID(x)")
  36. cpp_quote("#endif")
  37. cpp_quote("#endif")
  38. //==========================================================================
  39. // Transaction related types
  40. //==========================================================================
  41. [local,pointer_default(unique)]
  42. interface BasicTransactionTypes
  43. {
  44. typedef struct BOID {
  45. byte rgb[16];
  46. } BOID;
  47. cpp_quote("#define BOID_NULL (*((BOID*)(&IID_NULL)))")
  48. // change the following two line together
  49. cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED") // conflicts with uimsg.h. This is temporary work around
  50. cpp_quote("#define MAX_TRAN_DESC_DEFINED")
  51. typedef enum TX_MISC_CONSTANTS
  52. {
  53. MAX_TRAN_DESC = 40
  54. } TX_MISC_CONSTANTS;
  55. cpp_quote("#endif")
  56. // Unit Of Work.
  57. typedef BOID XACTUOW;
  58. // Data type for isolation level values.
  59. typedef LONG ISOLEVEL;
  60. // Constants that specifiy isolation level of a transaction.
  61. typedef enum ISOLATIONLEVEL {
  62. ISOLATIONLEVEL_UNSPECIFIED = 0xFFFFFFFF, //
  63. ISOLATIONLEVEL_CHAOS = 0x00000010, //
  64. ISOLATIONLEVEL_READUNCOMMITTED = 0x00000100, //
  65. ISOLATIONLEVEL_BROWSE = 0x00000100, // Synonym for _READUNCOMITTED
  66. ISOLATIONLEVEL_CURSORSTABILITY = 0x00001000, //
  67. ISOLATIONLEVEL_READCOMMITTED = 0x00001000, // Synonym for _CURSORSTABILITY
  68. ISOLATIONLEVEL_REPEATABLEREAD = 0x00010000, //
  69. ISOLATIONLEVEL_SERIALIZABLE = 0x00100000, //
  70. ISOLATIONLEVEL_ISOLATED = 0x00100000, // Synonym for _SERIALIZABLE
  71. } ISOLATIONLEVEL;
  72. // Transaction information structure, used in ITransaction
  73. typedef struct XACTTRANSINFO {
  74. XACTUOW uow; // The current unit of work
  75. ISOLEVEL isoLevel; // The isolation level for the current UOW
  76. ULONG isoFlags; // Values from ISOFLAG enumeration
  77. DWORD grfTCSupported; // Flags indicating capabilities
  78. DWORD grfRMSupported; // ... of this transaction wrt
  79. DWORD grfTCSupportedRetaining; // ... parameters to Commit
  80. DWORD grfRMSupportedRetaining; // ...
  81. } XACTTRANSINFO;
  82. typedef struct XACTSTATS {
  83. ULONG cOpen; // The number of currently extant transactions.
  84. ULONG cCommitting; // The number of transactions which are proceding towards committing.
  85. ULONG cCommitted; // The number of transactions that are have been committed.
  86. ULONG cAborting; // The number of transactions which are in the process of aborting.
  87. ULONG cAborted; // The number of transactions that are have been aborted.
  88. ULONG cInDoubt; // The number of transactions which are presently in doubt.
  89. ULONG cHeuristicDecision; // The number of transactions that have completed by heuristic decision.
  90. FILETIME timeTransactionsUp; // The amount of time that this transaction service has been up.
  91. } XACTSTATS;
  92. // @enum ISOFLAG | Used in <t XACTTRANSINFO> and <i ITransactionDispenser>.
  93. typedef enum ISOFLAG {
  94. ISOFLAG_RETAIN_COMMIT_DC = 1, // Use just one of ISOFLAG_RETAIN_COMMIT values
  95. ISOFLAG_RETAIN_COMMIT = 2, //
  96. ISOFLAG_RETAIN_COMMIT_NO = 3, //
  97. ISOFLAG_RETAIN_ABORT_DC = 4, // Use just one of ISOFLAG_RETAIN_ABORT values
  98. ISOFLAG_RETAIN_ABORT = 8, //
  99. ISOFLAG_RETAIN_ABORT_NO = 12, //
  100. ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, //
  101. ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT, //
  102. ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, //
  103. ISOFLAG_OPTIMISTIC = 16, //
  104. ISOFLAG_READONLY = 32 //
  105. } ISOFLAG;
  106. // Used in ITransactionDispenser
  107. // A bit field of 32 bits; be sure to mask before comparing.
  108. typedef enum XACTTC {
  109. XACTTC_SYNC_PHASEONE = 1,
  110. XACTTC_SYNC_PHASETWO = 2,
  111. XACTTC_SYNC = 2, // nb alias for XACTTC_SYNC_PHASETWO
  112. XACTTC_ASYNC_PHASEONE = 4,
  113. XACTTC_ASYNC = 4 // nb alias for XACTTC_ASYNC_PHASEONE
  114. } XACTTC;
  115. // Used in ITransactionDispenser
  116. // A bit field of 32 bits; be sure to mask before comparing.
  117. typedef enum XACTRM {
  118. XACTRM_OPTIMISTICLASTWINS = 1, //
  119. XACTRM_NOREADONLYPREPARES = 2, //
  120. } XACTRM;
  121. typedef enum XACTCONST {
  122. XACTCONST_TIMEOUTINFINITE = 0, //
  123. } XACTCONST;
  124. typedef enum XACTHEURISTIC {
  125. XACTHEURISTIC_ABORT = 1,
  126. XACTHEURISTIC_COMMIT = 2,
  127. XACTHEURISTIC_DAMAGE = 3,
  128. XACTHEURISTIC_DANGER = 4,
  129. } XACTHEURISTIC;
  130. typedef enum XACTSTAT {
  131. XACTSTAT_NONE = 0x00000000,
  132. XACTSTAT_OPENNORMAL = 0x00000001,
  133. XACTSTAT_OPENREFUSED = 0x00000002,
  134. XACTSTAT_PREPARING = 0x00000004,
  135. XACTSTAT_PREPARED = 0x00000008,
  136. XACTSTAT_PREPARERETAINING = 0x00000010,
  137. XACTSTAT_PREPARERETAINED = 0x00000020,
  138. XACTSTAT_COMMITTING = 0x00000040,
  139. XACTSTAT_COMMITRETAINING = 0x00000080,
  140. XACTSTAT_ABORTING = 0x00000100,
  141. XACTSTAT_ABORTED = 0x00000200,
  142. XACTSTAT_COMMITTED = 0x00000400,
  143. XACTSTAT_HEURISTIC_ABORT = 0x00000800,
  144. XACTSTAT_HEURISTIC_COMMIT = 0x00001000,
  145. XACTSTAT_HEURISTIC_DAMAGE = 0x00002000,
  146. XACTSTAT_HEURISTIC_DANGER = 0x00004000,
  147. XACTSTAT_FORCED_ABORT = 0x00008000,
  148. XACTSTAT_FORCED_COMMIT = 0x00010000,
  149. XACTSTAT_INDOUBT = 0x00020000,
  150. XACTSTAT_CLOSED = 0x00040000,
  151. XACTSTAT_OPEN = 0x00000003,
  152. XACTSTAT_NOTPREPARED = 0x0007FFC3,
  153. XACTSTAT_ALL = 0x0007FFFF,
  154. } XACTSTAT;
  155. typedef struct XACTOPT { // Transaction configuration options
  156. ULONG ulTimeout; // timeout in milliseconds
  157. char szDescription[MAX_TRAN_DESC]; // description string for admin tools
  158. } XACTOPT;
  159. //
  160. //==========================================================================
  161. // Error code definitions for all transaction related functionality.
  162. //==========================================================================
  163. //
  164. /*
  165. typedef enum XACT_E {
  166. XACT_E_FIRST = 0x8004D000,
  167. XACT_E_LAST = 0x8004D022,
  168. XACT_S_FIRST = 0x0004D000,
  169. XACT_S_LAST = 0x0004D009,
  170. XACT_E_ALREADYOTHERSINGLEPHASE = 0x8004D000,
  171. XACT_E_CANTRETAIN = 0x8004D001,
  172. XACT_E_COMMITFAILED = 0x8004D002,
  173. XACT_E_COMMITPREVENTED = 0x8004D003,
  174. XACT_E_HEURISTICABORT = 0x8004D004,
  175. XACT_E_HEURISTICCOMMIT = 0x8004D005,
  176. XACT_E_HEURISTICDAMAGE = 0x8004D006,
  177. XACT_E_HEURISTICDANGER = 0x8004D007,
  178. XACT_E_ISOLATIONLEVEL = 0x8004D008,
  179. XACT_E_NOASYNC = 0x8004D009,
  180. XACT_E_NOENLIST = 0x8004D00A,
  181. XACT_E_NOISORETAIN = 0x8004D00B,
  182. XACT_E_NORESOURCE = 0x8004D00C,
  183. XACT_E_NOTCURRENT = 0x8004D00D,
  184. XACT_E_NOTRANSACTION = 0x8004D00E,
  185. XACT_E_NOTSUPPORTED = 0x8004D00F,
  186. XACT_E_UNKNOWNRMGRID = 0x8004D010,
  187. XACT_E_WRONGSTATE = 0x8004D011,
  188. XACT_E_WRONGUOW = 0x8004D012,
  189. XACT_E_XTIONEXISTS = 0x8004D013,
  190. XACT_E_NOIMPORTOBJECT = 0x8004D014,
  191. XACT_E_INVALIDCOOKIE = 0x8004D015,
  192. XACT_E_INDOUBT = 0x8004D016,
  193. XACT_E_NOTIMEOUT = 0x8004D017,
  194. XACT_E_ALREADYINPROGRESS = 0x8004D018,
  195. XACT_E_ABORTED = 0x8004D019,
  196. XACT_E_LOGFULL = 0x8004D01A,
  197. XACT_E_TMNOTAVAILABLE = 0x8004D01B,
  198. XACT_E_CONNECTION_DOWN = 0x8004D01C,
  199. XACT_E_CONNECTION_DENIED = 0x8004D01D,
  200. XACT_E_REENLISTTIMEOUT = 0x8004D01E,
  201. XACT_E_TIP_CONNECT_FAILED = 0x8004D01F,
  202. XACT_E_TIP_PROTOCOL_ERROR = 0x8004D020,
  203. XACT_E_TIP_PULL_FAILED = 0x8004D021,
  204. XACT_E_DEST_TMNOTAVAILABLE = 0x8004D022,
  205. // TXF log & CRM
  206. XACT_E_CLERKNOTFOUND = 0x8004d080,
  207. XACT_E_CLERKEXISTS = 0x8004d081,
  208. XACT_E_RECOVERYINPROGRESS = 0x8004d082,
  209. XACT_E_TRANSACTIONCLOSED = 0x8004d083,
  210. XACT_E_INVALIDLSN = 0x8004d084,
  211. XACT_E_REPLAYREQUEST = 0x8004d085,
  212. XACT_S_ASYNC = 0x0004D000,
  213. XACT_S_DEFECT = 0x0004D001,
  214. XACT_S_READONLY = 0x0004D002,
  215. XACT_S_SOMENORETAIN = 0x0004D003,
  216. XACT_S_OKINFORM = 0x0004D004,
  217. XACT_S_MADECHANGESCONTENT = 0x0004D005,
  218. XACT_S_MADECHANGESINFORM = 0x0004D006,
  219. XACT_S_ALLNORETAIN = 0x0004D007,
  220. XACT_S_ABORTING = 0x0004D008,
  221. XACT_S_SINGLEPHASE = 0x0004D009,
  222. } XACT_E;
  223. */
  224. }
  225. //
  226. //==========================================================================
  227. // Basic transaction interfaces
  228. //==========================================================================
  229. //
  230. // Transaction interface, single phase
  231. [object,uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020), pointer_default(unique)]
  232. interface ITransaction : IUnknown {
  233. HRESULT Commit
  234. (
  235. [in] BOOL fRetaining,
  236. [in] DWORD grfTC,
  237. [in] DWORD grfRM
  238. );
  239. HRESULT Abort
  240. (
  241. [in, unique] BOID* pboidReason,
  242. [in] BOOL fRetaining,
  243. [in] BOOL fAsync
  244. );
  245. HRESULT GetTransactionInfo
  246. (
  247. [out] XACTTRANSINFO* pinfo
  248. );
  249. }
  250. //
  251. //--------------------------------------------------------------------------
  252. //
  253. // Interface by which new transactions are commonly created
  254. [object,uuid(3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  255. interface ITransactionDispenser : IUnknown {
  256. HRESULT GetOptionsObject
  257. (
  258. [out] ITransactionOptions** ppOptions
  259. );
  260. HRESULT BeginTransaction
  261. (
  262. [in, unique] IUnknown* punkOuter, // controlling unknown
  263. [in] ISOLEVEL isoLevel, // isolation level for xtion
  264. [in] ULONG isoFlags, // values from ISOFLAG enumeration
  265. [in, unique] ITransactionOptions* pOptions, // pointer retrieved from previous GetOptions
  266. [out] ITransaction** ppTransaction
  267. );
  268. }
  269. //
  270. //--------------------------------------------------------------------------
  271. //
  272. [object,uuid(3A6AD9E0-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  273. interface ITransactionOptions : IUnknown {
  274. HRESULT SetOptions
  275. (
  276. [in] XACTOPT* pOptions
  277. );
  278. HRESULT GetOptions
  279. (
  280. [in,out] XACTOPT* pOptions
  281. );
  282. }
  283. //
  284. //--------------------------------------------------------------------------
  285. //
  286. [object,uuid(3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  287. interface ITransactionOutcomeEvents : IUnknown {
  288. HRESULT Committed
  289. (
  290. [in] BOOL fRetaining,
  291. [in, unique] XACTUOW* pNewUOW,
  292. [in] HRESULT hr
  293. );
  294. HRESULT Aborted
  295. (
  296. [in, unique] BOID* pboidReason,
  297. [in] BOOL fRetaining,
  298. [in, unique] XACTUOW* pNewUOW,
  299. [in] HRESULT hr
  300. );
  301. HRESULT HeuristicDecision
  302. (
  303. [in] DWORD dwDecision,
  304. [in, unique] BOID* pboidReason,
  305. [in] HRESULT hr
  306. );
  307. HRESULT Indoubt
  308. (
  309. void
  310. );
  311. }
  312. cpp_quote("")
  313. cpp_quote("")
  314. cpp_quote("#if _MSC_VER < 1100 || !defined(__cplusplus)")
  315. cpp_quote("")
  316. cpp_quote("DEFINE_GUID(IID_ITransaction, 0x0fb15084, 0xaf41, 0x11ce, 0xbd, 0x2b, 0x20, 0x4c, 0x4f, 0x4f, 0x50, 0x20);")
  317. cpp_quote("DEFINE_GUID(IID_ITransactionDispenser, 0x3A6AD9E1, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  318. cpp_quote("DEFINE_GUID(IID_ITransactionOptions, 0x3A6AD9E0, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  319. cpp_quote("DEFINE_GUID(IID_ITransactionOutcomeEvents, 0x3A6AD9E2, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  320. cpp_quote("")
  321. cpp_quote("#else")
  322. cpp_quote("")
  323. cpp_quote("#define IID_ITransaction __uuidof(ITransaction)")
  324. cpp_quote("#define IID_ITransactionDispenser __uuidof(ITransactionDispenser)")
  325. cpp_quote("#define IID_ITransactionOptions __uuidof(ITransactionOptions)")
  326. cpp_quote("#define IID_ITransactionOutcomeEvents __uuidof(ITransactionOutcomeEvents)")
  327. cpp_quote("")
  328. cpp_quote("#endif")