Oracle8i Application Developer's Guide - Large Objects (LOBs) Release 2 (8.1.6) Part Number A76940-01 |
|
Temporary LOBs, 19 of 29
See:
"Use Case Model: Internal Temporary LOBs", for all basic operations of Internal Temporary LOBs. |
This procedure describes how to see if a LOB locator for a temporary LOB is initialized.
Not applicable.
See Chapter 3, "LOB Programmatic Environments" for a list of available functions in each programmatic environment. Use the following syntax references for each programmatic environment:
This generic function takes a LOB
locator and checks if it is initialized. If it is initialized, then it prints out a message saying "LOB
is initialized". Otherwise, it reports "LOB
is not initialized".
Examples are provided in the following programmatic environments:
/* This function takes a LOB locator and checks if it is initialized. If it is
initialized, then it prints out a message saying "LOB is initialized". Otherwise, it says "LOB is not initialized". This function returns 0 if it completes successfully, and -1 if it doesn't. */ sb4 ck_isinit (OCILobLocator *lob_loc, OCIError *errhp, OCISvcCtx *svchp, OCIStmt *stmthp, OCIEnv *envhp) { boolean is_init; is_init= FALSE; if (OCILobLocatorIsInit(envhp,errhp, lob_loc, &is_init)) { printf ("FAILED: OCILobLocatorIsInit call\n"); return -1; } if(is_init) { printf ("LOB is initialized\n"); }else { printf("LOB is not initialized\n"); } return 0; }
#include <sql2oci.h> #include <stdio.h> #include <sqlca.h> void Sample_Error() { EXEC SQL WHENEVER SQLERROR CONTINUE; printf("%.*s\n", sqlca.sqlerrm.sqlerrml, sqlca.sqlerrm.sqlerrmc); EXEC SQL ROLLBACK WORK RELEASE; exit(1); } void tempLobLocatorIsInit_proc() { OCIBlobLocator *Temp_loc; OCIEnv *oeh; OCIError *err; boolean isInitialized = 0; EXEC SQL WHENEVER SQLERROR DO Sample_Error(); EXEC SQL ALLOCATE :Temp_loc; EXEC SQL LOB CREATE TEMPORARY :Temp_loc; /* Get the OCI Environment Handle using a SQLLIB Routine: */ (void) SQLEnvGet(SQL_SINGLE_RCTX, &oeh); /* Allocate the OCI Error Handle: */ (void) OCIHandleAlloc((dvoid *)oeh, (dvoid **)&err, (ub4)OCI_HTYPE_ERROR, (ub4)0, (dvoid **)0); /* Use the OCI to determine if the locator is Initialized */ (void) OCILobLocatorIsInit(oeh, err, Temp_loc, &isInitialized); if (isInitialized) printf("Locator is initialized\n"); else printf("Locator is not initialized\n"); /* Note that in this example, the locator is initialized. */ /* Deallocate the OCI Error Handle: */ (void) OCIHandleFree(err, OCI_HTYPE_ERROR); /* Free the Temporary LOB */ EXEC SQL LOB FREE TEMPORARY :Temp_loc; /* Release resources held by the locator: */ EXEC SQL FREE :Temp_loc; } void main() { char *samp = "samp/samp"; EXEC SQL CONNECT :samp; tempLobLocatorIsInit_proc(); EXEC SQL ROLLBACK WORK RELEASE; }
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|