📄 oramts.h
字号:
#ifndef ORACLE_ORAMTS
# define ORACLE_ORAMTS
#include <windows.h>
#include <oci.h>
#include <oratypes.h>
/*----------------------------------------------------------------------------*/
/* various error codes reoprted by the OraMTS<> functions */
/*----------------------------------------------------------------------------*/
/* All error codes here: */
/* 0 - - success */
/* 1 - 1000 - Public APIs (kpntsvcget(), kpntsvcrelease(), etc.) */
/* 1001 - 2000 - Dispenser component */
/* 2001 - 3000 - Database identifier object */
/* 3001 - 4000 - Server object */
/* 4001 - 5000 - Session object */
/* 5001 - 6000 - RPC-related */
/* 6001 - 7000 - Miscellaneous */
/*----------------------------------------------------------------------------*/
/* Error codes for the connection pool APIs. */
/*----------------------------------------------------------------------------*/
#define ORAMTSERR_NOERROR (0 ) /* success code */
/* ------------ dispenser object related errors ----------------------------- */
#define ORAMTSERR_NOMTXDISPEN (1001) /* no MTXDM.DLL available */
#define ORAMTSERR_DSPCREAFAIL (1002) /* failure to create dispen*/
#define ORAMTSERR_DSPMAXSESSN (1003) /* exceeded max sessions */
#define ORAMTSERR_DSPINVLSVCC (1004) /* invalid OCI Svc ctx */
#define ORAMTSERR_DSPNODBIDEN (1005) /* can't create new dbiden */
/*------------- database identifier related errors ---------------------------*/
#define ORAMTSERR_NOSERVEROBJ (2001) /* unable to alloc a server*/
/* ------------ server object related errors -------------------------------- */
#define ORAMTSERR_INVALIDSRVR (3001) /* invalid server object */
#define ORAMTSERR_FAILEDATTCH (3002) /* failed attach to Oracle */
#define ORAMTSERR_FAILEDDETCH (3003) /* failed detach from db */
#define ORAMTSERR_FAILEDTRANS (3004) /* failed to start trans. */
#define ORAMTSERR_SETATTRIBUT (3005) /* OCI set attrib failed */
#define ORAMTSERR_CONNXBROKEN (3006) /* conn to Oracle broken */
#define ORAMTSERR_NOTATTACHED (3007) /* not attached to Oracle */
#define ORAMTSERR_ALDYATTACHD (3008) /* alrdy attached to Oracle*/
/* ------------ session object related errors ------------------------------- */
#define ORAMTSERR_INVALIDSESS (4001) /* invalid session object */
#define ORAMTSERR_FAILEDLOGON (4002) /* failed logon to Oracle */
#define ORAMTSERR_FAILEDLOGOF (4003) /* failed logoff from db */
#define ORAMTSERR_TRANSEXISTS (4004) /* no transaction beneath */
#define ORAMTSERR_LOGONEXISTS (4005) /* already logged on to db */
#define ORAMTSERR_NOTLOGGEDON (4006) /* not logged on to Oracle */
/* ------------ RPC errors -------------------------------------------------- */
#define ORAMTSERR_RPCINVLCTXT (5001) /* RPC context is invalid */
#define ORAMTSERR_RPCCOMMUERR (5002) /* generic communic. error */
#define ORAMTSERR_RPCALRDYCON (5003) /* endpoint already connect*/
#define ORAMTSERR_RPCNOTCONNE (5004) /* endpoint not connected */
#define ORAMTSERR_RPCPROTVIOL (5005) /* protocol violation */
#define ORAMTSERR_RPCACCPTIMO (5006) /* timeout accepting conn. */
#define ORAMTSERR_RPCILLEGOPC (5007) /* invalid RPC opcode */
#define ORAMTSERR_RPCBADINCNO (5008) /* mismatched incarnation# */
#define ORAMTSERR_RPCCONNTIMO (5009) /* client connect timeout */
#define ORAMTSERR_RPCSENDTIMO (5010) /* synch. send timeout */
#define ORAMTSERR_RPCRECVTIMO (5011) /* synch. receive timedout */
#define ORAMTSERR_RPCCONRESET (5012) /* connection reset by peer*/
/* ------------ miscellaneous errors ---------------------------------------- */
#define ORAMTSERR_INVALIDARGU (6001) /* invalid args to function*/
#define ORAMTSERR_INVALIDOBJE (6002) /* an object was invalid */
#define ORAMTSERR_ILLEGALOPER (6003) /* illegal operation */
#define ORAMTSERR_ALLOCMEMORY (6004) /* memory allocation error */
#define ORAMTSERR_ERRORSYNCHR (6005) /* synchr. object error */
#define ORAMTSERR_NOORAPROXY (6006) /* no Oracle Proxy server */
#define ORAMTSERR_ALRDYENLIST (6007) /* session already enlisted*/
#define ORAMTSERR_NOTENLISTED (6008) /* session is not enlisted */
#define ORAMTSERR_TYPMANENLIS (6009) /* illeg on manuenlst sess */
#define ORAMTSERR_TYPAUTENLIS (6010) /* illeg on autoenlst sess */
#define ORAMTSERR_TRANSDETACH (6011) /* error detaching trans. */
#define ORAMTSERR_OCIHNDLALLC (6012) /* OCI handle alloc error */
#define ORAMTSERR_OCIHNDLRELS (6013) /* OCI handle dealloc error*/
#define ORAMTSERR_TRANSEXPORT (6014) /* error exporting trans. */
#define ORAMTSERR_OSCREDSFAIL (6105) /* error getting NT creds */
/*----------------------------------------------------------------------------*/
/* //////////// Connection flags on call OraMTSSvcGet() ///////////////////// */
/*----------------------------------------------------------------------------*/
#define ORAMTS_CFLG_ALLDEFAULT (0x00000000) /* default flags */
#define ORAMTS_CFLG_NOIMPLICIT (0x00000001) /* don't do implicit enlistment*/
#define ORAMTS_CFLG_UNIQUESRVR (0x00000002) /* need a separate Net8 connect*/
#define ORAMTS_CFLG_SYSDBALOGN (0x00000004) /* logon as a SYSDBA */
#define ORAMTS_CFLG_SYSOPRLOGN (0x00000010) /* logon as a SYSOPER */
#define ORAMTS_CFLG_PRELIMAUTH (0x00000020) /* preliminary internal login */
/*----------------------------------------------------------------------------*/
/* //////////// Enlistment flags on call kpntsvcenlist() //////////////////// */
/*----------------------------------------------------------------------------*/
#define ORAMTS_ENFLG_DEFAULT (0x00000000) /* default flags */
#define ORAMTS_ENFLG_RESUMTX (0x00000001) /* resume a detached transact. */
#define ORAMTS_ENFLG_DETCHTX (0x00000002) /* detached from the transact. */
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*----------------------------------------------------------------------------*/
/* /////////////////////// Public functions ///////////////////////////////// */
/*----------------------------------------------------------------------------*/
/* Name : OraMTSSvcGet() */
/* Purpose : Obtain a pooled connection from the OCI connection pool. */
/* Arguments : text *lpUname: (IN ) user name for session */
/* text *lpPsswd: (IN ) password for session */
/* text *lpDbnam: (IN ) database alias for connection */
/* OCISvcCtx **pOCISvc: (OUT) ptr to OCI svc context handle. */
/* OCIEnv **pOCIEnv: (OUT) ptr to OCI enironment handle. */
/* ub4 ConFlgs: (IN ) connection flags */
/* Returns : ORAMTSERR_NOERROR on success. */
/* Notes : This call returns a pooled OCI connection to the caller. If the*/
/* caller is a transactional MTS component, currently in a Dtc TM */
/* controlled transaction, we will attempt to enlist the session */
/* in the transaction unless the caller explicitly asks us not to */
/* to do so via the dwConnFlgs. In all other cases, we will not */
/* attempt to enlist. */
/*----------------------------------------------------------------------------*/
DWORD OraMTSSvcGet(
text *lpUname,
text *lpPsswd,
text *lpDbnam,
OCISvcCtx **pOCISvc,
OCIEnv **pOCIEnv,
ub4 ConFlg
);
/*----------------------------------------------------------------------------*/
/* Name : OraMTSSvcRel() */
/* Purpose : Release a pooled OCI connection back to the pool. */
/* Arguments : OCISvcCtx *OCISvc: (IN ) OCI service context for pooled conn. */
/* Returns : ORAMTSERR_NOERROR on success. */
/* Notes : An OCI service context obtained via a previous call to kpntsvc */
/* get() from the pool is released back to the pool. Once released*/
/* back to the pool, the OCI svc., its environment handle, and all*/
/* children handles are invalid. */
/*----------------------------------------------------------------------------*/
DWORD OraMTSSvcRel(OCISvcCtx *OCISvc);
/*----------------------------------------------------------------------------*/
/* Name : OraMTSSvcEnlist() */
/* Purpose : Enlist an OCI connection or service context in a DTC-trans. */
/* Arguments : OCISvcCtx *OCISvc : (IN ) OCI service context for pooled conn. */
/* OCIError *OCIErr : (IN/OUT) OCI error handle for errors. This */
/* is ignored if the service context represents a pooled conn. */
/* void *lpTrans: (IN ) ptr. to DTC-controlled transaction */
/* unsigned dwFlags: (IN ) enlistment flags */
/* Returns : ORAMTSERR_NOERROR on success. */
/* Notes : An OCI service context obtained via a previous call to kpntsvc */
/* get() or allocated otherwise, is enlisted via this call in a */
/* DTC-transaction. For pooled connections, the underlying session*/
/* object must be explicitly enlistable. A subsequent call to the */
/* same function with a NULL lpTrans will cause deenlistment from */
/* the transaction. Callers should allocate a connection, then */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -