The ax_unreg() function
The ax_unreg() function allows DataBlade® modules or applications using user-defined routines (UDRs) to unregister previously registered XA-compliant, external data sources (also called resource managers) from transactions.
Syntax
int ax_unreg(int rmid,
int4 flags)
- rmid
- The resource manager ID.
- flags
- Must be set to
TMNOFLAGS
. The value forTMNOFLAGS
is defined in the $INFORMIXDIR/incl/public/xa.h file.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
No | Yes |
Usage
The ax_unreg() function unregisters an XA data source from the transaction in which it was previously registered. By default, all XA-compliant external data sources are unregistered at the end of a transaction. Use the ax_unreg() function to unregister the XA data source before the end of the transaction so the data source does not participate in the transaction.
Multiple registrations of the same XA data source in a transaction have the same effect as a single registration. Since HCL OneDB™ does not maintain a count of the number of times an application has registered, a single call to ax_unreg() unregisters the data source from the transaction.
CREATE XADATASOURCE datasourcename USING xadstype
An application can use the mi_xa_get_xadatasource_rmid() function to get the resource manager ID.
When the ax_unreg() function
is called, you must set flags to TMNOFLAGS
.
If
the function call is successful, the function returns TM_OK
.
If the function call is not successful, an error appears.
- Make sure the rmid value is correct.
- Make sure the flags passed as
TMNOFLAGS
. - Make sure that the ax_unreg() function is called from within the transaction.
- Make sure that the ax_unreg() function
is not called:
- From the subordinator of a distributed transaction.
- From within the resource manager global transaction.
- In a nonlogging database.
- From any of the XA purpose functions that are specified in a CREATE XADATASOURCE TYPE statement, which creates a type of XA-compliant external data source.
- Make sure you are not unregistering an XA data source that is not registered.
The mi_xa_unregister_xadatasource() function also allows DataBlade modules to unregister previously registered XA-compliant, external data sources from transactions. However, the ax_unreg() function and the mi_xa_unregister_xadatasource() function use different parameters and have different return values.
For more information about working with XA data sources, see the HCL OneDB DataBlade API Programmer's Guide. Also refer to the "Distributed Transaction Processing: The XA Specification." This is the X/OPEN standard specification that is available on the Internet.
Return values
- TM_OK
- The value The data sources are unregistered.
- TMER_TMERR
- The value indicates that an error occurred and the function was not successful.
- TMER_INVAL
- The value indicates that invalid arguments were specified.
- TMER_PROTO
- The value The routine was invoked in an improper context.