BLOB in OCL external procedure

BLOB in OCL external procedure

Postby M Towler » Fri 10 Mar 2006 12:25

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?
}
M Towler
 
Posts: 1
Joined: Fri 10 Mar 2006 12:19

Postby Paul » Fri 10 Mar 2006 15:58

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;
...
}
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06


Return to dbForge for Oracle