Author |
Message
|
wmb_wps_soa |
Posted: Mon Feb 07, 2011 1:31 pm Post subject: Can Environment tree be used inside the FUNCTION/PROC? |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
Hi Guys,
Can Environment. tree be used inside the FUNCTION or PROCEDURE and send out to the calling main message flow?
In this case, i just want to construct an Environment tree with list of parameters in the esql PROCEDURE, and I need to send the Environment back to the main flow.
But, I am getting error, could not use SET or CREATE FIELD inside the esql procedure. Could anybody help?
In the main flow:
--------------------------
DECLARE ListRef REFERENCE TO InputRoot.MRM;
CALL store_EnvironmentLList(ListRef);
In the ESQL procedure:
-------------------------------------
CREATE PROCEDURE store_EnvironmentLList(IN handlerListRef REFERENCE,OUT environmentRef REFERENCE)
BEGIN
CREATE FIELD Environment.HandlerList;
SET Environment.HandlerList.SQLList[1].Name = 'Test';
CREATE FIELD Environment.HandlerList.SQLList[1].Name VALUE 'Test';
END
SET and CREATE, both did not worked. Can anybody help?
Thanks,
Jeba |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 07, 2011 1:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Firstly, why are you doing this?
Secondly, why does your procedure definition have 2 parameters but the call only one? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wmb_wps_soa |
Posted: Mon Feb 07, 2011 1:43 pm Post subject: |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
The requirement is to Build an Environment Tree with the database details that can be used to consturct a dynamic delete when an exception occurs.
I am passing only one parameter as INPUT reference to the parameter. And the procedure should return the Environment.Tree as OUTPUT.
Can you help how can I build the Environment.Tree inside the Procedure/Function?
Thanks
Jeba |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 07, 2011 1:52 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wmb_wps_soa wrote: |
I am passing only one parameter as INPUT reference to the parameter. And the procedure should return the Environment.Tree as OUTPUT. |
My question stands - why does the call have a different number of parameters to the definition? Given what you're attempting? Which can be achieved if coded differently.
wmb_wps_soa wrote: |
Can you help how can I build the Environment.Tree inside the Procedure/Function? |
No. I don't understand why the code you've posted doesn't throw a syntax error.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wmb_wps_soa |
Posted: Mon Feb 07, 2011 2:02 pm Post subject: |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
Yes, I was wrong. It was like this:
In the main flow:
--------------------------
DECLARE ListRef REFERENCE TO InputRoot.MRM;
DECLARE environmentRef REFERENCE TO Environment.DbHandler;
CALL store_EnvironmentLList(ListRef,environmentRef);
In the ESQL procedure:
-------------------------------------
CREATE PROCEDURE store_EnvironmentLList(IN handlerListRef REFERENCE,INOUT environmentRef REFERENCE)
BEGIN
SET Environment.HandlerList.SQLList[1].Name = 'Test';
SET Environment.HandlerList.SQLList[1].Value= 1111;
SET Environment.HandlerList.SQLList[2].Name = 'Test';
SET Environment.HandlerList.SQLList[2].Value= 2222;
END
It did not worked, it was throwing error. Is there any specific way we should use while building the Environment Tree inside the Procedure or Function?
Thanks
Jeba |
|
Back to top |
|
 |
wmb_wps_soa |
Posted: Mon Feb 07, 2011 2:12 pm Post subject: |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
Thank you Grand Poobah.
It worked Atlast.
In the main flow:
--------------------------
DECLARE ListRef REFERENCE TO InputRoot.MRM;
CREATE FIELD Environment.DbHandler;
DECLARE environmentRef REFERENCE TO Environment.DbHandler;
CALL store_EnvironmentLList(ListRef,environmentRef);
In the ESQL procedure:
-------------------------------------
CREATE PROCEDURE store_EnvironmentLList(IN handlerListRef REFERENCE,INOUT environmentRef REFERENCE)
BEGIN
SET environmentRef.SQLList[1].Name = 'Test';
SET environmentRef.SQLList[1].Value= 1111;
SET environmentRef.SQLList[2].Name = 'Test';
SET environmentRef.SQLList[2].Value= 2222;
END
It worked fine and returning the Environment Tree as expected.
Thank you
Jeba |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 07, 2011 3:50 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You haven't mentioned the most important point, which is the version of Broker that you're using.
You should only need to send in an Environment reference like this in version 6.0, not in 6.1 or 7.
And version 6.0 goes out of support in April, so it's not too clear why you're doing new development with it. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 07, 2011 6:20 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wmb_wps_soa wrote: |
It worked fine and returning the Environment Tree as expected. |
I still don't understand why you'd want to do this. Even if it does work now you've fixed the ludicrous error.
For the record, you could also have made it work with 1 parameter defined as INOUT.
This would not have made any more sense than your version IMHO. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wmb_wps_soa |
Posted: Tue Feb 08, 2011 10:42 am Post subject: |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
Thank you for the replies.
The message broker version I am using is 7.0.0.1.
Let me give the details:
I just wanted to build an environment tree dynamically in the esql procedure based on the input message.
This newly built environment tree will then be used across all the nodes in the message flow.
Thank you
Jeba |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 08, 2011 10:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wmb_wps_soa wrote: |
This newly built environment tree will then be used across all the nodes in the message flow. |
Used for what? What are you recording from the input message that needs to be preserved like this? And why hold it in the Environment? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wmb_wps_soa |
Posted: Tue Feb 08, 2011 11:10 am Post subject: |
|
|
Acolyte
Joined: 19 Feb 2010 Posts: 65 Location: Detroit,Michigan,USA.
|
Hi,
The input message will have the details abo |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 08, 2011 12:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wmb_wps_soa wrote: |
The input message will have the details abo |
Will it now? Well that clears everything up...  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|