| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/Oracle/OCI/include/ociextp.h
Go to the documentation of this file.

    00001 /*
    00002  * $Header$
    00003  */
    00004
    00005 /* Copyright (c) 1996, 2003, Oracle Corporation.  All rights reserved.  */
    00006
    00007 /*
    00008    NAME
    00009      ociextp.h - Interface Definitions for PL/SQL External Procedures
    00010
    00011    DESCRIPTION
    00012      This header file contains C language callable interface from
    00013      PL/SQL External Procedures.
    00014
    00015    PUBLIC FUNCTION(S)
    00016      OCIExtProcAllocCallMemory  - Allocate Call memory
    00017      OCIExtProcRaiseExcp        - Raise Exception
    00018      OCIExtProcRaiseExcpWithMsg - Raise Exception with message
    00019      OCIExtProcGetEnv           - Get OCI Environment
    00020
    00021    PRIVATE FUNCTION(S)
    00022      <list of static functions defined in .c file - with one-line descriptions>
    00023
    00024    EXAMPLES
    00025
    00026    NOTES
    00027      <other useful comments, qualifications, etc.>
    00028
    00029    MODIFIED   (MM/DD/YY)
    00030    srseshad    03/12/03 - convert oci public api to ansi
    00031    rdecker     01/10/02 - change 32k to MAX_OEN for error numbers
    00032    sagrawal    07/20/01 - Statement Handle to safe cal outs
    00033    abrumm      04/19/01 - move include of oci.h after defines/typedef
    00034    rdecker     02/22/01 - lint fix
    00035    bpalaval    02/08/01 - Change text to oratext.
    00036    sagrawal    06/16/00 - ref cursor in callouts
    00037    whe         09/01/99 - 976457:check __cplusplus for C++ code
    00038    asethi      04/15/99 - Created (by moving ociextp.h from /vobs/plsql/public)
    00039    rhari       03/25/97 - Use ifndef
    00040    rhari       12/18/96 - Include oratypes.h
    00041    rhari       12/11/96 - #416977, Flip values of return codes
    00042    rhari       12/02/96 - Define Return Code Macros
    00043    rhari       11/18/96 - Error number is int
    00044    rhari       10/30/96 - Fix OCIExtProcRaiseExcpWithMsg
    00045    rhari       10/30/96 - Get rid of warnings
    00046    rhari       10/04/96 - Fix OCIExtProcRaiseExcpWithMsg
    00047    rhari       09/23/96 - Creation
    00048
    00049 */
    00050
    00051
    00052 #ifndef OCIEXTP_ORACLE
    00053 # define OCIEXTP_ORACLE
    00054
    00055 # ifndef ORATYPES
    00056 #  include <oratypes.h>
    00057 # endif
    00058
    00059
    00060 /*---------------------------------------------------------------------------
    00061                      PUBLIC TYPES AND CONSTANTS
    00062   ---------------------------------------------------------------------------*/
    00063
    00064
    00065 /* ----------------------------- Return Codes ----------------------------- */
    00066 /* Success and Error return codes for certain external procedure interface
    00067  * functions. If a particular interface function returns OCIEXTPROC_SUCCESS
    00068  * or OCIEXTPROC_ERROR, then applications must use these macros to check
    00069  * for return values.
    00070  *
    00071  *     OCIEXTPROC_SUCCESS  -- External Procedure Success Return Code
    00072  *     OCIEXTPROC_ERROR    -- External Procedure Failure Return Code
    00073  */
    00074 #define OCIEXTPROC_SUCCESS 0
    00075 #define OCIEXTPROC_ERROR   1
    00076
    00077
    00078 /* --------------------------- With-Context Type --------------------------- */
    00079 /*
    00080  * The C callable interface to PL/SQL External Procedures require the
    00081  * With-Context parameter to be passed. The type of this structure is
    00082  * OCIExtProcContext is is opaque to the user.
    00083  *
    00084  * The user can declare the With-Context parameter in the application as
    00085  *
    00086  *    OCIExtProcContext *with_context;
    00087  */
    00088 typedef struct OCIExtProcContext OCIExtProcContext;
    00089
    00090 /* NOTE: OCIExtProcContext must be visible prior to including <oci.h> */
    00091
    00092 # ifndef OCI_ORACLE
    00093 #  include <oci.h>
    00094 # endif
    00095
    00096
    00097 /* ----------------------- OCIExtProcAllocCallMemory ----------------------- */
    00098 /* OCIExtProcAllocCallMemory
    00099  *    Allocate N bytes of memory for the duration of the External Procedure.
    00100  *
    00101  *    Memory thus allocated will be freed by PL/SQL upon return from the
    00102  *    External Procedure. You must not use any kind of 'free' function on
    00103  *    memory allocated by OCIExtProcAllocCallMemory.
    00104  *    Use this function to allocate memory for function returns.
    00105  *
    00106  * PARAMETERS
    00107  * Input :
    00108  *    with_context - The with_context pointer that is passed to the C
    00109  *                   External Procedure.
    00110  *                  Type of with_context : OCIExtProcContext *
    00111  *    amount       - The number of bytes to allocate.
    00112  *                   Type of amount : size_t
    00113  *
    00114  * Output :
    00115  *    Nothing
    00116  *
    00117  * Return :
    00118  *    An untyped (opaque) Pointer to the allocated memory.
    00119  *
    00120  * Errors :
    00121  *    A 0 return value should be treated as an error
    00122  *
    00123  * EXAMPLE
    00124  *  text *ptr = (text *)OCIExtProcAllocCallMemory(wctx, 1024)
    00125  *
    00126  */
    00127 #define OCIExtProcAllocCallMemory(with_context, amount) \
    00128 ociepacm(with_context, (size_t)amount)
    00129
    00130
    00131
    00132
    00133 /* -------------------------- OCIExtProcRaiseExcp -------------------------- */
    00134 /* OCIExtProcRaiseExcp
    00135  *    Raise an Exception to PL/SQL.
    00136  *
    00137  *  Calling this function signalls an exception back to PL/SQL. After a
    00138  *  successful return from this function, the External Procedure must start
    00139  *  its exit handling and return back to PL/SQL. Once an exception is
    00140  *  signalled to PL/SQL, INOUT and OUT arguments, if any, are not processed
    00141  *  at all.
    00142  *
    00143  * PARAMETERS
    00144  * Input :
    00145  *   with_context - The with_context pointer that is passed to the C
    00146  *                  External Procedure.
    00147  *                  Type of with_context : OCIExtProcContext *
    00148  *   errnum       - Oracle Error number to signal to PL/SQL. errnum
    00149  *                  must be a positive number and in the range 1 to MAX_OEN
    00150  *                  Type of errnum : int
    00151  * Output :
    00152  *   Nothing
    00153  *
    00154  * Return :
    00155  *   OCIEXTPROC_SUCCESS - If the call was successful.
    00156  *   OCIEXTPROC_ERROR   - If the call failed.
    00157  *
    00158  */
    00159 #define OCIExtProcRaiseExcp(with_context, errnum) \
    00160 ocieperr(with_context, (int)errnum)
    00161
    00162
    00163
    00164
    00165
    00166 /* ---------------------- OCIExtProcRaiseExcpWithMsg ---------------------- */
    00167 /* OCIExtProcRaiseExcpWithMsg
    00168  *    Raise an exception to PL/SQL. In addition, substitute the
    00169  *    following error message string within the standard Oracle error
    00170  *    message string. See note for OCIExtProcRaiseExcp
    00171  *
    00172  * PARAMETERS
    00173  * Input :
    00174  *   with_context  - The with_context pointer that is passed to the C
    00175  *                   External Procedure.
    00176  *                   Type of with_context : OCIExtProcContext *
    00177  *   errnum        - Oracle Error number to signal to PL/SQL. errnum
    00178  *                   must be a positive number and in the range 1 to MAX_OEN
    00179  *                   Type of errnum : int
    00180  *   errmsg        - The error message associated with the errnum.
    00181  *                   Type of errmsg : char *
    00182  *   len           - The length of the error message. 0 if errmsg is
    00183  *                   null terminated string.
    00184  *                   Type of len : size_t
    00185  * Output :
    00186  *   Nothing
    00187  *
    00188  * Return :
    00189  *  OCIEXTPROC_SUCCESS - If the call was successful.
    00190  *  OCIEXTPROC_ERROR   - If the call failed.
    00191  *
    00192  */
    00193 #define OCIExtProcRaiseExcpWithMsg(with_context, errnum, errmsg, msglen) \
    00194 ociepmsg(with_context, (int)errnum, errmsg, (size_t)msglen)
    00195
    00196
    00197
    00198 /* --------------------------- OCIExtProcGetEnv --------------------------- */
    00199 /* OCIExtProcGetEnv
    00200  *    Get OCI Environment
    00201  *
    00202  * PARAMETERS
    00203  * Input :
    00204  *    with_context - The with_context pointer that is passed to the C
    00205  *                   External Procedure.
    00206  *
    00207  * Output :
    00208  *    envh - The OCI Environment handle.
    00209  *    svch - The OCI Service handle.
    00210  *    errh - The OCI Error handle.
    00211  *
    00212  * Return :
    00213  *  OCI_SUCCESS - Successful completion of the function.
    00214  *  OCI_ERROR   - Error.
    00215  *
    00216  */
    00217 #define OCIExtProcGetEnv(with_context, envh, svch, errh) \
    00218 ociepgoe(with_context, envh, svch, errh)
    00219
    00220
    00221
    00222 /* ------------------------ OCIInitializeStatementHandle ------------------- */
    00223 /* OCIreateStatementHandle
    00224  *    Initialize Statement Handle
    00225  *
    00226  * PARAMETERS
    00227  * Input :
    00228  *    wctx     - The
    00229  *    cursorno - The cursor number for which we need to initialize
    00230  *               the statement handle
    00231  *    svch     - The OCI Service handle.
    00232  *
    00233  * Output :
    00234  *    stmthp - The OCI Statement handle.
    00235  *    errh   - The OCI Error handle.
    00236  *
    00237  * Return :
    00238  *  OCI_SUCCESS - Successful completion of the function.
    00239  *  OCI_ERROR   - Error.
    00240  *
    00241  */
    00242 #define OCIInitializeStatementHandle(wctx, cursorno,  svch, stmthp, errh) \
    00243 ociepish(wctx, cursor, svch, stmthp, errh)
    00244
    00245
    00246
    00247
    00248 /*---------------------------------------------------------------------------
    00249                      PRIVATE TYPES AND CONSTANTS
    00250   ---------------------------------------------------------------------------*/
    00251
    00252
    00253 /*---------------------------------------------------------------------------
    00254                            PUBLIC FUNCTIONS
    00255   ---------------------------------------------------------------------------*/
    00256
    00257
    00258 /*---------------------------------------------------------------------------
    00259                           PRIVATE FUNCTIONS
    00260   ---------------------------------------------------------------------------*/
    00261
    00262
    00263
    00264 dvoid *ociepacm(OCIExtProcContext *with_context, size_t amount);
    00265
    00266
    00267
    00268 size_t ocieperr(OCIExtProcContext *with_context, int error_number);
    00269
    00270
    00271
    00272 size_t ociepmsg(OCIExtProcContext *with_context, int error_number,
    00273                 oratext *error_message, size_t len );
    00274
    00275
    00276
    00277 sword ociepgoe(OCIExtProcContext *with_context, OCIEnv **envh,
    00278                OCISvcCtx **svch, OCIError **errh);
    00279
    00280
    00281 #endif                                                     /* OCIEXTP_ORACLE */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines