ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » "Reflection" in ESQL

Post new topic  Reply to topic
 "Reflection" in ESQL « View previous topic :: View next topic » 
Author Message
mfractal
PostPosted: Mon Apr 07, 2008 2:37 pm    Post subject: "Reflection" in ESQL Reply with quote

Novice

Joined: 07 Apr 2008
Posts: 14

Good time of day to everybody!
I am having a problem ...
And the problem is that I am looking for a way to dynamically invoke ESQL procedures.
The flow is as following :
Inside ESQL i am parsing an XML file that describes a table in the DB. (I am inserting values in that table)
For every field in that DB table there is a NAME OF ESQL FUNCTION that needs to be invoked to get the value to be inserted to that field.

I'll give an example :

Consider the following XML :


Code:

<Table name="TTIITM001XXX">
 <Fields>
  <Field IN="T$CTYP" TYPE="CHAR" LENGTH="3" CALL="getProductType" />
  <Field IN="T$CSIG" TYPE="CHAR" LENGTH="3" CALL="getBlockedValue" />
  <Field IN="T$CUNI" TYPE="CHAR" LENGTH="3" CALL="getMetrics" />
  <Field IN="T$CWAR" TYPE="CHAR" LENGTH="3" CALL="getAlCode" />
 </Fields>
</Table>


Where getProductType/getMetrics/getAlCode are the names of the functions i need to invoke to get the values for the INSERT.

Any ideas ?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 07, 2008 3:27 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You mean you want to evaluate a dynamic string?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Tue Apr 08, 2008 12:54 am    Post subject: Re: "Reflection" in ESQL Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

I think it is not possible in ESQL.

I also think it is not a good idea to send method or function name in your input XML.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
JLRowe
PostPosted: Tue Apr 08, 2008 1:20 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

Do it in java
Back to top
View user's profile Send private message Send e-mail
fschofer
PostPosted: Tue Apr 08, 2008 1:41 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

take a look at the EVAL statement

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ak05020_.htm

Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
marcin.kasinski
PostPosted: Tue Apr 08, 2008 1:54 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

fschofer wrote:
Hi,

take a look at the EVAL statement

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ak05020_.htm

Greetings
Frank



The EVAL statement takes a character value, interprets it as an SQL statement.

The question was about ESQL .
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Apr 08, 2008 1:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No.

EVAL can run any ESQL statement....

It may be easier to do something like

CALL Procedure {myVar} ...

On the other hand that may not work at all

The real difficulty with this approach is dealing with method signatures.
_________________
I am *not* the model of the modern major general.


Last edited by jefflowrey on Tue Apr 08, 2008 1:59 am; edited 1 time in total
Back to top
View user's profile Send private message
fschofer
PostPosted: Tue Apr 08, 2008 1:58 am    Post subject: Reply with quote

Knight

Joined: 02 Jul 2001
Posts: 524
Location: Mainz, Germany

Hi,

EVAL can produce ESQL code
Quote:
If it is a complete ESQL statement, the character string derived from the first stage evaluation is executed as if it were an ESQL statement


From samples:
Quote:
EVAL('SET ' || scalarVar1 || ' = 2;');


Greetings
Frank
Back to top
View user's profile Send private message Send e-mail
marcin.kasinski
PostPosted: Tue Apr 08, 2008 2:08 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

JLRowe wrote:
Do it in java


... but in JAVA I can't invoke ESQL procedures.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
marcin.kasinski
PostPosted: Tue Apr 08, 2008 2:11 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

fschofer wrote:
Hi,

EVAL can produce ESQL code
Quote:
If it is a complete ESQL statement, the character string derived from the first stage evaluation is executed as if it were an ESQL statement


From samples:
Quote:
EVAL('SET ' || scalarVar1 || ' = 2;');


Greetings
Frank


Sorry, my fault
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Tue Apr 08, 2008 2:34 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

marcin.kasinski wrote:
JLRowe wrote:
Do it in java


... but in JAVA I can't invoke ESQL procedures.


This is *very* true. The Java method for running SQL statements only lets you run a single statement. And I am pretty sure it won't let you run EVAL...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mfractal
PostPosted: Tue Apr 08, 2008 5:13 am    Post subject: Re: "Reflection" in ESQL Reply with quote

Novice

Joined: 07 Apr 2008
Posts: 14

marcin.kasinski wrote:
I think it is not possible in ESQL.

I also think it is not a good idea to send method or function name in your input XML.


Well, while i generally agree with you, in this case the XML i am talking about is a service description XML, it won't be sent or recieved by anybody, it just sits there on the file system and being red when nessesary.

jefflowrey wrote:

EVAL can run any ESQL statement....
It may be easier to do something like
CALL Procedure {myVar} ...
On the other hand that may not work at all
The real difficulty with this approach is dealing with method signatures.

All my functions are parameterless, so i guess that eliminates one of the issues


Thanks to everybody, i will go and give it a try. I will report back ASAP with the results!
Back to top
View user's profile Send private message
mfractal
PostPosted: Tue Apr 08, 2008 5:25 am    Post subject: Re: "Reflection" in ESQL Reply with quote

Novice

Joined: 07 Apr 2008
Posts: 14

mfractal wrote:

Thanks to everybody, i will go and give it a try. I will report back ASAP with the results!



Works like a charm!
Code:
EVAL('CALL genereateBaanIDByRules();');
Called the procedure, not problems there!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » "Reflection" in ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.