Annotation of win32/sql/oracle/include/oci/ociextp.h, revision 1.1
1.1 ! parser 1: /*
! 2: * $Header: /var/lib/cvsroot/parser3/parser3/src/sql/oracle/oracle32/include/oci/ociextp.h,v 1.1 2001/08/22 14:02:19 parser Exp $
! 3: */
! 4:
! 5: /* Copyright (c) Oracle Corporation 1996, 1997, 1999. All Rights Reserved. */
! 6:
! 7: /*
! 8: NAME
! 9: ociextp.h - Interface Definitions for PL/SQL External Procedures
! 10:
! 11: DESCRIPTION
! 12: This header file contains C language callable interface from
! 13: PL/SQL External Procedures.
! 14:
! 15: PUBLIC FUNCTION(S)
! 16: OCIExtProcAllocCallMemory - Allocate Call memory
! 17: OCIExtProcRaiseExcp - Raise Exception
! 18: OCIExtProcRaiseExcpWithMsg - Raise Exception with message
! 19: OCIExtProcGetEnv - Get OCI Environment
! 20:
! 21: PRIVATE FUNCTION(S)
! 22: <list of static functions defined in .c file - with one-line descriptions>
! 23:
! 24: EXAMPLES
! 25:
! 26: NOTES
! 27: <other useful comments, qualifications, etc.>
! 28:
! 29: MODIFIED (MM/DD/YY)
! 30: whe 09/01/99 - 976457:check __cplusplus for C++ code
! 31: asethi 04/15/99 - Created (by moving ociextp.h from /vobs/plsql/public)
! 32: rhari 03/25/97 - Use ifndef
! 33: rhari 12/18/96 - Include oratypes.h
! 34: rhari 12/11/96 - #416977, Flip values of return codes
! 35: rhari 12/02/96 - Define Return Code Macros
! 36: rhari 11/18/96 - Error number is int
! 37: rhari 10/30/96 - Fix OCIExtProcRaiseExcpWithMsg
! 38: rhari 10/30/96 - Get rid of warnings
! 39: rhari 10/04/96 - Fix OCIExtProcRaiseExcpWithMsg
! 40: rhari 09/23/96 - Creation
! 41:
! 42: */
! 43:
! 44:
! 45: #ifndef OCIEXTP_ORACLE
! 46: # define OCIEXTP_ORACLE
! 47:
! 48: # ifndef ORATYPES
! 49: # include <oratypes.h>
! 50: # endif
! 51:
! 52: # ifndef OCI_ORACLE
! 53: # include <oci.h>
! 54: # endif
! 55:
! 56: /*---------------------------------------------------------------------------
! 57: PUBLIC TYPES AND CONSTANTS
! 58: ---------------------------------------------------------------------------*/
! 59:
! 60:
! 61: /* ----------------------------- Return Codes ----------------------------- */
! 62: /* Success and Error return codes for certain external procedure interface
! 63: * functions. If a particular interface function returns OCIEXTPROC_SUCCESS
! 64: * or OCIEXTPROC_ERROR, then applications must use these macros to check
! 65: * for return values.
! 66: *
! 67: * OCIEXTPROC_SUCCESS -- External Procedure Success Return Code
! 68: * OCIEXTPROC_ERROR -- External Procedure Failure Return Code
! 69: */
! 70: #define OCIEXTPROC_SUCCESS 0
! 71: #define OCIEXTPROC_ERROR 1
! 72:
! 73:
! 74: /* --------------------------- With-Context Type --------------------------- */
! 75: /*
! 76: * The C callable interface to PL/SQL External Procedures require the
! 77: * With-Context parameter to be passed. The type of this structure is
! 78: * OCIExtProcContext is is opaque to the user.
! 79: *
! 80: * The user can declare the With-Context parameter in the application as
! 81: *
! 82: * OCIExtProcContext *with_context;
! 83: */
! 84: typedef struct OCIExtProcContext OCIExtProcContext;
! 85:
! 86:
! 87:
! 88: /* ----------------------- OCIExtProcAllocCallMemory ----------------------- */
! 89: /* OCIExtProcAllocCallMemory
! 90: * Allocate N bytes of memory for the duration of the External Procedure.
! 91: *
! 92: * Memory thus allocated will be freed by PL/SQL upon return from the
! 93: * External Procedure. You must not use any kind of 'free' function on
! 94: * memory allocated by OCIExtProcAllocCallMemory.
! 95: * Use this function to allocate memory for function returns.
! 96: *
! 97: * PARAMETERS
! 98: * Input :
! 99: * with_context - The with_context pointer that is passed to the C
! 100: * External Procedure.
! 101: * Type of with_context : OCIExtProcContext *
! 102: * amount - The number of bytes to allocate.
! 103: * Type of amount : size_t
! 104: *
! 105: * Output :
! 106: * Nothing
! 107: *
! 108: * Return :
! 109: * An untyped (opaque) Pointer to the allocated memory.
! 110: *
! 111: * Errors :
! 112: * A 0 return value should be treated as an error
! 113: *
! 114: * EXAMPLE
! 115: * text *ptr = (text *)OCIExtProcAllocCallMemory(wctx, 1024)
! 116: *
! 117: */
! 118: #define OCIExtProcAllocCallMemory(with_context, amount) \
! 119: ociepacm(with_context, (size_t)amount)
! 120:
! 121:
! 122:
! 123:
! 124: /* -------------------------- OCIExtProcRaiseExcp -------------------------- */
! 125: /* OCIExtProcRaiseExcp
! 126: * Raise an Exception to PL/SQL.
! 127: *
! 128: * Calling this function signalls an exception back to PL/SQL. After a
! 129: * successful return from this function, the External Procedure must start
! 130: * its exit handling and return back to PL/SQL. Once an exception is
! 131: * signalled to PL/SQL, INOUT and OUT arguments, if any, are not processed
! 132: * at all.
! 133: *
! 134: * PARAMETERS
! 135: * Input :
! 136: * with_context - The with_context pointer that is passed to the C
! 137: * External Procedure.
! 138: * Type of with_context : OCIExtProcContext *
! 139: * errnum - Oracle Error number to signal to PL/SQL. errnum
! 140: * must be a positive number and in the range 1 to 32767
! 141: * Type of errnum : int
! 142: * Output :
! 143: * Nothing
! 144: *
! 145: * Return :
! 146: * OCIEXTPROC_SUCCESS - If the call was successful.
! 147: * OCIEXTPROC_ERROR - If the call failed.
! 148: *
! 149: */
! 150: #define OCIExtProcRaiseExcp(with_context, errnum) \
! 151: ocieperr(with_context, (int)errnum)
! 152:
! 153:
! 154:
! 155:
! 156:
! 157: /* ---------------------- OCIExtProcRaiseExcpWithMsg ---------------------- */
! 158: /* OCIExtProcRaiseExcpWithMsg
! 159: * Raise an exception to PL/SQL. In addition, substitute the
! 160: * following error message string within the standard Oracle error
! 161: * message string. See note for OCIExtProcRaiseExcp
! 162: *
! 163: * PARAMETERS
! 164: * Input :
! 165: * with_context - The with_context pointer that is passed to the C
! 166: * External Procedure.
! 167: * Type of with_context : OCIExtProcContext *
! 168: * errnum - Oracle Error number to signal to PL/SQL. errnum
! 169: * must be a positive number and in the range 1 to 32767
! 170: * Type of errnum : int
! 171: * errmsg - The error message associated with the errnum.
! 172: * Type of errmsg : char *
! 173: * len - The length of the error message. 0 if errmsg is
! 174: * null terminated string.
! 175: * Type of len : size_t
! 176: * Output :
! 177: * Nothing
! 178: *
! 179: * Return :
! 180: * OCIEXTPROC_SUCCESS - If the call was successful.
! 181: * OCIEXTPROC_ERROR - If the call failed.
! 182: *
! 183: */
! 184: #define OCIExtProcRaiseExcpWithMsg(with_context, errnum, errmsg, msglen) \
! 185: ociepmsg(with_context, (int)errnum, errmsg, (size_t)msglen)
! 186:
! 187:
! 188:
! 189: /* --------------------------- OCIExtProcGetEnv --------------------------- */
! 190: /* OCIExtProcGetEnv
! 191: * Get OCI Environment
! 192: *
! 193: * PARAMETERS
! 194: * Input :
! 195: * with_context - The with_context pointer that is passed to the C
! 196: * External Procedure.
! 197: *
! 198: * Output :
! 199: * envh - The OCI Environment handle.
! 200: * svch - The OCI Service handle.
! 201: * errh - The OCI Error handle.
! 202: *
! 203: * Return :
! 204: * OCI_SUCCESS - Successful completion of the function.
! 205: * OCI_ERROR - Error.
! 206: *
! 207: */
! 208: #define OCIExtProcGetEnv(with_context, envh, svch, errh) \
! 209: ociepgoe(with_context, envh, svch, errh)
! 210:
! 211:
! 212:
! 213:
! 214: /*---------------------------------------------------------------------------
! 215: PRIVATE TYPES AND CONSTANTS
! 216: ---------------------------------------------------------------------------*/
! 217:
! 218:
! 219: /*---------------------------------------------------------------------------
! 220: PUBLIC FUNCTIONS
! 221: ---------------------------------------------------------------------------*/
! 222:
! 223:
! 224: /*---------------------------------------------------------------------------
! 225: PRIVATE FUNCTIONS
! 226: ---------------------------------------------------------------------------*/
! 227:
! 228:
! 229:
! 230: #if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
! 231: dvoid *ociepacm(/*_ OCIExtProcContext *with_context, size_t amount _*/);
! 232: #else /* ANSI C */
! 233: dvoid *ociepacm(OCIExtProcContext *with_context, size_t amount);
! 234: #endif
! 235:
! 236:
! 237:
! 238: #if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
! 239: size_t ocieperr(/*_ OCIExtProcContext *with_context, int error_number _*/);
! 240: #else /* ANSI C */
! 241: size_t ocieperr(OCIExtProcContext *with_context, int error_number);
! 242: #endif
! 243:
! 244:
! 245:
! 246: #if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
! 247: size_t ociepmsg(/*_ OCIExtProcContext *with_context, int error_number,
! 248: text *error_message, size_t len _*/);
! 249: #else /* ANSI C */
! 250: size_t ociepmsg(OCIExtProcContext *with_context, int error_number,
! 251: text *error_message, size_t len );
! 252: #endif
! 253:
! 254:
! 255:
! 256: #if !defined(__STDC__) && !defined(__cplusplus) /* K&R C - not ANSI C */
! 257: sword ociepgoe(/*_ OCIExtProcContext *with_context, OCIEnv **envh,
! 258: OCISvcCtx **svch, OCIError **errh _*/);
! 259: #else /* ANSI C */
! 260: sword ociepgoe(OCIExtProcContext *with_context, OCIEnv **envh,
! 261: OCISvcCtx **svch, OCIError **errh);
! 262: #endif
! 263:
! 264:
! 265: #endif /* OCIEXTP_ORACLE */
E-mail: