Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: CLOB -> DLL
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);
if (OCIEnvCreate((OCIEnv **) &envhp, (ub4) OCI_THREADED, (dvoid *)0, (dvoid * (*)()) 0, (dvoid * (*)())0, (void (*)()) 0, (size_t) 0, (dvoid **) 0) != OCI_SUCCESS){
if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp,
(ub4) OCI_HTYPE_ERROR, (size_t) 0, (dvoid **) 0) != OCI_SUCCESS){
if (OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp,
(ub4) OCI_HTYPE_SVCCTX, (size_t) 0, (dvoid **) 0) != OCI_SUCCESS ){
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/engReceived on Wed May 22 2002 - 02:19:52 CDT
![]() |
![]() |