/* * I am not sure here, OCILobAssign or just simple pointer assign? */ void ConvertorForRead::Fire(const BindParClob &BP, SqlClob &CL) { CL._ind = BP.indp[_row]; if(CL.is_not_null()) { if(BP.isTemporary(_row)) { sword res = OCICALL(OCILobLocatorAssign(BP._stmt._conn._svc_ctx, BP._env._errh, ((OCILobLocator**)BP.valuep)[_row], &CL._loc)); oci_check_error(__TROTL_HERE__, BP._env._errh, res); } else { sword res = OCICALL(OCILobAssign(BP._env, BP._env._errh, ((OCILobLocator**)BP.valuep)[_row], &CL._loc)); oci_check_error(__TROTL_HERE__, BP._env._errh, res); } //CL._loc = ((OCILobLocator**)BP.valuep)[_row]; //((OCILobLocator**)BP.valuep)[_row] = NULL; //CL._ind = BP.indp[_row]; //#if ORACLE_MAJOR_VERSION>=8 && ORACLE_MINOR_VERSION>=1 // res = OCICALL(OCILobLocatorAssign(_conn._svc_ctx, _conn._env._errh, other._loc, &_loc)); //#else // res = OCICALL(OCILobAssign(_conn._env, _conn._env._errh, other._loc, &_loc)); // no support for temporary LOBs //#endif } };
void locatorIsEqual_proc(OCILobLocator *Lob_loc1, OCILobLocator *Lob_loc2, OCIEnv *envhp, OCIError *errhp, OCISvcCtx *svchp, OCIStmt *stmthp) { boolean isEqual; OCILobLocator *Lob_loc3; printf ("----------- OCILobIsEqual Demo --------------\n"); /* Call OCI to see if the two locators are Equal: */ printf (" check if Lob1 and Lob2 are Equal.\n"); checkerr (errhp, OCILobIsEqual(envhp, Lob_loc1, Lob_loc2, &isEqual)); if (isEqual) { /* ... The LOB locators are Equal: */ printf(" Lob Locators are equal.\n"); } else { /* ... The LOB locators are not Equal: */ printf(" Lob Locators are NOT Equal.\n"); } (void)OCIDescriptorAlloc((void *) envhp, (void **) &Lob_loc3, (ub4)OCI_DTYPE_LOB, (size_t) 0, (void **) 0); /* Assign Lob_loc1 to Lob_loc2 thereby saving a copy of the value of the LOB at this point in time: */ printf(" assign the src locator to dest locator\n"); checkerr (errhp, OCILobLocatorAssign(svchp, errhp, Lob_loc1, &Lob_loc3)); /* When you write some data to the LOB through Lob_loc1, Lob_loc2 will not see the newly written data whereas Lob_loc1 will see the new data: */ /* Call OCI to see if the two locators are Equal: */ printf (" check if Lob1 and Lob3 are Equal.\n"); checkerr (errhp, OCILobIsEqual(envhp, Lob_loc1, Lob_loc3, &isEqual)); if (isEqual) { /* ... The LOB locators are Equal: */ printf(" Lob Locators are equal.\n"); } else { /* ... The LOB locators are not Equal: */ printf(" Lob Locators are NOT Equal.\n"); } OCIDescriptorFree((void *)Lob_loc3, (ub4)OCI_DTYPE_LOB); return; }