Oracle 8i Data Cartridge Developer's Guide Release 2 (8.1.6) Part Number A76937-01 |
|
Methods: Using C/C++ and Java , 8 of 13
An external procedure executing on the Oracle8i server can call the access function OCIExtProcGetEnv
to obtain OCI environment and service handles. With the OCI, you can use callbacks to execute SQL statements and PL/SQL subprograms, fetch data, and manipulate LOBs. Moreover, callbacks and external procedures operate in the same user session and transaction context, so they have the same user privileges.
The following example is a version of c_findmin
that is simplified to illustrate callbacks. The complete listing is available on the disk that is included with this kit.
Static OCIEnv *envhp; Static OCISvcCtx *svchp; Static OCIError *errhp; Int c_findmin (OCIExtProcContext *ctx, OCILobLocator *lobl) { sword retval; retval = OCIExtProcGetEnv (ctx, &envhp, &svchp, &errhp); if ((retval != OCI_SUCCESS) && (retval != OCI_SUCCESS_WITH_INFO)) exit(-1); /* Use lobl to read the CLOB, compute the minimum, and store the value in retval. */ return retval; }
With callbacks, the following SQL statements and OCI routines are not supported:
COMMIT
CREATE
OCIRefClear
OCIGetPieceInfo
OCIEnvInit
OCIInitialize
OCIPasswordChange
OCIServerAttach
OCIServerDetach
OCISessionBegin
OCISessionEnd
OCISvcCtxToLda
OCITransCommit
OCITransDetach
OCITransRollback
OCITransStart
OCIHandleAlloc
, the following handle types are not supported:
OCI_HTYPE_SERVER
OCI_HTYPE_SESSION
OCI_HTYPE_SVCCTX
OCI_HTYPE_TRANS
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|