Author |
Message
|
timjohnarm |
Posted: Sat Aug 27, 2016 5:58 pm Post subject: Accessing a SHARED variable from with a different Schema |
|
|
Apprentice
Joined: 28 Sep 2004 Posts: 40 Location: Melbourne Australia
|
I want to declare a SHARED variable either inside a SCHEMA or even in the Default, i.e., No Schema domain.
So in SharedRowDeclaration.esql I have
DECLARE SharedRow SHARED ROW;
My problem is I can't then access it from within CommonCode.esql where I have
BROKER SCHEMA com.nsd.commoncode
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE SharedRef REFERENCE TO SharedRow;
END;
I get a warning about "Identifier SharedRow cannot be resolved".
Has anyone had any luck with this? |
|
Back to top |
|
 |
adubya |
Posted: Sat Aug 27, 2016 11:41 pm Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
When you declare the variable within a named SCHEMA then have you tried adding the PATH clause to the esql file of the code looking to use the variable ? _________________ Independent Middleware Consultant
andy@knownentity.com |
|
Back to top |
|
 |
timjohnarm |
Posted: Fri Sep 02, 2016 7:19 pm Post subject: |
|
|
Apprentice
Joined: 28 Sep 2004 Posts: 40 Location: Melbourne Australia
|
I can't work out how to apply the schema name to a Global variable. I know how to do it for functions and procedures, but not for my Global variable. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Sep 02, 2016 8:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
adubya wrote: |
When you declare the variable within a named SCHEMA then have you tried adding the PATH clause to the esql file of the code looking to use the variable ? |
And what happened when you tried this?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
timber |
Posted: Sat Sep 03, 2016 2:57 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
or even in the Default, i.e., No Schema domain |
Not recommended. I know you are experimenting, but best practice is to put all of your own ESQL into a broker schema. You wouldn't write a Java class without putting it into a package, would you? |
|
Back to top |
|
 |
timjohnarm |
Posted: Sun Sep 04, 2016 7:56 pm Post subject: |
|
|
Apprentice
Joined: 28 Sep 2004 Posts: 40 Location: Melbourne Australia
|
fjb_saper wrote: |
adubya wrote: |
When you declare the variable within a named SCHEMA then have you tried adding the PATH clause to the esql file of the code looking to use the variable ? |
And what happened when you tried this?  |
Sadly it didn't help.
I've read through the documentation several times and its not at all clear on whether or not you can use a Schema qualifier for variables at all. |
|
Back to top |
|
 |
mgk |
Posted: Mon Sep 05, 2016 3:17 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
its not at all clear on whether or not you can use a Schema qualifier for variables at all |
The doc could be improved here, but essentially no you can't do this with variables, only functions. So the solution is to simply have a "getter" and / or "setter" in the schema for the variable(s) and call that cross schema instead.
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|