Chapter 2 ActiveX C++ Interface Reference
Provides methods that allow your component to influence the transaction outcome. Nontransactional components can call the IObjectContext methods to cause early deactivation of an instance.
The following methods are not supported and always return an HRESULT status of DISP_E_NOTIMPLEMENTED:
The IObjectContext interface contains methods that allow your component to influence the transaction outcome.
Call the GetObjectContext routine to obtain an IObjectContext interface pointer.
GetObjectContext routine, IObjectControl interface
Indicate that the current transaction cannot be committed because the component's work has not been completed; the instance remains active after the current method returns.
#include <jagctx.h>
HRESULT IObjectContext::DisableCommit (void);
Return value |
To indicate |
---|---|
S_OK |
Successfully set transactional state. |
CONTEXT_E_NOCONTEXT |
DisableCommit was called from code that was not executing as part of a Jaguar method invocation. |
DisableCommit specifies that the component instance should not be automatically deactivated after the current method completes. If the instance is deactivated before the next method invocation, the current transaction is rolled back.
When a method calls DisableCommit, the component instance is not deactivated until one of the following happens:
EnableCommit and DisableCommit allow a component maintain state between method calls. If a component is not transactional, these two methods have the same effect: both prevent immediate deactivation of the component.
If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.
EnableCommit, SetAbort, SetComplete
"Understanding Transactions and Component Lifecycle Models" in the Jaguar CTS Programmer's Guide
Indicate that the component should not be deactivated after the current method invocation; allow the current transaction to be committed if the component instance is deactivated.
#include <jagctx.h>
HRESULT IObjectContext::EnableCommit (void);
Return value |
To indicate |
---|---|
S_OK |
Successfully set transactional state. |
CONTEXT_E_NOCONTEXT |
EnableCommit was called from code that was not executing as part of a Jaguar method invocation. |
EnableCommit specifies that the component instance should not be automatically deactivated after the current method completes. If the instance is deactivated before the next method invocation, the current transaction is committed.
When a method calls EnableCommit, the component instance is not deactivated until one of the following happens:
EnableCommit and DisableCommit allow a component maintain state between method calls. If a component is not transactional, these two methods have the same effect: both prevent immediate deactivation of the component.
If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.
DisableCommit, SetAbort, SetComplete
"Understanding Transactions and Component Lifecycle Models" in the Jaguar CTS Programmer's Guide
Determine whether the current method is executing in a transaction.
#include <jagctx.h>
BOOL IObjectContext::IsInTransaction (void);
Return value |
To indicate |
---|---|
TRUE |
The current method invocation is executing within a Jaguar transaction. |
FALSE |
The current method invocation is not executing within a Jaguar transaction. |
Methods can call IsInTransaction to determine whether they are executing within a transaction. Methods in components that are declared to be transactional always execute as part of a transaction.
"Understanding Transactions and Component Lifecycle Models" in the Jaguar CTS Programmer's Guide
Determine whether login security and component authorization are enabled for the Jaguar server.
#include <jagctx.h>
BOOL IObjectContext::IsSecurityEnabled (void);
Return value |
To indicate |
---|---|
TRUE |
Security is enabled. |
FALSE |
Security is not enabled. |
By default, login security and component authorization are disabled for newly installed servers. Security must be configured with Jaguar Manager. See "Security Configuration" in the Jaguar CTS System Administration Guide for instructions.
Note
In the current release, IsSecurityEnabled returns
TRUE regardless of whether security has been enabled in the server
configuration.
Indicate that the component cannot complete its work for the current transaction and that the transaction should be rolled back. The component instance will be deactivated when the method returns.
#include <jagctx.h>
HRESULT IObjectContext::SetAbort (void);
Return value |
To indicate |
---|---|
S_OK |
Successfully set transactional state. |
CONTEXT_E_NOCONTEXT |
SetAbort was called from code that was not executing as part of a Jaguar method invocation. |
SetAbort specifies that the component cannot complete its work for the current transaction. The transaction will be rolled back when the initiating component is deactivated.
If a component is not transactional, then SetAbort and SetComplete have the same effect: both cause the component instance to deactivate after the currently executing method returns.
If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.
DisableCommit, EnableCommit, IsInTransaction, SetComplete
"Understanding Transactions and Component Lifecycle Models" in the Jaguar CTS Programmer's Guide
Indicate that the component's work for the current transaction was successfully finished and that this component instance should be deactivated when the method returns.
#include <jagctx.h>
HRESULT IObjectContext::SetComplete (void);
Return value |
To indicate |
---|---|
S_OK |
Successfully set transactional state. |
CONTEXT_E_NOCONTEXT |
SetComplete was called from code that was not executing as part of a Jaguar method invocation. |
SetComplete specifies that the component has successfully completed its contribution to the current transaction. The component instance deactivates when control returns from the current Jaguar method invocation.
If the component instance is the initiator of the transaction (that is, it was instantiated directly by a base client), then Jaguar attempts to commit the transaction. The transaction commits unless the commit is disallowed or vetoed; depending on the components that are participating, this can happen in any of the following ways:
If a component is not transactional, then SetAbort and SetComplete have the same effect: both cause the component instance to deactivate after the currently executing method returns.
If a method calls none of DisableCommit, EnableCommit, SetAbort, or SetComplete, the default behavior is that of EnableCommit.
DisableCommit, EnableCommit, IsInTransaction, SetAbort
"Understanding Transactions and Component Lifecycle Models" in the Jaguar CTS Programmer's Guide
Copyright © 2000 Sybase, Inc. All rights reserved. |
![]() |