JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-3496

Expressions in JDBC Queries are not evaluated

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Patch submission Patch submission
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Incomplete
  • Affects Version/s: 2.0.1
  • Fix Version/s: 2.0.x Backlog
  • Component/s: Transport: JDBC
  • Labels:
    None
  • Includes test case?:
    no
  • User impact:
    High
  • Configuration:
    Hide
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesource.org/schema/mule/core/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
    	xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
    	xmlns:jdbc="http://www.mulesource.org/schema/mule/jdbc/2.0"
    	xsi:schemaLocation="
                   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                   http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
                   http://www.mulesource.org/schema/mule/jdbc/2.0 http://www.mulesource.org/schema/mule/jdbc/2.0/mule-jdbc.xsd
                   http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
                   http://www.mulesource.org/schema/mule/stdio/2.0 http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd
                   ">
    
    	<description>This is a template.</description>
    
    	<spring:beans>
    		<spring:import resource="spring-applicationContext.xml" />
    	</spring:beans>
    
    	<vm:connector name="vmConnector" queueEvents="false" />
    	<jdbc:connector name="jdbcConnector" dataSource-ref="driverManagedDataSource">
    		<jdbc:query key="getFoo1" value="SELECT * from foo WHERE age=23 AND status=${header:status}"/>
    	</jdbc:connector>
    
    	<model name="testModel">
    		<service name="testService">
    			<inbound>
    				<vm:inbound-endpoint path="in" connector-ref="vmConnector" />
    			</inbound>
    			<component class="components.JdbcComponent"></component>
    			<outbound>
    				<outbound-pass-through-router>
    					<stdio:outbound-endpoint system="OUT" />
    				</outbound-pass-through-router>
    			</outbound>
    		</service>
    	</model>
    </mule>
    Show
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesource.org/schema/mule/core/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
    	xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
    	xmlns:jdbc="http://www.mulesource.org/schema/mule/jdbc/2.0"
    	xsi:schemaLocation="
                   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                   http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
                   http://www.mulesource.org/schema/mule/jdbc/2.0 http://www.mulesource.org/schema/mule/jdbc/2.0/mule-jdbc.xsd
                   http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
                   http://www.mulesource.org/schema/mule/stdio/2.0 http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd
                   ">
    
    	<description>This is a template.</description>
    
    	<spring:beans>
    		<spring:import resource="spring-applicationContext.xml" />
    	</spring:beans>
    
    	<vm:connector name="vmConnector" queueEvents="false" />
    	<jdbc:connector name="jdbcConnector" dataSource-ref="driverManagedDataSource">
    		<jdbc:query key="getFoo1" value="SELECT * from foo WHERE age=23 AND status=${header:status}"/>
    	</jdbc:connector>
    
    	<model name="testModel">
    		<service name="testService">
    			<inbound>
    				<vm:inbound-endpoint path="in" connector-ref="vmConnector" />
    			</inbound>
    			<component class="components.JdbcComponent"></component>
    			<outbound>
    				<outbound-pass-through-router>
    					<stdio:outbound-endpoint system="OUT" />
    				</outbound-pass-through-router>
    			</outbound>
    		</service>
    	</model>
    </mule>
  • Similar Issues:
    None

Description

I have a component which reads from a JDBC query, by passing in a message with headers (i.e. in the example below, "status"):

public Object onCall(MuleEventContext eventContext) throws Exception {
	EndpointURI uri = new MuleEndpointURI("jdbc://getFoo1");
	MuleMessage response = eventContext.sendEvent(eventContext.getMessage(), uri);
	Object result = response.getPayload();

	return result;
}

It's not evaluated, see patch.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Java Source File
    JdbcConnector.java
    30/Jun/08 06:18 AM
    11 kB
    Yuen-Chi Lian
  2. File
    JdbcConnector.class
    30/Jun/08 06:18 AM
    10 kB
    Yuen-Chi Lian
  3. File
    DIFF
    30/Jun/08 06:17 AM
    0.7 kB
    Yuen-Chi Lian

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Daniel Feist added a comment - 01/Jul/08 07:51 PM

I don't see the header "status" in the snippet above.

Show
Daniel Feist added a comment - 01/Jul/08 07:51 PM I don't see the header "status" in the snippet above.
Hide
Permalink
Yuen-Chi Lian added a comment - 02/Jul/08 03:26 AM

Do you see it in the XML config I attached? See case history, Andrew made some changes to it:

...
<jdbc:query key="getFoo1" value="SELECT * from foo WHERE age=23 AND status=${header:status}"/>
</jdbc:connector>

yc

Show
Yuen-Chi Lian added a comment - 02/Jul/08 03:26 AM Do you see it in the XML config I attached? See case history, Andrew made some changes to it:
...
<jdbc:query key="getFoo1" value="SELECT * from foo WHERE age=23 AND status=${header:status}"/>
</jdbc:connector>
yc
Hide
Permalink
Yuen-Chi Lian added a comment - 02/Jul/08 03:30 AM

Oh,

I get what you mean. This is what I did:

MuleClient client = new MuleClient();
Map map = new HashMap();
map.put("status", "0");

client.send("vm://in", "foooo", map);

Hope that makes sense to you. Also, please see the validation of ExpressionEvaluatorManager.

yc

Show
Yuen-Chi Lian added a comment - 02/Jul/08 03:30 AM Oh, I get what you mean. This is what I did:
MuleClient client = new MuleClient();
Map map = new HashMap();
map.put("status", "0");

client.send("vm://in", "foooo", map);
Hope that makes sense to you. Also, please see the validation of ExpressionEvaluatorManager. yc
Hide
Permalink
Yuen-Chi Lian added a comment - 03/Jul/08 03:55 AM

I looked into it again, well, you shall close this issue as invalid as I found this line in ExpressionEvaluatorManager:

if(expression.startsWith(expressionPrefix))
{
  expression = expression.substring(2, expression.length()-1);
}

There an "IF"!

- yc

Show
Yuen-Chi Lian added a comment - 03/Jul/08 03:55 AM I looked into it again, well, you shall close this issue as invalid as I found this line in ExpressionEvaluatorManager:
if(expression.startsWith(expressionPrefix))
{
  expression = expression.substring(2, expression.length()-1);
}
There an "IF"! - yc
Hide
Permalink
Dirk Olmes added a comment - 03/Jul/08 04:52 AM

Closing as per Yuen-Chi Lian's request

Show
Dirk Olmes added a comment - 03/Jul/08 04:52 AM Closing as per Yuen-Chi Lian's request

People

  • Assignee:
    Unassigned
    Reporter:
    Yuen-Chi Lian
Vote (0)
Watch (0)

Dates

  • Created:
    30/Jun/08 06:16 AM
    Updated:
    03/Jul/08 04:52 AM
    Resolved:
    03/Jul/08 04:52 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.