Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: CLOB -> DLL

Re: CLOB -> DLL

From: Andrew Kompaneev <akomp_at_redler.zzn.com>
Date: Wed, 22 May 2002 11:19:52 +0400
Message-ID: <acfgi8$13p0$1@bull.east.ru>


Hi

"Ken Wallis" <kenws_at_empower.aust.com> wrote in message news:3ceaef3f_at_news.comindico.com.au...
> > Who knows about inherit of typedef struct OCILobLocator?
> > Or I need pass PL/SQL CLOB to external function as (void *buf) and CLOB
> can
> > be more then 32K.
> > Or I need pass PL/SQL CLOB to IBM MQSeries function MQPUT and get CLOB
> from
> > MQGET.
> > Who knows it and can help me?
>
> Once you have an OCILobLocator for your CLOB, your OCI code needs to use
> OCIRead() to get the data associated with the LOB. You can then pass the
> data as a void * to MQ Series.

I just tried it but I have error -2 (OCI_INVALID_HANDLE). I use stored procedure with IBM Support Pack MA0I and own dll:

void MQPUTCLOB (

   MQHCONN Hconn, /* Connection handle */    MQHOBJ Hobj, /* Object handle */    PMQVOID pMsgDesc, /* Message descriptor */    PMQVOID pPutMsgOpts, /* Options that control the action of MQPUT */    MQLONG BufferLength, /* Length of the message in Buffer */    OCIClobLocator *pBuffer, /* Message data */    PMQLONG pCompCode, /* Completion code */    PMQLONG pReason) /* Reason code qualifying CompCode */ {
 void *ptmp;
 OCIEnv *envhp;
 OCISvcCtx *svchp;
 OCIError *errhp;
 OCIServer *srvhp;
 ub4 amt = BufferLength;
 ub4 offset = 1;
 sb4 err;

 OCIEnvCreate((OCIEnv **) &envhp, (ub4) OCI_THREADED, (dvoid *)0, (dvoid *
(*)()) 0, (dvoid * (*)())0, (void (*)()) 0, (size_t) 0, (dvoid **) 0);
 OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp, (ub4) OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
 OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &srvhp, (ub4) OCI_HTYPE_SERVER, 0, (dvoid **) 0);
 OCIServerAttach( srvhp, errhp, (text *) 0, (sb4) 0, (ub4) OCI_DEFAULT);  OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp, (ub4) OCI_HTYPE_SVCCTX, 0, (dvoid **) 0);
 OCIAttrSet( (dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX, (dvoid *) srvhp, (ub4) 0, (ub4) OCI_ATTR_SERVER, (OCIError *) errhp); /*
//I have the same error too with commented code
 if (OCIEnvCreate((OCIEnv **) &envhp, (ub4) OCI_THREADED, (dvoid *)0,
      (dvoid * (*)()) 0, (dvoid * (*)())0, (void (*)()) 0,
      (size_t) 0, (dvoid **) 0) != OCI_SUCCESS)
 {
  exit(-1);
 }

 if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp,

      (ub4) OCI_HTYPE_ERROR,
      (size_t) 0, (dvoid **) 0) != OCI_SUCCESS)
 {
  exit(-1);
 }

 if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp,

      (ub4) OCI_HTYPE_SVCCTX,
      (size_t) 0, (dvoid **) 0) != OCI_SUCCESS )
 {
  exit(-1);
 }
*/
 ptmp = calloc(1, BufferLength);

 err=OCILobRead(svchp, errhp, pBuffer, &amt, offset, ptmp,

       (ub4) BufferLength, (dvoid *)0,
       (sb4 (*) (dvoid *, CONST dvoid *, ub4, ub1)) 0,
       (ub2) 0, (ub1) SQLCS_IMPLICIT);

 if (err == OCI_SUCCESS)
 {
  MQPUT(Hconn, Hobj, pMsgDesc, pPutMsgOpts, BufferLength, ptmp, pCompCode, pReason);
 }
 else
 {
  *pCompCode=err;
  *pReason=amt;
 }

 free(ptmp);

 OCIServerDetach(srvhp, errhp, OCI_DEFAULT);

 if (srvhp) (void) OCIHandleFree((dvoid *) srvhp, (ub4) OCI_HTYPE_SERVER);
 if (svchp) (void) OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX);
 if (errhp) (void) OCIHandleFree((dvoid *) errhp, (ub4) OCI_HTYPE_ERROR);
 if (envhp) (void) OCIHandleFree((dvoid *) envhp, (ub4) OCI_HTYPE_ENV);
}
--
Best regards,
Andrew Kompaneev, Expert.
AlconsSoft InformSystems Ltd.,
http://www.alconssoft.ru/eng
Received on Wed May 22 2002 - 02:19:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US