Page 1 of 1

BLOB in OCL external procedure

Posted: Fri 10 Mar 2006 12:25
by M Towler
Hi

I am looking to use OCL to make it easier for me to write external procedures for Oracle. I have looked at the extproc example and it uses simple types such as int and char*. I am wondering if I have a procedure taking BLOB types, if it is possible to convert the OCILOBLOCATOR* that Oracle will pass into my function, into CRLob objects?

e.g.

extern "C" int __declspec(dllexport)
externalProcedure(OCIExtProcContext* context, OCILOBLOCATOR* x, char* y)
{
CRLob x_lob( x ); // how to write this line?
}

Posted: Fri 10 Mar 2006 15:58
by Paul
OCL does not have exact constructor that you need.
Please use OCIExtProcGetEnv function for receiving OCISvcCtx from given OCIExtProcContext.

Code: Select all

sword OCIExtProcGetEnv ( OCIExtProcContext *with_context,
OCIEnv envh,
OCISvcCtx svch,
OCIError errh );
Then you have to pass OCILOBLOCATOR* and OCISvcCtx to hOCILobLocator and hOCISvcCtx fields of OraLob.

Code: Select all

class OraLob : public CRLob {
...
protected:
  OCILobLocator* hOCILobLocator;
  OCISvcCtx*     hOCISvcCtx;
...
}