09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

#include <br />

#endif<br />

#include <br />

static void checkerr(OCIError *errhp, sword status);<br />

static void deqmesg(text *buf, ub4 *buflen);<br />

LNOCIEnv *envhp;<br />

LNOCIError *errhp;<br />

LNOCISvcCtx *svchp;<br />

struct message<br />

{<br />

OCINumber id;<br />

OCIString *data;<br />

};<br />

typedef struct message message;<br />

struct null_message<br />

{<br />

OCIInd null_adt;<br />

OCIInd null_id;<br />

OCIInd null_data;<br />

};<br />

typedef struct null_message null_message;<br />

AQ and Memory Usage<br />

static void deqmesg(buf, buflen)<br />

text *buf;<br />

ub4 *buflen;<br />

{<br />

OCIType *mesgtdo = (OCIType *)0; /* type descr of SCOTT.MESSAGE */<br />

message *mesg = (dvoid *)0; /* instance of SCOTT.MESSAGE */<br />

null_message *mesgind = (dvoid *)0; /* null indicator */<br />

OCIAQDeqOptions *deqopt = (OCIAQDeqOptions *)0;<br />

ub4 wait = 60; /* timeout after 60 seconds */<br />

ub4 navigation = OCI_DEQ_FIRST_MSG;/* always get head of q */<br />

/* Get the type descriptor object for the type SCOTT.MESSAGE: */<br />

checkerr(errhp, OCITypeByName(envhp, errhp, svchp,<br />

(CONST text *)"SCOTT", strlen("SCOTT"),<br />

(CONST text *)"MESSAGE", strlen("MESSAGE"),<br />

(text *)0, 0, OCI_DURATION_SESSION,<br />

OCI_TYPEGET_ALL, &mesgtdo));<br />

<strong>Oracle</strong> <strong>Advanced</strong> <strong>Queuing</strong> by Example A-73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!