09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Enqueuing and Dequeuing Of Messages<br />

Enqueuing and Dequeuing of Object Type Messages Using Pro*C/C++<br />

Note: You may need to set up data structures similar to the<br />

following for certain examples to work:<br />

$ cat >> message.typ<br />

case=lower<br />

type aq.message_typ<br />

$<br />

$ ott userid=aq/aq intyp=message.typ outtyp=message_o.typ \<br />

code=c hfile=demo.h<br />

$<br />

$ proc intyp=message_o.typ iname= \<br />

config= SQLCHECK=SEMANTICS userid=aq/aq<br />

#include <br />

#include <br />

#include <br />

#include <br />

/* The header file generated by processing<br />

object type ’aq.Message_typ’: */<br />

#include "pceg.h"<br />

void sql_error(msg)<br />

char *msg;<br />

{<br />

EXEC SQL WHENEVER SQLERROR CONTINUE;<br />

printf("%s\n", msg);<br />

printf("\n% .800s \n", sqlca.sqlerrm.sqlerrmc);<br />

EXEC SQL ROLLBACK WORK RELEASE;<br />

exit(1);<br />

}<br />

main()<br />

{<br />

Message_typ *message = (Message_typ*)0; /* payload */<br />

message_type_ind *imsg; /*payload indicator*/<br />

char user[60]="aq/AQ"; /* user logon password */<br />

char subject[30]; /* components of the */<br />

char txt[80]; /* payload type */<br />

/* ENQUEUE and DEQUEUE to an OBJECT QUEUE */<br />

/* Connect to database: */<br />

A-12 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

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

Saved successfully!

Ooh no, something went wrong!