Re: [Orclib-users] [Bulk] Re: Problem with advancedQues
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
|
From: vincent r. <vin...@ya...> - 2011-02-13 12:42:58
|
use the right printf token for integers :
printf("FILL_VOL %d \n", OCI_ObjectGetUnsignedInt(MyObj, "FILL_VOL"));
Regards,
Vincent Rogier
2011/2/13 Hayyan Rafiq <hay...@ho...>
> Problem solved.... I managed to solve the problem and now its worrking
> great. However I have one last question
> when i use
> printf("SYMBOL %s \n", OCI_ObjectGetString(MyObj, "SYMBOL"));
> The output is correct as the above is a string
> however when i use
> printf("FILL_VOL %s \n", OCI_ObjectGetUnsignedInt(MyObj, "FILL_VOL"));
> I get an error as above is a number any idea what i should use???
>
> ------------------------------
> From: hay...@ho...
> To: orc...@li...
> Subject: Problem with advancedQues
> Date: Sun, 13 Feb 2011 08:32:42 +0000
>
>
> Hi I just started using OCILIB and so far I just got it to unblock whenever
> there is an object in my Queues.
> Here is what really happens when the queue is empty
> my_msg = OCI_DequeueGet(MyDeque);
> Blocks as it should however when I insert something into the Queue the
> above procedure unblocks however my_msg is still NULL. Any idea what i could
> be doing wrong
> here ?? The code which i wrote is given below::
>
> OCI_Connection *con;
> OCI_Agent *MyAgent;
> OCI_Agent *RetAgent;
> OCI_Dequeue *MyDeque;
> OCI_TypeInfo *Typeinf;
> boolean ConsRet;
> boolean AgentSet;
> OCI_Msg *my_msg;
> boolean BoolDequeueSetAgentList;
> boolean DeqMode;
> boolean set_msg;
> OCI_Object *MyObj;
>
>
> OCI_Initialize(NULL, NULL,OCI_ENV_DEFAULT); //OCI_ENV_CONTEXT
> OCI_ENV_DEFAULT
>
> con = OCI_ConnectionCreate(ConnString , username, pass,
> OCI_SESSION_DEFAULT);
>
> //Create Agent which holds the consumer Name
> MyAgent = OCI_AgentCreate(con,AgentName,AgentAddress); //Agent Name =
> ULTRADBA Address=ULTRADBA.ACT_Q //OK
>
> //Set The Agent Name
> AgentSet = OCI_AgentSetName(MyAgent,AgentName); //OKAY
> //AgentName
>
> //Create a Type Info Indicating Object Payload
> Typeinf =
> OCI_TypeInfoGet(con,"ULTRADBA.ACTIVITY_DET_QMSG",OCI_TIF_TYPE); //Okay
>
> //Use OCI_DequeueCreate To Initialize Dequeing
> MyDeque = OCI_DequeueCreate(Typeinf, QueueName); ///NOT SURE //QUEUE
> NAME
>
>
> //OCI_DequeueSetAgentList Attach agent with deque
> BoolDequeueSetAgentList = OCI_DequeueSetAgentList(MyDeque,&MyAgent,1);
> //OK
>
> //ConsRet Set Consumer
> ConsRet = OCI_DequeueSetConsumer(MyDeque,NULL); //OKAY
>
> printf("Starting Listening To Messages \n");
>
>
> //Listen For Messages Using OCI_DequeueListen
> RetAgent = OCI_DequeueListen(MyDeque,80); //Agent Address Returned
> //OCI_DequeueSetWaitTime(MyDeque,200); //OKAY
>
>
> //////////////////////////////////////////////////////////////////////////////////////////
> ///////////////////////////////////SETUP THE
> MESSAGE//////////////////////////////////////
> my_msg = OCI_MsgCreate(Typeinf);
> MyObj = OCI_ObjectCreate(con, Typeinf);
> set_msg = OCI_MsgSetObject(my_msg,MyObj);
> OCI_MsgFree(my_msg);
>
> //////////////////////////////////////////////////////////////////////////////////////////
>
> //DeqMode= OCI_DequeueSetMode(MyDeque,OCI_ADM_REMOVE );
> my_msg = OCI_DequeueGet(MyDeque); //Blocking Call
>
>
> MyObj = OCI_MsgGetObject(my_msg);
>
> //Get Consumer Name using OCI_DequeueGetConsumer
>
> // printf("Messages Received \n");
>
>
> ///================================================================================
>
> ////===============================================================================
>
> /////==============================================================================
>
> printf("Consumer Name %s",OCI_DequeueGetConsumer(MyDeque));
>
>
> Any help would be appreciated... Thanks
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Orclib-users mailing list
> Orc...@li...
> https://lists.sourceforge.net/lists/listinfo/orclib-users
>
>
--
Vincent Rogier
|